Script for lip sync I'm working on

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

User avatar
strider2000
Posts: 506
Joined: Sat Mar 07, 2015 5:14 pm
Contact:

Re: Script for lip sync I'm working on

Post by strider2000 »

I just confirmed that the / works on Windows. I was wondering about that when I wrote the script, but don't have ASP running on a Mac so I couldn't test. Sorry about that. :oops:

I've made the change on mine, I've also created a little button so you can make it a tool. I haven't posted the change, because there are a couple of other things I'd like to add first.
- Animator's Survival Kit suggests 2 frames for consonants
- May want to support extreme open for emphasis on vowels (similar to long)
- Would like to improve selection of frames, maybe start where timeline marker is

Does anyone know now to capture the start an end frame for a timeline selection? I see that you can select in the timeline. I know that's for selecting keys, but if I could capture start and end frame I'm thinking I could make it a tool, then bring up the dialog after mouse up. Don't know how to do that yet, but thinking about it.
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Script for lip sync I'm working on

Post by synthsin75 »

Once upon a time I wrote a bit of code to get a timeline range from dragging in the workspace...syncing SetCurFrame with mouse move (I think). I'm not sure if I can find what script (or test script) I wrote that in though.
User avatar
strider2000
Posts: 506
Joined: Sat Mar 07, 2015 5:14 pm
Contact:

Re: Script for lip sync I'm working on

Post by strider2000 »

I've seen the bone time machine and will probably use that as an example if I can't find out how to capture events in the timeline. I expect it does something similar to what you're suggesting.
lehtiniemi
Posts: 107
Joined: Mon Jan 14, 2013 3:18 pm

Re: Script for lip sync I'm working on

Post by lehtiniemi »

Sounds amazing, really looking forward. And don't forget the donate button for your great work. I really value this tool!

Yea, the biggest issue I'm experiencing currently is the amount of time required to enter frames. If start frame would be captured and cursor would focus in the end frame box and even select the contents (for quick erasing), this would make it much faster. Tool-ability sounds great as well!!! And if you manage to do a draggable selection on the timeline with the tool, this would be even more amazing!!!

Such great work over there!!! Thank you so much for this.
User avatar
strider2000
Posts: 506
Joined: Sat Mar 07, 2015 5:14 pm
Contact:

Re: Script for lip sync I'm working on

Post by strider2000 »

I've been pretty swamped lately, but I have the start frame capturing the timeline marker. Does anyone know how to set the focus in an ASP dialog? I know how to do it in dojo, but not ASP :oops: I'll also try the time machine approach when I get a chance.
lehtiniemi
Posts: 107
Joined: Mon Jan 14, 2013 3:18 pm

Re: Script for lip sync I'm working on

Post by lehtiniemi »

strider2000 wrote:I've been pretty swamped lately, but I have the start frame capturing the timeline marker. Does anyone know how to set the focus in an ASP dialog? I know how to do it in dojo, but not ASP :oops: I'll also try the time machine approach when I get a chance.
I can imagine the time machine approach with dragging on the timeline would be incredibly fast to work with - if you would just activate the tool, drag from start to end keyframe and then get the dialog with prefilled start and end frames and the text phrase in focus, this would be an incredible thing for lipsync workflow!!!
User avatar
strider2000
Posts: 506
Joined: Sat Mar 07, 2015 5:14 pm
Contact:

Re: Script for lip sync I'm working on

Post by strider2000 »

lehtiniemi wrote: if you would just activate the tool, drag from start to end keyframe and then get the dialog with prefilled start and end frames and the text phrase in focus
Well, I still don't know how to set focus, but ... I have the drag the cursor to set the start and end frames working!!! Much better now! You set the start frame by just setting the timeline marker _in the timeline_ then you set the end frame by dragging _in the workspace_ until you get to the end frame. That will bring up the dialog.

Here's a quick video explaining the update.


You can get the new script here.
http://www.mediafire.com/download/jbb67 ... pSync2.zip

Enjoy!
lehtiniemi
Posts: 107
Joined: Mon Jan 14, 2013 3:18 pm

Re: Script for lip sync I'm working on

Post by lehtiniemi »

WHOAAAA!!! THIS IS AMAZING!!!

You don't know how much this helps me in my current project. Ok well you prorbably do because you wrote it. :D Thank you soooo much!!!

Oh and remember the donate-thingie....!!! This is the coolest thing I've ever seen. Soooo fast. The refresh-thing is a minor issue and at least it doesn't disturb any essential workflow thingies.
User avatar
strider2000
Posts: 506
Joined: Sat Mar 07, 2015 5:14 pm
Contact:

Re: Script for lip sync I'm working on

Post by strider2000 »

Glad it helps :)
lehtiniemi wrote:Oh and remember the donate-thingie....!!!
I don't have a website and paypal seems to imply that the donate button is only for charitable fund raising, so I created a paypalme link. (I didn't include it here, because I didn't want to imply that I'm taking advantage of this site, so I just sent the link to you via message.) I'm not a paypal expert, so just learning about a lot of that stuff.

I'll continue to improve the script as I learn more about the ASP API and animation. (Next will probably be a control for consonant length. It's just 1 right now, but Richard Williams suggests 2.)
lehtiniemi
Posts: 107
Joined: Mon Jan 14, 2013 3:18 pm

Re: Script for lip sync I'm working on

Post by lehtiniemi »

strider2000 wrote:Glad it helps :)
lehtiniemi wrote:Oh and remember the donate-thingie....!!!
I don't have a website and paypal seems to imply that the donate button is only for charitable fund raising, so I created a paypalme link. (I didn't include it here, because I didn't want to imply that I'm taking advantage of this site, so I just sent the link to you via message.) I'm not a paypal expert, so just learning about a lot of that stuff.

I'll continue to improve the script as I learn more about the ASP API and animation. (Next will probably be a control for consonant length. It's just 1 right now, but Richard Williams suggests 2.)
Thanks! I'll get back to that after my next paycheck. :)
lehtiniemi
Posts: 107
Joined: Mon Jan 14, 2013 3:18 pm

Re: Script for lip sync I'm working on

Post by lehtiniemi »

strider2000,

I got this one idea for future if you keep on improving the script.

Sometimes there are characters that speak really slowly or they have longer vowels in the words which need require adding additional keyframes so it doesn't look like the mouth "stops" inbetween.

Would it be technically possible that the script could automatically alternate layers for long vowels. In practise this would mean the following:
-I would first add switch layers AI, AI 2, AI 3 or something
-When applying the script, it would detect if the vowel is longer than 3 frames for example
-In this case the script would look for AI 2 and switch to this.
-If the vowel still keeps on going on after 3 more frames, it would switch to AI 3 etc.
-In addition, if the user would add a number after a letter (like W1), this would mean the alternation rate would be every frame. W2 would make the alternate switch get changed every other frame. W3 every third (default in my example). But this rate-feature is pure extra and not compulsory at all.

This is a feature that I often find doing manually, in my current project one of the characters speaks really slowly so I keep having to add additional frames to long vowels all the time. I don't know if my example is the best way for it to work but this kind of feature would rock!
lehtiniemi
Posts: 107
Joined: Mon Jan 14, 2013 3:18 pm

Re: Script for lip sync I'm working on

Post by lehtiniemi »

Maybe this helps with updating the keyframes on the timeline?

viewtopic.php?f=12&t=28594
User avatar
strider2000
Posts: 506
Joined: Sat Mar 07, 2015 5:14 pm
Contact:

Re: Script for lip sync I'm working on

Post by strider2000 »

I tried that, but it didn't work. However, it's possible that I did something wrong. I'll check it again when I have a chance.
lehtiniemi
Posts: 107
Joined: Mon Jan 14, 2013 3:18 pm

Re: Script for lip sync I'm working on

Post by lehtiniemi »

If you add this after moho.layer:UpdateCurFrame(true):
moho:UpdateUI()

then the newly added keyframes seem to get redrawn and it works perfectly!
User avatar
strider2000
Posts: 506
Joined: Sat Mar 07, 2015 5:14 pm
Contact:

Re: Script for lip sync I'm working on

Post by strider2000 »

Cool. Thanks :)
Post Reply