I am trying to learn my way around a way to make a small arduino powered device and I'd like to check if its feasable.
My goal is to be able to have multitrack audio playback with separate outputs. What I mean is i'd like to be able to playback (ideally) 6 tracks of audio on the best quality possible (.wav?) and be able to play them in sync. Something like:
kick_track.wav
snare_track.wav
guitar_track.wav
voice_track.wav
... etc.
and have them all playback in sync at the same time, each one with it's own output, so I could then route each one separately through a mixer and external effects.
Is this feasable with arduino in any way? I'm aware of the mp3 modules, would I be able to simply add 6 of those and control them in sync for example?
Thanks in advance for any info you might be able to provide!
I'm aware of the mp3 modules, would I be able to simply add 6 of those and control them in sync for example?
Again the issue of what does "in sync" mean? If you are able to connect 6 shields, of unknown type (doubtful), you could tell each of them, in order, to play something. You have no way to speed up or slow down one device, to keep all the devices playing at the same speed.
By "in sync" I mean playing the 4 or 6 tracks at the exact same time, as in the example I gave it's basically a song divided by instruments and I wanted to be able to output each instrument separately (by jack or mini jack or wtv) and keep them synced as they are parts of the same song.
Basically if what you mention is possible, being able to hit play in all of them at the exact same time and then have each .wav module with it's separate output is my exact goal.
Multiple shields would probably work. If you start the tracks at the same time, they will probably stay in "musically" sync for the duration of one song or longer. But, since each shield has it's own clock they will eventually drift apart and they won't stay in sync at the sample level.
Connect them all in parallel to the Arduino Tx line, send a command to each to play track #1, then track #3, etc.
They do not support playback speed adjustment, so your recordings will need to speed-normalized before you put them on SD cards.
Would the sync problems be noticeable after something like 30min of continuous playback? Would that still be a problem if I was using uncompressed .wav files?
Also, I plan to use tracks with the exact same length in time and in samples, would that minimize the issue?
What if if I used MIDI in some way to be able to trigger the audio files at the exact same sample time?
Can you point me towards a small list of what I would be needing to start building the core of a project like this (imagining I have no arduino or modules yet)?
Best approach - get 2 modules & try it.
I bet the sync-ness will depend on how good the pre-recordings are.
I don't know about midi triggering audio files.
I don't see how that is much different than 6 players all receiving the same message from
Serial.write (0x09);
at the same time.
And if they're wired in parallel, it will be at the same time.
if (digitalRead(triggerButton1) == LOW){
Serial.write(0x01);
}
assuming triggerButton1 is a configure as INPUT_PULLUP with the button press connecting to gnd when pressed.
Here's something I was following along and trying to adapt to 6 players and 6 outputs:
Can I improve this anywhere to mitigate any of the sync problems that might surface?
I'm currently waiting on 2 wav modules to start testing.
My goal is to have a small box outputting 6 tracks simultaneously to a mixer to use in live concerts instead of my laptop and audio interface. I'll try to use uncompressed audio and have the exact same length in time and in samples in the files and do some tests with 2 players and check for sync problems after some time and then build up from there.
I think you fail to understand the concept of how a uP works.
It has a crystal, which is good to within some tolerance.
When it runs code, it executes one instruction at a time.
If you have a s/w routine that plays back an audio track, the uP can play each note in sequence. If you were capable of writing s/w that told the uP to play one note of track#1, followed by one note of track#2, ......one note of track#"n", and then play
note#2 of track#1, then note#2 of track #2 ....then note #2 of track# "n" and then play note#3 of track #1 etc etc etc (you get the idea), then all six tracks would all be AS CLOSE TO "in sync" AS THEY COULD BE. The problem is that in music , notes have something called DURATION, which ultimately will kill you because the uP cannot be playing a 1 second note of track#2 WHILE it is busy playing a one second note of track#1. Windows simulates multiprocessing by running "timeslices" of different programs.
The arduino doesn't have an operating system so the short answer to your question is "no" , you can't do that with an arduino because they will never be in sync for very long.
A DUE has is an 84 Mhz ARM so it may have a chance of meeting your requirements but I doubt a 16 Mhz UNO can. I once did an audio playback project on a 4 Mhz uP and couldn't get enough resolution to get from a whole note to a flat or sharp because the clock was too slow. I had to "hack" the uP and replace the crystal with a 6 Mhz crystal to get the notes to sound correct. In music , timing is everything. If you were able to chop up the 6 audio files into timeslices the playback would never be simultaneous and the attempt to make it sound simultaneous would more than likely sound very choppy.
You might need a multiprocessor system. (6 ATmega328s working in "sync" using a sync clock signal)
Thank you very much for your post and the in depth explanation.
I think I understood the first part of your post, yet I think for what I was trying to do here I won't get many "musical" problems, I was just trying to "hit play at the exact same time on .wav players" and that's an electric signal, which in theory i think it wouldn't give me that many sync problems?
I understand I will probably have to look for external hardware solutions for the .wav players, especially as I'm looking for audiophile quality playback, and then use Arduino in some way to do the "hitting play at the same time" part.
Someone pointed me towards this post
which I don't fully understand as I'm an arduino newbie, I'm reading into it and getting some help from friends here and there.
Seriously, how hard can it be to make a small multitrack playback device in 2015?
It must be really hard because there is nothing in the market that does just that!
You do realize that that is NOT how multitrack recording is done , right ?
Multitrack recording is done by MIXING channels. You know what a mixer is right ?
You make different mixes with different combinations. You retain all your original individual tracks but generate mixes of those tracks. I do not think multitrack playback is done. (normally). I think multitrack playback is (or used to be ) done by mixing. Decoding 6 separate PCM channels simultaneously would require 6 separate uPs.
I've scanned the market for months for a product that does this and there is none. The multitrack recorders you linked record multiple tracks but do not output multiple tracks separatly.
The nearest thing I found were old multitrack cassete and some early multitrack digital recorders (like the Korg D888) that have direct outs of each track.
Other than that it's basically studio multitrack devices that are both too big and too expensive to use in concert scenario.
I think I understood the first part of your post, yet I think for what I was trying to do here I won't get many "musical" problems, I was just trying to "hit play at the exact same time on .wav players" and that's an electric signal, which in theory i think it wouldn't give me that many sync problems?
That's why I suggested the MDFLY modules. Connect Tx from Arduino to Rx of all of them, send the same command to all at once. All will then play file 01, 02, 03, ... c5, c6, c7 at the same time.
If you want 01 from module 1, 02 from module, 05 from module 3, etc, then you need to send out 6 commands together, that will need some more hardware to have all 6 go out at the same time. Maybe 6 shift registers, 74HC165, and a couple of logic gates kind of hardware. Fake a start bit, shift out the 8 data bits at 4800, finish with stop bit.
Hmm, at 4800, could even send the data out using direct port manipulation, use 74HC125 as buffers - disable buffer and pull outputs high, use 2nd set of 74HC125s to create the start bit, then enable the data buffers and send out the data in parallel to all the receivers. Oooh, this could work nice.
Then combine/mix the analog out from the playback modules if needed.
I2S, also known as Inter-IC Sound, Integrated Interchip Sound, or IIS, is an electrical serial bus interface standard used for connecting digital audio devices together. It is used to communicate PCM audio data between integrated circuits in an electronic device. The I2S bus separates clock and serial data signals, resulting in a lower jitter than is typical of communications systems that recover the clock from the data stream. AR9331 which use at Arduino Yun has I2S bus build in, add a group of decoders for multiple channels.
Seriously, how hard can it be to make a small multitrack playback device in 2015?
You forget that the processing power in an Arduino was already weak way back in 1982. Yes the computers were physically bigger but there was more processing power available, and you couldn't do that in 1982. So why is it so hard for you to understand that what you are trying to do takes way more than an Arduino to do it.