Lipsync Importer & Blinker - 02/03 armature support

nice script - but… I believe FlashAmp is a much faster way. Perhaps you can do a script working with FlashAmp?

FlashAmp is a stand-alone application that produces arrays of audio data specifically for use with Macromedia Flash. With some simple Actionscript you can use FlashAmp data to synchronize animations (or anything else) with sound.
It is no longer supported
http://www.marmalademedia.com.au/
but you can find it:

@freeblender: FlashAmp is a shareware app, papagayo and jlipsync are open source that’s why they been chosen, although jlipsync is not yet supported in my script but i’m working on it. but i welcome your suggestions :slight_smile:

FlashAmp has left the market
http://www.marmalademedia.com.au/

It is so fast - compared to papagayo and jlipsync -they give you seconds of lipsyc - FlashAmp minutes.
So have a try with FlashAmp.

FlashAmp has left the market

but has it announced opensource or free at least :slight_smile:
i’ll try it anyway

I believe it is just to animate the numbers - 1,2,3,4,5,6 - from FlashAmp to different mouths.
Just script it - I want to see some minutes of an animation done with a FlashAmp-script!
:spin:

Some tips on lipsync:

There are a few files that make up this collection.
The Characters:
Blender Park Characters
Some Objects (Cars, Bus, Trees):
Blender Park Objects
Some Scenery (Bus Stop, Town, Room).:
Blender Park Scenery
Blender Park Lipsync Tools:
Blender Park Lipsync
Blender Park Tutorial
Blender Park Tutorial

Yousef, do you know where I can find the latest version of the script? with blinker? I have searched, but cannot find it. Thanks for this great script.

i’m fixing it now with the new api changes, a day or two and it will be ok :slight_smile:

Oh that’s good to hear. Thx.

I have been testing the script, literally for 72 hours non-stop. :stuck_out_tongue: very tired now. :slight_smile:

The script works great when the actor is speaking quickly, but if they are speaking slowly, like a song or a presidential speech, it closes the mouth, too quickly. Adjusting the ease in/out to extremes (like 10-12 frames) fixes this, but it causes other problems, and does not look good.

I think we need a Holding Keyframe, set right before the next keyframe in the list. That way it can go back and ensure the mouth stays open to finish saying the word. (This is so important for singing, or yelling). When the actor is talking fast, this would not be helpful, it looks worse. But on slow or medium speed speech it works much better.

I am no python expert, really just a hacker, but I have mocked up a version of the script with the changes I thought were useful. It is not an elegant implementation, but I am a novice and I did not easily understand your functions and arguments so I had to create my own, and take some shortcuts to get it to work. It is tested with 2.56 r34076.

The next feature I want to implement, or suggest for you to implement, is a way to turn off the easing, and have the keyframe be held exactly like it is held in papagayo. Extremely fast speech, or cartoon characters, or stop motion would benefit from this method tremendously, plus we need more options! Holding, Easing, On, off, whatever we can do for the animator. The last suggestion I have at the moment is allowing to define a high point when holding. Like key is 0 then .40 at start, .80 at high point, and .40 then 0. Such a script would need to look at the two keyframes in the list, then create average values based on their distance.

Attachments

papagayo-py.blend (461 KB)

The next feature I want to implement, or suggest for you to implement, is a way to turn off the easing, and have the keyframe be held exactly like it is held in papagayo. Extremely fast speech, or cartoon characters, or stop motion would benefit from this method tremendously, plus we need more options! Holding, Easing, On, off, whatever we can do for the animator. The last suggestion I have at the moment is allowing to define a high point when holding. Like key is 0 then .40 at start, .80 at high point, and .40 then 0. Such a script would need to look at the two keyframes in the list, then create average values based on their distance.
easy suggestions, i will implement in the updated ver. :), and thanks man (you’re pushing me to do it) :slight_smile:

@3dementia: your script wont work with me !!!, i didn’t see your new options :frowning:

i updated the 1st thread check it out

what was your new options you added??
i could update the script with them :slight_smile:

The script (my version) is buggy. You must select the mesh then run script for it to work. And the last shape key does not get closed, you have to do it manually. I just intended it to show the functionality.

#*****************************Mike-White 2-25-11**********************************
# reading imported file & creating keys
def spltr():
    
    f=open(scn.fpath) # importing file
    f.readline() # reading the 1st line that we don"t need
    prev_line=""
    for line in f:
        
        # removing new lines
        lsta = re.split("
+", line)
        
        # building a list of frames & shapes indexes
        lst = re.split(":? ", lsta[0])
        frm = int(lst[0])
        
        ThisFrame = str(frm)
        LastPhnm = prev_line
        print (' ')
        print (' ')
        print (' ')
        print ('The current frame is: ' + ThisFrame)
        print
        # creating keys and setting the previous line argument for the crtkey function
        if lst[1]=="AI" and AI=="on": 
            crtkey(AIphnm, frm, LastPhnm)
            prev_line=('AI')
        elif lst[1]=="O" and O=="on":
            crtkey(Ophnm, frm, LastPhnm)
            prev_line=('O')
        elif lst[1]=="E" and E=="on": 
            crtkey(Ephnm, frm, LastPhnm)
            prev_line=('E')
        elif lst[1]=="U" and U=="on":
            crtkey(Uphnm, frm, LastPhnm)
            prev_line=('U')
        elif lst[1]=="etc" and etc=="on":
            crtkey(etcphnm, frm, LastPhnm)
            prev_line=('etc')
        elif lst[1]=="L" and L=="on":
            crtkey(Lphnm, frm, LastPhnm)
            prev_line=('L')
        elif lst[1]=="WQ" and WQ=="on":
            crtkey(WQphnm, frm, LastPhnm)
            prev_line=('WQ')
        elif lst[1]=="MBP" and MBP=="on":
            crtkey(MBPphnm, frm, LastPhnm)
            prev_line=('MBP')
        elif lst[1]=="FV" and FV=="on":
            crtkey(FVphnm, frm, LastPhnm)
            prev_line=('FV')
        elif lst[1]=="rest" and rest=="on":
            crtkey(restphnm, frm, LastPhnm)
            prev_line=('rest')
# creating keys with offset, and ease in
def crtkey(phoneme, Skey, LastPhoneme):
    
    objSK=obj.data.shape_keys
    obj.active_shape_key_index=phoneme
    
    offst=scn['offset']        # offset value
    skVlu=scn['skscale']       # shape key value
    frmIn=scn['easeIn']        # ease in value
    frmOut=scn['easeOut']      # ease out value
    
# Inserting Ease in Keyframe for Current Shape
    obj.active_shape_key.value=0.0
    objSK.keys[phoneme].keyframe_insert("value",
        -1, offst+Skey-frmIn, "Lipsync")
# Inserting Main Keyframe for Current Shape
    obj.active_shape_key.value=skVlu
    objSK.keys[phoneme].keyframe_insert("value", 
        -1, offst+Skey, "Lipsync")
    #Outputting feedback to the Console 
    somevar=('Added Keys to: ' + obj.active_shape_key.name)
    print (somevar)
    print ('Drumroll Please...... The......Last....Key....Was: ' + LastPhoneme)    
            
#Check if Hold Keys is Activated and if so plot keys without holds
    HoldKeys=scn['holdKeys'] 
    if HoldKeys==1:
        print ('Key was held')
    if HoldKeys==0:
        obj.active_shape_key.value=0.0
        objSK.keys[phoneme].keyframe_insert("value", 
        -1, offst+Skey+frmOut, "Lipsync")    
    else:
# Inserting Ease out Keyframe for just First Shape Key
        if LastPhoneme == '':
            obj.active_shape_key.value=0.0
            objSK.keys[phoneme].keyframe_insert("value", 
        -1, offst+Skey+frmOut, "Lipsync")
    
    
        if LastPhoneme=="AI" and AI=="on": 
            lastkey(AIphnm, Skey)
        elif LastPhoneme=="O" and O=="on":
            lastkey(Ophnm, Skey)
        elif LastPhoneme=="E" and E=="on": 
            lastkey(Ephnm, Skey)
        elif LastPhoneme=="U" and U=="on":
            lastkey(Uphnm, Skey)
        elif LastPhoneme=="etc" and etc=="on":
            lastkey(etcphnm, Skey)
        elif LastPhoneme=="L" and L=="on":
            lastkey(Lphnm, Skey)
        elif LastPhoneme=="WQ" and WQ=="on":
            lastkey(WQphnm, Skey)
        elif LastPhoneme=="MBP" and MBP=="on":
            lastkey(MBPphnm, Skey)
        elif LastPhoneme=="FV" and FV=="on":
            lastkey(FVphnm, Skey)
        elif LastPhoneme=="rest" and rest=="on":
            lastkey(restphnm, Skey)
# creating Holdkeys with offset, and ease out
def lastkey(HoldPhoneme, LastKey):
    
    objSK=obj.data.shape_keys
    obj.active_shape_key_index=HoldPhoneme
    
    offst=scn['offset']        # offset value
    skVlu=scn['skscale']       # shape key value
    frmIn=scn['easeIn']        # ease in value
    frmOut=scn['easeOut']      # ease out value    
# Inserting Hold Keyframe for Last Shape
    obj.active_shape_key.value=skVlu
    objSK.keys[HoldPhoneme].keyframe_insert("value", 
        -1, offst+LastKey-frmIn, "Lipsync")

# Inserting Ease out Keyframe for Last Shape
    obj.active_shape_key.value=0.0
    objSK.keys[HoldPhoneme].keyframe_insert("value", 
        -1, offst+LastKey, "Lipsync")
        

#*****************************Mike-White 2-25-11**********************************

As you can see, the code just makes use of the prev_line to check what the previous key was, while running through the for loop and the list.

I just tried this script for the first time today and I am getting this error

Traceback (most recent call last):
File “C:\Users\Brendan\DOWNLO~1\RELEAS~1\2.56\scripts\addons_contrib\io_import_lipSync_Importer.py”, line 186, in execute
if scn.fpath!=’’: mapper()
File “C:\Users\Brendan\DOWNLO~1\RELEAS~1\2.56\scripts\addons_contrib\io_import_lipSync_Importer.py”, line 95, in mapper
splitter()
File “C:\Users\Brendan\DOWNLO~1\RELEAS~1\2.56\scripts\addons_contrib\io_import_lipSync_Importer.py”, line 113, in splitter
frm = int(lst[0])
ValueError: invalid literal for int() with base 10: ‘mayFive.wav’

location:<unknown location>:-1

I’m using Blender 35433 build - the one that comes with all the plugins. My system is win32 vista…

Ah my bad - I was trying to import the pgo file :S

I didn’t read the directions clearly enough and didn’t realize you can export a voice file…

I didn’t read the directions clearly enough and didn’t realize you can export a voice file…
so did it work or not? :slight_smile:
i will try to add error handling messages this time, it may help.

Yes it did! Worked beautifully! My first test was done with VERY quickly done mouth shapes - but I’m going to do it again with more detailed shapes… thanks for your awesome script. This is a MASSIVE time saver for me.

It works perfectly… Now i juz need to make my own dictionary in papagayo for my native language…

| Back to logs list Reprinted from 395470270 at 18:38 on September 7, 2010 Reading (loading. …) Comments (0) Category: Game of Life tag funny published cancel | Back to logs list

Odd. This is not working with the last official beta of blender? Are you using a graphicall rebuild?

Script is not even being detected by Blender.

This is not working with the last official beta of blender?

surely it wont work as there is a registering mods in the trunk, the official beta are outdated you need a graphicall build from 35129 and upwards :slight_smile: