Playing audio files from SD... more than one?

Hello world!

I haven’t gotten an Arduino yet, but I have asked Santa for a kit. :stuck_out_tongue_winking_eye:

The project myself and a few others are looking to work on with the Arduino is a Light Saber sound card. In a nutshell, it will need to read an accelerometer and if there’s a change over a certain amount in X amount of time (IE: Is it moving) it then plays a sound. With an even larger change, it plays a “Clash” sound and so on.

It will also be controlling, via PWM super high power LEDs. (3-10 watts or more) throgh an array of neat little 2A driver chips.

We think (hope) we can make an “Open Source Sound Card” (OSSC) for an equivalent price that folks can hack and modify to their hearts content, plus add in the ability to use sound banks and to fully color blend using high power RGBA LED’s. The idea is to publish Open Source schematics/PCB layouts for a “Nano shield” that will house the Acc, PWM Driver, SD card etc. along with a set of starter sketches.

Current Sound card/LED driver boards for making custom Sabers start out over $100, and usually have one bank of sounds and only drive one single color LED up to 5W. You also can’t program them much (There’s one that’s really pretty programmable but it’s spendy and more important… never in stock, LOL.)

Anyway…PWM and Accelerometer stuff seems doable with Arduino, but the playing of audio files from a uSD card seems to be the biggest hurdle.

Ideally, we’d want to contantly loop one audio file (The Hum) and then trigger playback of a second audio file when certain thresholds are reached. (Swoosh1 SWOOOsh2 SWOOOOOSH3 CLASH1" and so on… without disrupting the playback of the hum sound.

I’ve been reading about using PWM outs to play audio files, but I get the impression that it’s pretty processor intensive… if we try to play two separate audio tracks at once are we going to run in to problems where it has to stop doing anything else while the audio plays?

Could we play two audio files on a single PWM pin?

Maybe we could store the Hum sound on chip as part of the code (I saw an example of that) which would maybe loosen up the uSD card read to only one sound at a time?

The examples I’ve seen of the Arduino reading SD cards and playing audio were ONLY doing that so I couldn’t get a feel for how much “processing power” was left over.

Any chance theres a combined SD audio/other stuff project that someone would be kind enough to direct me to?

I’m a little nervous about jumping in without knowing these are hurdles than can be overcome… well, other than that the Arduino is so cool I am getting one no matter what, LOL.

Thanks in advance for any input!

Add-ons like Adafruit’s WaveShield have a real D-A converter. Mixing multiple audio tracks should be a “small matter of programming”, especially if one of the tracks is small enough to fit in flash (or be described algorithmically.)

I’ve been wishing for an “intelligent” D-A converter with a couple of buffers so that you could tell it things like “play these 128 bytes of D-A data at 8kHz, and come ask me for more data when the data starts to run out.” (about every .016 s) Alas, converters with that much intelligence seem to be mired in “standard” audio formats (16bit, 44kHz “CD”, etc) A second AVR chip could probably do it…

I saw the Adafruit Waveshield… it does look almost perfect, except the one requirement I forgot to mention… LOL, it has to fit in a 1.25" tube. :stuck_out_tongue_winking_eye:

I could maybe try to work out a smaller “Nano-waveshield” but I think it might be over my head.

There’s this guy… (Hope I can post links now… first copy of this long winded post got nixed because I couldn’t post links… and it lost it when I went back.)

Which should be able to trigger sounds serially… which would leave the Arduino playing a “coded hum” and triggering this guy over the seraila connection… IF this responds fast enough. It’s certainly small enough.

Tp specifically state the size… 1.25 x 5 or 6 inches would be the max space… 1.2 x 4 inches would be perfect.