How To Control Servo Moving When Play Music Or Audio?

 
#1

Hi,

Anyone can help to control the servo moving during play music? EZB4 have a talk servo function for text speech. But how about the music or audio?

I have tried the Sound board(PC) and Sound Servo(PC Speaker) to play the Music file, then the sound servo screen have a wave form, but the servo motor is not active(It already set min. & max number).

Pls. note the attached picture for ref.
User-inserted image

Can anyone help to answer this question?

Thanks a lot! Winky

#2

"Soundboard EZB" will do what you want.

http://www.ez-robot.com/Tutorials/Help.aspx?id=199

But if you want to use the "Soundboard PC" and "Sound Servo (PC speaker)", you can use a simple script. Add an "Ez-Script" control to your project, and, as an example, add the following example script...

Code:

#Assuming servo is connected to port D0

loop
if($SoundValue >30)
Servo(D0,180)
Sleep(500)
elseif($SoundValue <29)
Servo(D0,1)
Sleep(500)
endif
sleep(100)
goto(loop)



When the sound level goes above 30, the servo will move to position 180.
When the sound level is below 29, the servo will move to position 1.
Play with the "Update Speed" and "Scalar" settings, and the servo positions and length of sleep()'s in the script to suit your needs.

#3

Hi Steve

Thanks your help again Grin

Yes, I have copy & paste your script to EZ-script, but it pop up the message...
Pls. see the picture file.

User-inserted image

And I have try to use the Sound board EZB & press the edit button, it is not show the wave form and pop up error message.. why?
Pls. see the picture file. Frown

User-inserted image

So depression.... Frown

#4

Hi, in line 3 of the code it should be ":loop" not "loop"

#5

Sorry, typing error. That should be...

Code:

:loop

#6

Hi Steve & Proteusy,

Thanks a lots!

So, do you know what wrong with my sound board ezb problems?

My music is MP3 and then import and press the edit button, it can not shown the wave form and pop up the error message box!

Appreciated for help! Winky

#7

@rickymahk2013

Post your project with the soundboard EZB in it so one (or more) of us can test. I suspect we might have another locale/internationalization issue, but I am not sure. Would like to see what the error message is saying in English if the problem is duplicated on US systems. Can you tell us what that error message is saying?

Might be good to make a zip file and also include the MP3 you are using, so we can see if it is an issue with the music file itself.

Alan

#8

Hi Alan,

Yes, I will do that before Sat! Thanks for your reply and help! Winky

#9

Hi Alan,

Here is the link(ezb project & mp3 file ) for testing and screen clip picture for ref.

https://www.dropbox.com/s/k57k51j8icwhjqe/Audio%20test.zip?dl=0

User-inserted image


Really thanks for everyone help ! Winky

#10