This question already has an answer here:

So, my dog has a 'babble ball', which is a toy ball that plays random sounds when she rolls it around. She loves it, but the sounds are cringe-worthy. I would like to essentially remake this, but playing sounds of my own choosing (in this case, sound snippets from Austin Powers films).

Because it all has to fit in a small plastic ball, space is at a premium, so please bear that in mind - for instance, I -cannot- use a shield. Also, the sound quality doesn't have to be exceptional, given the application.

Currently, I'm planning to use a shake switch to detect when the ball is in motion, and ideally use an arduino chip as the brains. The part I'm struggling with is storing, and playing the audio.

The default Internet suggested option seems to be using pwm to play sound off a microsd card.

I do not want to use a playback chip, as I'm trying to use this as an excuse to learn how to do this.

What I would like to ask, is;

A. Could I store the relevant sound bytes on the arduino itself? Either in the sketch, or some sort of on-board memory? Putting a microsd card in for a couple of seconds max of audio seems overkill.

B. If so, how would one go about doing this?

C. Out of curiosity, how would one play a sound file without the use of a microcontroller? I appreciate it would probably always be easier to use one, but I'm interested if there is some sort of dedicated IC for this purpose.


marked as duplicate by Ignacio Vazquez-Abrams, PeterJ, Voltage Spike, Dmitry Grigoryev, uint128_t Sep 2 '17 at 16:12

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • \$\begingroup\$ "sound snippets from Austin Powers films" would somehow be less cringe-worthy ... ? ;) \$\endgroup\$ – brhans Aug 24 '17 at 11:47
  • \$\begingroup\$ 'Fancy a shag?' - The current sounds are a 'chipmunk'-esque voice saying 'cool' phrases, to give you an idea :P \$\endgroup\$ – Ershin Aug 24 '17 at 19:47

Personally I'd use something like this: https://www.coolcomponents.co.uk/en/audio-fx-mini-sound-board.html (that specific one looks to be line out only but I've seen similar things with an amplifier built in to drive a small speaker) with the shake switch connected to the random playback input pin.

All you need then is a battery, the shake switch and a speaker.

  • 1
    \$\begingroup\$ And a chew proof ball so the dog doesn't chew it open and swallow the battery. \$\endgroup\$ – JRE Aug 24 '17 at 10:49
  • \$\begingroup\$ Yeah, I'm going to use the original housing to be on the safe side. Also, the suggested product does do exactly what I want - but it costs £20, as opposed to the <£5 I'm currently looking at. It also doesn't satisfy the learning criteria. But thanks for the suggestion! \$\endgroup\$ – Ershin Aug 24 '17 at 19:49

Not the answer you're looking for? Browse other questions tagged or ask your own question.