Hello, I had a working JAW/mouth working with older software. I upgrade to the lastest software and can't figure out how to sync the jaw using a analog to digital from my PC to the power amp that goes to the ADC0. I can't figure out how to make it work using the new software.
This is what I had using the older software for the jaw sync...If (ADC(ADC0) > 1)
Any help would be nice.
Upgrade to ARC Pro
Synthiam ARC Pro is a cool new tool that will help unleash your creativity with programming robots in just seconds!
I wont re-write the code as I don't know the specifics and I'd like for you to try yourself, it'll be more rewarding. But if you do need more help just shout, that's what I'm here for
You're right about more rewarding. However, I've been working on the jaw sync for 8 hrs and it makes my head hurt. I just don't understand programming and the logic. Do you mind giving me more examples please? If you need more info please let me know.
Here is what I have so far.
adc_wait(adc0, higher, 0)
if (getadc(adc0) < 1)
It works some what, but it moves when there is no sound out of the speaker
One method would be to write a script that just loops around the movement of the jaw, moving the servo from position 45 to 80 to 45 to 80 etc.
Then have another script which checks the ADC value with either an If(GetADC(ADC0) > 1) or with an ADC_Wait command. Once the ADC value change is detected then use a ControlCommand to start the movement script. When the ADC value is 0 (or below a small tolerance) use the ControlCommand to stop the movement script.
You may also be able to use the Auto Position control and set up a few different frames and actions which can be started and stopped with ControlCommand.
So have something like these;
If your ADC value varies with volume you could have a bunch of IFs in the movement script which check the ADC value and move the servo to a different position. You could use the random number command to adjust the sleeps for random gaps to make it look a bit more realistic. There are a number of things you could do to improve the motion which I'll cover if you need it once you get the actual detection and starting of the movement sorted.
Note: it's 3:40am here, I haven't been to sleep in almost 24 hours now, I apologies if my code has any errors but if it does just check the EZ-Script manual and correct them
I tried both of your scripts you wrote and I ended up using the movement script because of the ADC value not going above zero, even when the speakers have sound going through them. I tried many combinations last night and ended up just using the movement script(s). It still misses jaw/mouth movement sometimes but it's better then it was before. See Below,,,
If (GetADC(ADC0) > 0)
If (GetADC(ADC0) > 0)
If (GetADC(ADC0) > 0)
If (GetADC(ADC0) > 0)
I know it's very simple for you because you know programming so well. I want to thank you for the guidance and examples you write very fast. Even when getting no sleep in 24 hours. Wow!
I am hoping the new ez v4 board will be better for the jaw/mouth movement. Because it has the built in speaker and digital, I'm not really sure on that. I will see if I can figure out how to send you a video of the mouth moving, I am not sure when that will happen. I was having trouble setting up a Youtube account yesterday and will try later.
Again many thanks for always helping and getting back very fast!
One more thing, I will try and figure out how to use the Auto Position script when I have a little more time.
PS I like your tattoo. Sincerely, Mike
If sometimes the ADC is 0 for a short moment you could always write in some delay and checking to avoid that.
This isn't a complete script but rather an idea and a guide to how you can add in a sleep after the ADC_Wait then check the ADC value and either accept it as quiet or decline it and say "no, keep going, it was just a blip".
Or you could use the ADC value to set the servo position. You would need to do a few calculations but it may work. The louder the sound or the higher the ADC value the more the mouth opens. While it's not an exact simulation of a mouth the effects can be pretty good.
First you would need to work out how many servo positions you have between closed (80) and open (45)
80-45 = 35
Then see how high the ADC value goes with the loudest of sounds. Do this by watching the ADC value (use an ADC control temporarily). Let's say for example it hits 125 at it's loudest.
So we have 35 positions for 125 ADC values. 125/35 = 3.5. At this point I would round that down to 3, which would mean the mouth would vary in position between ADC values of 0 to 105, anything above 105 would be fully open and the positions would be in steps of an ADC change of 3. (Hopefully this is all making sense).
So next we make the script to convert the ADC value to servo position. It's pretty a simple script.
A lot of that code can be combined in to a single line however, to make it easier to follow I did each step bit by bit. Extra lines of code, while unnecessary, sometimes make it easier to follow scripts.
Now we have our servo position, using either code above (I would use the first since it's easier to follow and change for future) we just need to move the servo to the correct position;
Then piece it all together, add in any sleeps to delay certain parts as necessary and you should have something like this;
Now, what should happen is the ADC port will be read and the volume of the audio will be saved to the variable $volume.
The volume is then checked to make sure it isn't over 105, if it is it could move the servo to a position that shouldn't be available. So we check it with an IF and if the conditions are met we over ride the value to the maximum.
Then we take the volume and convert it to the correct position first by dividing it by 3 (as previously calculated), making it a round number (as you can't have decimals in servo positions) and then subtracting it from the closed position.
Then we tell the servo to move to that position.
A slight delay, if required, to stop the mouth going too mad.
The we go back and do it all over again.
I haven't checked the script. I haven't really checked if I worked it all out correctly so check it out on something which doesn't matter if the position goes to the wrong place (or above/below the max/min points) before you use it on the jaw.
I need to step back to the really basics. FYI, The volume voice/jaw sync is working but could work better. I will work on that later.
I have a new question, what is the difference of the Modified servo versus Modified servo movement panel. I have 2 modified motors with gears and a worm shaft that moves. Using the arrow buttons and the stop buttons, I can move it back and forth.
I want to move both motors independently with a script I have tried the Movement script with the servo Movement control panel but it moves both motors. Is the a way to move them independently?
Please be very simple, as my brain does not seem to process this stuff very well. I dp understand most on the logic you have sent, I am just don't know all the commands? Not sure!
Also maybe I should start a new thread?
Do I need to add an Auto Position for ever movement/event. e.g. one for the eyes, one for the head, tilt, nod no, and one for the Jaw?
I'm just wondering if you have upgraded to the most recent ARC?
Deleting a servo has now been fixed in the newest version, I just verified it.
To keep the servo positions you've initially generated you will have to select that pre-made frame and then click new frame, name it, and then select it the new frame on the list of frames. This will keep the servo positions you made in the last frame and allow you to change them as needed for your action.
Just in case you haven't come across it yet, in order to see all the port numbers use the "Port Edit Mode" check box.
For every event you'd like to execute you can either generate an new "Action" or you can execute a script with multiple frames or actions in it.
An alternate way would be to use a script inside an Action, just click on the "edit script" button near the top right of the action screen.
Thanks everyone, as always v/r