Hi guys! I have successfully created a robot bear, but I am having some problems.
1. He doesn't listen to voice commands
2. When he talks, the servo will not stop after he is done. It is a 360 degree servo, and I have tried to get him to talk through scripts and the talk servo. He successful starts moving his mouth, but it will not stop when the audio is done.
3. Finally, I would like to know how to get him to sing to mp3 music.
I could really use some help, it's my first robot. Thanks!
Asked
— Edited
Have you put the Speech Recognition Control into your project and put in voice commands? Do you have a microphone connect to your computer?
You can't use a 360 servo for a talk servo, use a regular servo (180 degree) for your talk servo.
Have a look at the tutorials.
First off, welcome to the forum. So let's start with the first question about responses to speech recognition.
Q1.
There could be a few reasons to why your bear is not responding when you speak. One reason could be that your computers speech recognition software needs some training to understand your voice better. Another reason could be the "Confidence" levels need to be adjusted in the speech recognition control menu. Take a look at my speech recognition tutorial (linked below), which should tell you everything you need to know to get it up and running properly...
Speech Recognition Tutorial
Q2.
As for the servos, as you have already read from the other guys, 360 servos are not ideal for what you want. A couple of ideas though.
1.) Bearing in mind that I don't know the gear setup, but you could do a bit of hacking and remove some of the mouth gears to leave the main gear of mechanism that moves the mouth open and closed, and as mentioned, attach a 180 servo to move up and down (or whatever). Then you could use the "Talk Servo" control which will do what your after.
2.) If you really have to use a 360 servo, a way around it would be to use some Sleep() commands with the speech commands when your bear talks. If you have a set amount of phrases you want your bear to speak, you could start the servo moving, then insert a sleep command, then stop the servo moving. The sleep command would be the length of the phrase being spoken. For example, if your bear said "Hello. How are you feeling today.", and that phase would take 3 seconds to be spoken, then a script for that would look something like this...
Code:
You would set the servo speed to whatever you wish it to be, and would have to change each length of the sleep command to the length of each and every phrase spoken in your bears vocabulary. Or you could use..,
Code:
This is the only way I can think of doing it using a 369 servo right now, but as has been suggested, a 180 servo would be a much better option.
Q3.
As for singing along to an MP3, this would be a little more tricky no matter what servo you used. The reason being is that if you had a song playing, and the mouth moving along to everything in the track.
When lyrics were being sung... the mouth would move (good).
With a break in the lyrics and just music playing... the mouth would still move (not so good as the bear would be singing along to no words).
But, if the MP3 track plays through the EZ-B speaker, you can use the "Soundboard V4" control, then you could add scripts to certain parts of the track that has lyrics (ie, get the mouth to move) and get the servo to stop moving when just the music is playing. Below is a link to a "Soundboard" tutorial I wrote, and a "Soundboard v4" tutorial DJ wrote...
Soundboard PC & EZ-B Tutorial
Your First Dance (Soundboard EZ-B Tutorial
Hope that helps, and good luck.
What servo did you end up using in the end... the 180 or 360 contuinious rotation servo? Knowing this, we'll have a better idea of what script example to suggest to you. Also, are you going to use the "Soundboard EZB" control for the singing bit?
Another way could be to use the servos minimum and maximum positions in a script to make the mouth move for the length of time the singing parts last for, using sleep() commands or changing the servo speed to match the words and pauses being sung to make the mouth move faster or slower depending on what's being sung, which would make it more natural looking.
Follow the "Your First Dance" tutorial to get an idea of how to edit and add script within a music track. Hope that all makes sense.
So that being the case, the second option in post #11 would be the one to use. Use something like...
Code:
This would go at the starting points of any lyrics being sung on the MP3 track. Add more mouth opening and closing script lines, and change the length of sleeps to go with what is being sung. It may take a while to go through the whole song, but once you get the first verse or chorus of the track right, you'll have an idea of what to do for the rest. Hope that helps a little.
Audacity has a "karoke" function that deletes sound that is even across the left and right channels. For 90% of music, this removes most of the foreground vocals and leaves backing vocals and instruments which tend to be recorded stronger on one channel or the other to give the music depth and stereo seperation. It should not be too difficult to do the opposite to programmatically identify the vocals and have a servo move to them. Won't be perfect, but might be close.
Alan