Jump to content
43oh

Syncing a servo to audio


Recommended Posts

I have an interesting problem I'm hoping someone can help me sort out. I'm building a talking pumpkin using a G2553 that will playback audio clips from a SD card with mouth movement synced to the audio.

 

To handle speech, I plan on hooking up an SD card and reading it with the thin_fat package (I can't post links but look up a post on this site called 'SD Media Player with FAT16'). I will output a PWM signal through a simple filter to a speaker. I'm hoping with this micro that I can hit 16 bit audio, but I could live with 8 bit if needed.

 

The part I'm having problems figuring out how to do is syncing the mouth to the audio. I thought about making a secondary file to accompany each audio file with the timings, but I'm not sure I can read two files at once like that, and I really don't want to sit there and make these files by hand. I want to be able to just resample some files and write them to the SD card and run with it.

 

So I've been thinking that the audio waveform would have dead time in the regions where the mouth is closed, but non-deadtime elsewhere. So if I could lowpass the crap out of the audio to eliminate the short pauses and variations and then convert it to TTL, I would be left with a binary mask dictating when the mouth should be open vs closed. I could then switch the waveform to the servo based on which 'mode' it should be in.

 

In theory it sounds good, but I'm not sure the best way to implement this. To do it all on the micro, I believe I would need to buffer quite a bit on the chip, and I don't know if I have enough memory to pull off. I've considered doing this off chip with an RC low pass filter and schmidt gate, but that doesn't solve the delay issue. Maybe if I use a second micro dedicated to the audio processing I could salvage enough memory to buffer it?

Link to post
Share on other sites
  • 11 months later...

Hi @@mbeals, I'm trying to add audio off an SD card as well to my project.  Just checking into seeing if your project was successful and what you can share that might be helpful?

 

I'm using a Nokia 5110 LCD with images on it that I want to sync to audio at times.

I'm using Energia and have the LCD pulling images off the SD card, but trying to find something similar to this Arduino project (http://hlt.media.mit.edu/?p=1963) where they are able to playback audio clips at will.

 

Any suggestions or ideas on the audio work you did would be greatly appreciated!  

Link to post
Share on other sites

The MSP430 isn't capable of PWMing much more than 8-bit audio, and you aren't going to hear the difference in a small speaker anyways.  Although you could filter the audio on the MCU, it would be much easier to pre-process all your audio on the host and store it on the SD card along with your audio.  The SOX audio library will be your friend here.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...