Concurrent sound effects

I'm almost done with my current project which utilizes two motors to control a toy. Unfortunately I've learned the hard way about the limitations of a single processor system like arduino. I've also read about how you can run processes at the same time by essentially sequencing them together. The trouble I have is that I can't effectively do that with a sound effect, as it would of course be all chopped up.

Specifically I'm having trouble finding my "home" switch when a sound effect is playing. I'd like to search for it and cut off the sound when it arrives, or at the very least just stop the motor when it finds its home switch.

As is, it will never find it so long as it is busy playing the sound effect. The only hope of finding home is during a pause (it is a looped effect).

The shield for arduino I'm using now is the Freaduino listed here: The module that I feel like I maybe should be using is discussed on this forum here:

I feel like the 2nd may be a better choice as it appears that it can operate as an independent unit/processor for simple sound files. I imagine that would allow it to play sound effects regardless of what the arduino processor is busy doing, and that would be good.

Although, I have yet to find a compatible memory card with it, I'm hopeful I can get it to work (as I have recently received this module and been experimenting with this silly AD4 format).

Anyway, thanks for any help! Long time lurker, 1st time poster! -k

Can add an MP3 module with serial interface - send it start track command, pause, stop. It plays the sound, frees the arduino to do whatever. More expensive one has 8 inputs also, pull one to play that track.

Thanks Crossroads! I think my 1st reaction would be to just buy that more expensive one as the 8 button "direct interface" is something that is easy for me to understand/interface with, however I hired a guy to do the programming for this project, and I feel like the shield we are using may have a "serial interface" that you describe but perhaps we are not controlling it properly.

The shield lists pins for:

"D10 - Used for SPI Chip Select. D11 - Used for SPI MOSI. D12 - Used for SPI MISO. D13 - Used for SPI SCK"

These are interfaces I'm not specifically familiar with. Is there one that would be a preferred method to drive these operations given my situation? Sorry I'm not yet a programmer- I'm only learning this now, so I have a lot of (probably dumb) questions.

The pins you listed are the SPI interface, a high speed serial interface useful for moving lots of data quickly, such as to shift registers or to a DAC.

The serial interface for the MP3 module just uses 4800,N,1 for the data rate at 5v level. Can be Software Serial even, doesn't have to be the hardware UART port.

The only tricky part is setting up the SD card. The files need to be numbered 01.mp3, 02.mp3. Then use explorer and drag them onto a freshly formatted SD card in their order number.

I found some lower level document at the VLSI Solutions website for the VL1053B, or the VL1003, that describes how the file stricture in interpreted. Basically, number the files 01 to 09, then 0A to 0F and continue in hex format up to C7 (199 decimal) and copy them in order to the SD and they will play back as expected. See page 11/12 here:

Thanks again! I've been studying up on what these pins mean and how they work. I found this link particularly helpful, even if I don't fully understand it yet.

Is your statement on file numbering relevant to both the freaduinoMP3 shield and also to the module that uses AD4 files? or just the latter? I have my files organized that way on the microSD that I'm using for the module (although they are still not playing yet), but files for the shield are (I think) much more lenient in terms of compatibility. I have successfully played both mp3 and wav files with full filenames by calling them up in the program. I see also that there is an "SPI interface" (6 pins) that connect to the arduino uno- so my hardware is evidently already in place (at least on the freaduino shield).

I'm still reading & studying the points you've made one by one, but I want to be clear that I am calling these sound effects up as needed based on the program and sensor feedback. I'm not just sequentially playing an assortment of files.

Thanks again for the help! I really appreciate it! I'm sure this will all make lots more sense to me in a few more hours of study!

I was only referring to the MDFLY MP3 modules. The files can be called as needed, just send the file number you want played. I have a keypad, I read in three digits, sent that to the module (as a hex number, 0x00 to 0xC7), it plays to the end of the file unless Stop or Pause is sent. Each command just takes 1 byte to be sent over.

I haven’t looked into the freeduino modules. $10 and quick delivery was good for me.

MP3 Module.pdf (83.1 KB)

Vs $19 and a bunch of features I wasn't interested in

"The Freaduino MP3 music player shield is based on VS1053b IC." Same chip.'

"The MP3 music player shield has SD card socket and a 4 direction Joystick w/ multifunction switch support Vol-/Vol+/Next/Previous/Pause."

Same commands, I just send them serially after a keypad press.

No data on how many songs the Freaduino shield supports. Could be a software thing that the MDFLY only supports 199 - or it could be a feature of the chip.

You can see my setup here.

I have to modify it to put electrolytic caps in series with the amplifier line ins, MDFLY thinks DC might be getting back in & taking the output section of the chip; had 2 boards die with high pitch whine being output while the serial interface still appeared to work (based on status light still going on, off, or blinking in response to commands).

Thanks again! I'm actually surprised to be having this much trouble with it, and that there isn't a more accommodating piece of hardware that makes this easy. The wtv020 seems pretty ideal, but with the weird file naming conventions, the dos converter tool, and quirks with volume, mono, and microSD card format (even within acceptable size) it really has been a hassle so far. I've read that it can accept wav files too now, but so far I have not gotten it to do anything at all.

Still having problems with playing the sound files occupying the arduino's operations, so I may just skip that entirely and use premade record/playback modules to play whenever the motors engage. I think I can make this happen with only two clips if I do some sneaky editing.