Society of Robots - Robot Forum

Software => Software => Topic started by: Myrad on September 13, 2013, 08:26:00 AM

Title: HELP: Robot dancing to the rhythm
Post by: Myrad on September 13, 2013, 08:26:00 AM
Hi,

I am currently working on the a project which a robot's dance moves is based of the rhythm of a music.

If the rhythm goes fast, the dance moves of my robot will go fast, if the rhythm is slower, the motion of my robot is also slower. I am working on a Robotis Bioloid Robot.

Please advice, thanks!!! :-)
Title: Re: HELP: Robot dancing to the rhythm
Post by: Pogertt on September 13, 2013, 11:09:14 AM
If you have your robot play a wav file, you could generate a clock signal dependent on the number of samples played.

That clock could be used to initiate pre programmed movement commands at specific times during the playing of the music.
Title: Re: HELP: Robot dancing to the rhythm
Post by: jwatte on September 13, 2013, 11:27:05 AM
Pogertt's suggestion works if you get to control the music yourself. You would use the source music as time code, and program robot movements to happen at certain time code markers. One kind of time code is "number of samples played;" other kinds are MIDI Time Code (MTC) and SMPTE time code.

If the music is not under your control, you need a microphone, and a beat detection filter. Beat detection can be done with fairly low computing power, and you don't need super high fidelity sound input (but it helps.) An ATmega running at 16 or 20 MHz could do this using one of its analog inputs, if you set it up to auto-trigger the ADC sampling, and coded your filter in 16-bit fixed point. (The Arduino libraries are too slow to support this.) The ATmega wouldn't really have the power to do anything else, though, so you'd need to send the detected beat out through some I/O pins or serial port to whatever motion sequencer you have.

There are a lot of links and research on beat detection or tempo detection from audio, because it turns out to be a tricky problem. The easiest is to build a fairly narrow notch filter with a detection frequency of 100 to 140 Hz or so. This will pick out the bass drum of most music, although you'll also get crosstalk with the bass instrument. Then run a peak detector or envelope follower on the signal that comes out, and trigger a "beat" when it has a sufficiently sharp "rise."
Title: Re: HELP: Robot dancing to the rhythm
Post by: Myrad on September 14, 2013, 01:02:43 AM
Pogertt's suggestion works if you get to control the music yourself. You would use the source music as time code, and program robot movements to happen at certain time code markers. One kind of time code is "number of samples played;" other kinds are MIDI Time Code (MTC) and SMPTE time code.

If the music is not under your control, you need a microphone, and a beat detection filter. Beat detection can be done with fairly low computing power, and you don't need super high fidelity sound input (but it helps.) An ATmega running at 16 or 20 MHz could do this using one of its analog inputs, if you set it up to auto-trigger the ADC sampling, and coded your filter in 16-bit fixed point. (The Arduino libraries are too slow to support this.) The ATmega wouldn't really have the power to do anything else, though, so you'd need to send the detected beat out through some I/O pins or serial port to whatever motion sequencer you have.

There are a lot of links and research on beat detection or tempo detection from audio, because it turns out to be a tricky problem. The easiest is to build a fairly narrow notch filter with a detection frequency of 100 to 140 Hz or so. This will pick out the bass drum of most music, although you'll also get crosstalk with the bass instrument. Then run a peak detector or envelope follower on the signal that comes out, and trigger a "beat" when it has a sufficiently sharp "rise."

The music is not under my control. I have not much background on programming. :( Is that any website/book that provides a step-by-step tutorial which I can refer to? Am totally lost in this.

How do I transfer to beat detection to a Bioloid Robot? http://www.robotshop.com/robotis-bioloid-comprehensive-kit-12.html (http://www.robotshop.com/robotis-bioloid-comprehensive-kit-12.html) This is the exact bioloid I am using.

I have tried to research on this project and I found this link: http://paginas.fe.up.pt/~ee03123/descricoes.htm#C11 (http://paginas.fe.up.pt/~ee03123/descricoes.htm#C11) The idea of it is related to my current project, the difference is that they are using a NXT Lego while I am using Robotis.

I am using RoboPlus Task and Motion to create the basic dance moves. Is it possible to link the beat detector to the Bioloid via RoboPlus and Motion? Sorry for being such a bother, I am a novice in this area.
Title: Re: HELP: Robot dancing to the rhythm
Post by: jwatte on September 14, 2013, 11:33:01 AM
Quote
How do I transfer to beat detection to a Bioloid Robot?

Easiest would be to use the Zigbee peripheral they have to send wireless commands to the robot.
If you can use your PC to detect the music, the beat detection is simpler, because you can use the PC microphone or line-in, and the powerful PC CPU.

You might want to google for some keywords, such as "beat detection algorithm" and even "beat detection software" and look through the first few pages for options.