Recording Data for "Talking" Servo

Hello everyone,
I'm looking for some advice on how to approach a project. I have a few years of experience working with Arduino, however I have always used 3rd party programs that streamline the coding process (ex. S4A), so while I have a good concept of basic programming logic, I know next to nothing when it comes to using the official IDE. For this project, it requires me to use the actual IDE, so I'm in need of some help.

My problem is as follows:
I'm creating a talking bird for Halloween, and I'd like the beak to move in sync with the voice over that will be playing on a speaker. Instead of manually programming the servo to open and close, I'd like to create a program where I can press a key on my keyboard and it will record how long I hold it down for, as well as record the length of time between each keystroke. Using this program, I can listen to the voice over and create a recording of the beak moving, instead of manually programming it. I can then use the recorded data to make the bird "talk" as naturally as possible.

What I need help with is the general approach to this problem. How do I program this? What is the best way to store this data? What process do I use to detect the keystrokes? Or is there an entirely better way to go about this? Any help is appreciated, thanks!

I used a simple envelope follower into the analogue input to detect the pieces in volume. Then I moved the mouth of my LED robot face so that the higher the volume of the sound was the wider the mouth was open.

It looked very good.

You can use the same technique only with moving the servo controlling the beak.

I think I would hook up a button to the Arduino and write a sketch that recorded the presses, their lengths and gaps, using millis(), but perhaps only to 1/10th second accuracy. I would echo the values to serial monitor, where I could then copy & paste them into a separate playback sketch as an array of bytes. The playback sketch would read through the array and move the servo based on those timings.

PS. I googled for S4A (Scratch 4 Arduino) and was amused to learn that the manual was written by Manuel!

That is what I figured would be the easiest route, other than detecting my keyboard input. Unfortunately, detecting the keystrokes seems to be harder than just hooking up a button, so I'll probably use your method. Good idea with copying and pasting the serial monitor. Thanks for the response!

That would be a great method to use, however I think it would backfire on me. The bird is going to be inside a haunted house, which gets very loud, so I think I'd get some interference. Thanks for the response though!

What will be making the sound? Could you not take a direct signal feed from that, rather than using a microphone?

No you misunderstand, the audio out is directly fed into the circuit, so no matter how loud the environment is there will be no interference, because there is no microphone involved.

This is the video of it in action. The LED flickering is just a result of the shutter speed of the camera beating with the LED multiplexing.
I used this at the 2013 Rome Maker Fair to answer questions in Italian I was asked. I knew the questions I was asked regularly because I had exhibited those projects in the UK so I knew the regular questions. So I keyed in the number to match what I wanted to say. I had a sheet with the numbers and the pre-recorded answers on them.

This is the schematic of what I used to do this. The D/A is is producing the Audio output at A0, this can be any audio source. This is then fed into an audio amplifier and speaker as well as an amplifier using a MCP602 package containing two op-amps. Then on to the envelope follower and finally into analogue input A3.

This is a picture of me showing it to Massimo, the co-founder of the Arduino project.

Note I was ten years younger then.

Oh wow, very cool! That's an awesome project, I admire your talent. And yes I definitely misunderstood, and now that I'm reading it correctly, that's a good idea! I'll have to experiment with it and see if I can figure out how to make it work with the receiver we're using. My problem would be isolating the channel that the voice over is assigned to, as I'll be running multiple speakers on different channels with different audio playing. Do you think I would be able to send a signal to A0 that only recognizes one channel?

Again, thanks for all the help!

Yes. But you must not connect an analog audio signal directly to an Arduino analog pin. Audio signals are AC, and the negative voltages could damage the Arduino. You need to use a circuit which rectifies the signal and then passes it through an envelope follower circuit.

Well the envelope follow does that for you because you prevent any negative voltages by the series diode in the envelop follower.

If you only feed it with the voice channel that is what you will get. But we don't know the rest of your circuit so it is hard to say if you have a separate audio channel for the voice.

1 Like

Ok, thanks for all the help! I have a lot to try out!

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.