Go Down

Topic: How to play multiple MP3 files at the same time? (Read 775 times) previous topic - next topic

kelvin16

Hello and good morning!!

I want to know how to play multiple mp3 files at the same time using an Arduino board and MP3 shield. Is it that posible? Or I need to use threads or something like that?. I want to build a piano, then, for that reason a need press 2, 3 or more keys at the same time.


Thanks!



MarkT

No its not possible.  For that you need several mp3 modules.

But mp3 is definitely not the way to go anyway as mp3 playback has a start-up overhead due to the decompression algorithm.

For a sampling keyboard you need uncompressed samples, in memory, ready for instant playback.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Grumpy_Mike

It is only possible if your MP3 reader is capable of more than one sound at a time.
Most are not, the only exception I know of is this one than can play up to 14 sounds at the same time:- https://robertsonics.com/wav-trigger/

MarkT

That's not MP3 though, that's uncompressed WAV only.  It has 10ms delay to sound and +/-2ms jitter
in that, which is good enough for a midi keyboard.  I presume it uses native mode on the SDcard to get
enough throughput for 14 stereo simultaneous playbacks.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

DVDdoug

#4
Sep 11, 2019, 09:07 pm Last Edit: Sep 11, 2019, 09:09 pm by DVDdoug
Quote
same time using an Arduino board and MP3 shield. Is it that posible? Or I need to use threads or something like that?. I want to build a piano, then, for that reason a need press 2, 3 or more keys at the same time.
I don't know how a modern digital keyboard works.   You might want to research that, and maybe try to find a block diagram and/or schematic for a "real" keyboard.   Maybe look for a service manual.

I assume normal keyboards play WAV files or "raw" PCM files/data, and of course there is a DAC.   There's no reason to use a compressed format since you only have to store short samples.      Older keyboards used synthesis to generate  waveforms, but I'm not sure if that's done anymore.  Digital mixing of PCM data is straightforward as-is analog mixing.   I'm sure it's done digitally because analog mixing inside a keyboard would require multiple DACs.

Probably the easiest DIY solution is to build a MIDI controller and then use your computer with MIDI software and virtual instruments to generate the sound. 

Or, the more practical and economical solution  is to buy a MIDI keyboard controller (or a full keyboard with audio).   Keyboard controllers  are inexpensive because they don't have any built-in sound...  They just send MIDI messages to the computer, or to a MIDI instrument.   (Most MIDI keyboards are controllers and instruments so they can play stand-alone without a computer.)



Go Up