Arduino Forum

Using Arduino => Audio => Topic started by: russdx on Jan 27, 2011, 11:22 pm

Title: Playing two samples at once!
Post by: russdx on Jan 27, 2011, 11:22 pm
Im trying to create a little audio board that will be able to play two samples at the same time!

I want to use ONE sd card / eeprom with ONE arduino and TWO mp3 decoders

im thinking of using this dataflash to store the samples (AT45DB161D), the samples will be very low bit rate and small in size so 2meg should be enough

is the arduino fast enough to stream data from this dataflash and send it to two mp3 decoders?

(http://russdx.frankster200.com/slot/sch.PNG)


any better ideas on how to play multiple samples? (they can be wav/mp3 or wot ever really :))

i dont want to simply just buy to ready built embedded mp3 player modules i want to build this thing my self :)

thanks
Title: Re: Playing two samples at once!
Post by: Senso on Jan 27, 2011, 11:50 pm
Probably not, if you can only read one piece of a sample in each acess to the Flash how will you play TWO different samples at once?
But if the mp3 chips are the VS family they probably have more processing power than one arduino..
Title: Re: Playing two samples at once!
Post by: russdx on Jan 28, 2011, 10:44 am
My plan was

When i down load the samples into the flash they would all be joined together and ill have a little array with the starting index location for each sample.

The mp3 chips work by requesting upto 32 bytes then when there buffer is full they stop requesting, giving you time to do other things. (my low bit rate will give me alot of spare time! as i wont have to stream the mp3 data that quick)

So i think i would get away with (im using very low bit rate like 22kb) jumping around the flash while the mp3 decoder is full to get data for the other mp3 decoder.

i think it could work! :)



i could probably do the same idea using the sd card and just having 1 mp3 with all the samples in it, but im pretty sure the flash will be alot quicker then sd card?
Title: Re: Playing two samples at once!
Post by: Grumpy_Mike on Jan 28, 2011, 02:22 pm
Quote
i think it could work!

Well as with a single sample sound card from Ada the maximum bit rate is about 24K samples per second for a wav file, I recon that you can probably only go at 11K bytes / second on your MP3. However as the MPĀ£ is compressed you need to fetch a lot fewer samples so you might just be able to get away with a decent decoded sample rate.
Title: Re: Playing two samples at once!
Post by: WilliamK Govinda on Feb 03, 2011, 10:32 pm
I remember seeing a MP3 chip at SparkFun.com that could handle 2 MP3 streams at once. Maybe that would help you out?
Title: Re: Playing two samples at once!
Post by: russdx on Feb 03, 2011, 10:38 pm
ah yes could you track that chip down again
would save me using two decoders

thanks :)
Title: Re: Playing two samples at once!
Post by: WilliamK Govinda on Feb 03, 2011, 10:42 pm
Here, but sadly not MP3 support, but 3 streams at the same time!  :smiley-mr-green:

http://www.sparkfun.com/products/8894
Title: Re: Playing two samples at once!
Post by: WilliamK Govinda on Feb 03, 2011, 10:45 pm
Also: http://www.sparkfun.com/products/8953

This looks like a nice chip, I'm curious too now. ;-)
Title: Re: Playing two samples at once!
Post by: russdx on Feb 03, 2011, 10:53 pm
wav is cool lol
Title: Re: Playing two samples at once!
Post by: WilliamK Govinda on Feb 03, 2011, 10:54 pm
And it gets better, it takes compressed WAV, not as good as MP3, but it is great.
Title: Re: Playing two samples at once!
Post by: russdx on Feb 03, 2011, 11:02 pm
doesn't look like any one has written a arduino library for it.

this could be interesting
Title: Re: Playing two samples at once!
Post by: russdx on Feb 05, 2011, 05:33 pm
aless i have read the datasheet wrong the VS1103b can only mix the line in, midi and wav streams     u cant just give it 2 wav streams

so it does mix input streams but just 1 of each type :(

http://www.vlsi.fi/fileadmin/datasheets/vlsi/vs1103.pdf

could some one confirm this as im quite new to electronics :)



looks like i might be back to using 2 simpler VS1xxx mp3 decoders hehe
Title: Re: Playing two samples at once!
Post by: WilliamK Govinda on Feb 05, 2011, 09:58 pm
Actually, its Wave Streams so its multiple streams. ;-)

VS1103b is a single-chipMIDI/ADPCM/WAV audio decoder and ADPCM encoder that can handle upto three simultaneous audio streams.

So yes, it allows you to send 3 audio-data, plus, it mixes the other analog signal along.
Title: Re: Playing two samples at once!
Post by: russdx on Feb 05, 2011, 11:38 pm

iv had a quick read of the datasheet and cant see how you send it 3 audio streams, how does it know which stream is which?
it only has 1 spi data bus like all the other vs1xxx mp3 decoder chips and seams to work pretty much identical to them. cant see how you send it three streams how does it know which is which?

any help would be much appreciated it
Title: Re: Playing two samples at once!
Post by: scjurgen on Feb 06, 2011, 12:20 pm

When you send i.e. PCM you specify the number of channels you want to send in the header (page 42 in the VS1103 datasheet) and set length to -1. Then you feed the data to be converted to Audio. Be aware of all the different formats (2's compliment i.e.) and the byte order.
Title: Re: Playing two samples at once!
Post by: russdx on Feb 06, 2011, 02:06 pm
ahh, for my board it might be playing one sample by its self then another one might start so its at that point they will need to be glued together. then the first one might finish so it will just be left with the original one.

maybe using 2 normal vs mp3 decoders would be alot simpler + i would be able to use mp3