audio and movement synch. 2 songs at the same time

hey guys, in an earlier post i already mentionend that im trying to create a guitar playing and singing little puppet. the guitararm and the mouth is controlled by two servos. now i finally got the shifty VU shield. i took my song and panned the guitar to the left channel and the voice to the right channel. that'S how i can controll mouth- an guitararmservos seperatly. and it works. but the problem now is, that of course the song sound shitty when voice is right and guitar is left. thats why i' searching for a solution to let two songs play at the same time. the first song should be the original (the good mix) and the second one should be the panned song that controlls the servos. but i actually dont want a software that plays the two songs at the same time. in the end the puppet should be controlled by one or two mp3-players. i dont want to use a computer. just real small devices, that can be carried anywhere without having the whole pc with me.

do you have any ideas how i can solve the problem? my idea was: maybe to buy two simple mp3-players and create some how a button that makes both players start at the same time. but i dont know if ist possible... of course both player must start exactly at the same time. i need maybe something like a digital trigger. any easy lowbudget ideas?

thanks in advance and sorry for my bad english^^

One idea would be sending the servos control via MIDI, which would give you much more control over.

You just use a free MIDI + Audio software, which sends the original Stereo Music to the speakers and the servos control via a MIDI cable. Them you can use the Serial-to-MIDI converter found on the link below to use the USB connector as a MIDI device.

MIDI is very easy to handle, I can send you some codes if you want, or just google for Arduino MIDI Input.


barbarian: i took my song and panned the guitar to the left channel and the voice to the right channel. that'S how i can controll mouth- an guitararmservos seperatly. and it works.

Well, first a question. Is it your song so you can so easily divide between voice and guitar? If you recorded it you could actually have various easy solutions. 1) use 4 channel non compressed audio (mp3 does not support 4 channels, and audio surround is not really supported) or (I guess is much better as a solution) 2) create a metafile format (this can be automated) which you can synchronize to an mp3 players timecode information. If you use the Rogue MP3 player it is quite easy to do. Save a file for each song with he same name that contains the servo movements, on start you open that additional file. You can make that as easy as using a sparse array with fixed time slots for, let's say every 100ms a slot so you have 10 servo events per second (more than enough I guess). You just need to seek to the position in the file and read the data and send to the servos (some synchronizing and calculations have to be done as the player will give you seconds resolution so you have to fill in the 1/10th of the second by resync and interpolation).

Also using the Midi SysEx or ControlChange format in this case is quite common by saving the data in an SMF, but is a bit more tricky for reading and sync. It would give you the flexibility to scale your program to support also a light show for the guitar voice performance synced to the rest.

there are loads of embedded mp3 players, search on sparkfun for mp3 and you will find a few!

sorry for not reacting on your answers. but yet i have almost no idea how your solutions will work. first i've got to read about midi and also about the meta file format that was mentioned to proberly understand what you mean. the first solution seems to need a PC, right? the second solution i dont get ;)

@juergen... yes this i s my song. i have one final mix and one mix where i've panned the channels for the movement

do you think that it's possible and easy to use ONE mp3player (f.e. from Sparkfun). and create a real button. if the button is pushed than TWO songs were played at the same time. without using PC. the first song goes into the arduino via "shitfy vu shield". the second one goes to the headphones or speakers.. but that would mean that i need a mp3player that has two stereo outputs

or... i use two mp3 shields that get started by a button at the same time... hmpf... brainf$%&ing^^

there is no mp3 sheild / embedded player out there that plays more then two samples that i could find.

surley you just need to pre record the movements of ur pupet? then just play the mp3 using one embedded player and play back the movements from a big array.

so how ever u are creating the movements at the that code but instead of sending the commands to the servos just store them in a big array.

then play the song and run though the array at the same time and they should stay in sync?

well well well… i tried the last idea because it sounds simple for me…
i send the audio to the arduino, read the pinvalues and send them back to the monitor. out of these values i made a really very big array by copy-pasting the whole thing. delay was about 15.
it was only the array for the guitar and it’s not working. seems that the array is too big. its about 40KB.
for the voice there will be 40KB as well … so… without buying RAM or something it will not work.

is there really no way to maybe “hack” two equal off-the-shelf mp3 players?
i thought someting like this:
buying a button. if the button gets pressed, an impulse is sent to both mp3-players and they will play both songs at the same time?
that sounds so easy… but doesnt know how to realize it :.

Does the audio need to be stereo? You could use the left and right channels for your audio reactive requirements and then mix them to one channel that is the amplified output. Or, if this is on some kind of puppet, you could put the voice speaker in the doll's mouth, and the guitar speaker in the guitar!

yes. it should be a stereo file. it's a long story about the puppet. but.. fact is: i need a puppet. (it's a 2d-cardboard puppet) the arm- and mouthmovement of the puppet is controlled by two servos. the servos are controlled by the left and right channel of the sound file (via shifty vu shield) aaaaand last but not least the song must be played in best quality. best quality = the final mix.

it's no option for me to mix it afterwards. the "real" song has more guitars and more voices. and i arranged the song the way i wanted. on sound issues I wouldn't be happy with a compromise.

in not using speaker in the puppet. maybe just headphones. in the end it's going to be something like a life musicvideo. im going to capture the whole thing with a camera in real time and show it on a TV.

what's about the rMp3 ( 1. is it possible to play two files at the same time with one of it? 2. is it possible to play two files at the same time with two of them? any experiences?

damn... I got it! I made a 4-channel wav-file (5.1. surround). L + R channel is sent by stereo cable to the speakers(headphones) and the other two channels are sent also by stereocable to the shifty vu shield. thanks for participation and special thanks to juergen ;)

barbarian: thanks for participation and special thanks to juergen ;)

Glad to help. Can you give a brief description of the system, maybe someone could be interested in that 4 channel audio thing (how to read the file, what shields you used in the end etc.)?

Well... I try ;)

Devices and Stuff: - arduino uno - shifty vu shield - 2 servos - a self-recorded and mixed song -> for the listener - the raw files of that song -> for the song that controles the servos (L-channel = Voice, R-Channel = Guitar) should also work for visualizations - a device that can play 5.1 files (PC with 5.1 sound card or maybe a DVD-Player)

Software: - Audioeditoring programm - > panning voice and guitar to L and R + creating 4 mono WAV-Files out of the two songs + creating a 5.1 File out of the 4 WAV-Files

I recorded with Logic (shareware) I used Adobe Soundbooth CS5 (shareware) to create the monofiles. And I used Adobe Premiere Pro CS5 (shareware) to create the 5.1 WAV-File. There I panned the final mix to Front L and R and the controlling mix to Back L and R.

Explanation: The shifty vu shield is able to receive a stereo signal, get its' volume values and send them to the arduinos analogue pins. These values can be used to control servos, light bars or whatever. So... what I finally did is: When I play the song on my VLC player. My Soundcard sends a stereo signal to my Headphones (or HiFi-System). Via speakerslot of the card. And it sends also a stereo signal ouf speaker-back-slot to the arduino. And so I can control the the servos while listening to the song at the same time.

It's not testet yet. But for being independent of a PC-System I'm going to use a DVD-standalone-player with 5.1 outputs. I think it should work while using two 2-chinch-to-stereojack cables. One is connected to the arduino, the other one to the sondsystem.

I'm just not sure if I need any amplification between DVD player and arduino/soundsystem. Does anyone know if I will need it? Right now I can't try because I don't have a DVD-player with 5.1 outputs?