Go Down

Topic: Can I play multiple-sounds(wav file) with one speaker? (Read 345 times) previous topic - next topic

mukisasl

Hi.
We are completely newbie in arduino.

We are making mini launchpad which has 25 pad.

So we need to play at least 3or4 wav-files simultaneously at the same time through one speaker.

Speaker needs to big for our project so we decided use studio speaker.

We are finding shield which have that function.

But, we can't find it at last.

We find some links ,but, we don't know whether them are what we find for.

here's links :
https://www.sparkfun.com/products/8894
http://174.136.57.11/~ruggedci/html/flexible_midi_shield.html
https://www.sparkfun.com/products/12000

If you could give me better alternative, please help.

gorgon

Hi,

in order to play soundfiles with half decent quality you need an mp3 or wav module of at least 10€, but that will only play one sound file at the time. For every level of polyphony you need, then an additional module is needed, with it's accompanying sd card and or sd card reader module.

If playing several samples at once is necessary I'd reccommend you to use a raspberry pi instead, which would also give you lots of DSP possibilities through pure data, supercollider etc if you want.

If you do want to use arduino to trigger mp3/wav files in the end, the only module I can reccomend is the WT5001M02-28P.

cheers

DVDdoug

I've never used an audio shield with the Arduino, but if you can figure out how to send data directly to the shield without "automatically" playing from a file, it should be easy...

Digital audio mixing is done by addition (summation).  And in fact, analog mixers are built around summing amplifiers.     Digitally, you just add the sample-by-sample data (i.e. 44,100 samples-per-second for CD quality audio).

There is one "catch".   Digital-to-analog converters are integer devices.   i,e. If you have a 16-bit DAC and you simply add two (or more) full-volume 16-bit files together you'll exceed 16-bits and clip (or roll-over, etc.).   So, you need to scale-down or average the data streams (before or after mixing).

Normally, DSP (digital signal processing) is done in floating-point.   That way you can avoid "overflow",  and scale-down the data later before converting to integer for the DAC (or WAV file, etc.). 

Also, it should be obvious that both data streams must have the same sample-rate and the same bit-depth.  If they are not the same, one must be upsampled or downsampled.

WAV files are simply a header followed by raw PCM data, so they are easy to deal with.   If you want to mix MP3 (or other compressed files) you have to decompress to PCm before mixing.

Grumpy_Mike

The problem with doing this on the Arduino are:-
1) you can not open more than one file on an SD card at any one time and there is not enough SRAM to buffer them.

2) as mentioned lack of a D/A, you have to use an external one and you have to bit bang the SPI interface because the SD card is using the hardware SPI Pins.



Go Up