Shop OBEX P1 Docs P2 Docs Learn Events
Music control of animatronics — Parallax Forums

Music control of animatronics

tcicatellitcicatelli Posts: 8
edited 2013-02-28 04:22 in BASIC Stamp
Hi-

I built an animatronic stuffed animal that is currently controlled via bluetooth and an app I wrote in Android. I can have it dance fast and slow and move its head up, down, right and left. I use it as a band's mascot and adjust the speed to the tempo of the songs they play. Is there any way to have the basic stamp "listen" to the music, feel the beat of the bass and adjust its speed accordingly?

Alternatively, is there a way for me to embed controller signals into the bass/drum mp3 tracks that could control movements?

Thanks,
-Tom

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2013-02-22 09:49
    Detecting the beat of music is a complex task. It can be done by hardware or software (see here). Hardware requires quite a bit of stuff, but, once you get a beat signal detected, the Stamp could handle most of the rest. Software requires quite a bit of computational power. A PC can handle this easily, a Stamp not at all. Best thing would be to embed controller signals into the audio track. It's easiest to use one track of the stereo pair for the control information and the 2nd track for the music itself. You can embed sound "bleeps" outside the normal range of hearing in the track or even within hearing range, but filter them out. The complexity of the scheme depends on how much information you want to have and how fast you need it to change, something you'd have to decide before proceeding further. Encoding the sound as MP3 complicates things because the MP3 encoder/decoder assumes that the sound is to be interpreted by the human ear and adjusts the recorded information, leaving out some and emphasizing some of the sound to compress it.

    The short answer is Yes. There are a variety of ways to do this, some very complicated, some very simple that might or might not work adequately / reliably.
  • Mike GreenMike Green Posts: 23,101
    edited 2013-02-22 10:17
    If you have a spare audio channel, you can use DTMF (see this) which uses two tones, each taken from a group of 4 frequencies, to provide 16 values. The Stamp can be used for creating these (see the FREQOUT statement description), but you need external circuitry to detect them. Usually 8 x LM567C are used with the outputs attached to Stamp I/O pins. There are other DTMF decoders on the market that do everything in one device. The CM8870 is hard to find, but is still available and you can find sample circuits on the web.
  • ercoerco Posts: 20,257
    edited 2013-02-22 13:38
    Toys R Us was blowing out these "My Keepon" robots for $10 a while back: http://www.amazon.com/Wow-Stuff-870160-Keepon-Interactive/dp/B004U53J4U Supposedly had hardware & algorithm for beat detection. Could be a cheap experiment/hack if you can find one.
  • tcicatellitcicatelli Posts: 8
    edited 2013-02-23 05:52
    Thanks. I started by buying a dancing gopher from Caddyshack on EBay because my wife's band had started to play the theme song in her band. I put it on top of a speaker New Year's Eve 2011 and pushed the start button every 20 seconds or so. The unit would play the song and the gopher would dance, but I couldn't control the start/stop. My original vision was to simply start and stop it remotely.

    As the year progressed, I replaced its processor with a basic stamp, and replaced the hobby motor that moved its head side to side with 2 servos. I wrote a program for my android phone that gave me complete control over it via bluetooth. I even used the accelerometer in the phone to have the head follow the movements of the phone. The phone sends 5 digit codes to the stamp via bluetooth and the stamp drops to the appropriate subroutine.

    I like the idea of DTMF on a spare audio channel as I'm always looking for ways to make this thing more autonomous. I've started to play the bass on occasion and would like the gopher to run itself when I do. The current backing tracks consist of drums on one channel and bass on the other. I suppose I could create an alternate backing track with drums on one side and the control codes on the other?
  • bsnutbsnut Posts: 521
    edited 2013-02-28 04:22
    I suggest this cool tone decoder board when its ready to go on sale from my friends at EFX-TEK.com that is shown on the forum site at this link http://www.efx-tek.com/php/smf/index.php?topic=2009.0

    BTW, I have the same user name as this site just like Jonnymac does on his EFX-TEK site.
  • bsnutbsnut Posts: 521
    edited 2013-02-28 04:22
    I suggest this cool tone decoder board when its ready to go on sale from my friends at EFX-TEK.com that is shown on the forum site at this link http://www.efx-tek.com/php/smf/index.php?topic=2009.0

    BTW, I have the same user name as this site just like Jonnymac does on his EFX-TEK site.
Sign In or Register to comment.