Import the movement of a .wav file to a animation - Engine

Hi,

Maybe this can help some peoples that needs to deal with speeches, stories, etc…
This script takes a .wav file and transforms it in movement into Blender (key frames)

Example,
*You have 5 minutes of audio to make a animation “talk”. If you have the audio file (just with voice), you can get a very good sync to the mouth (using bones).

*Make balls jumping with the sound

*Make a hand move and fake a piano player (using the sound of a piano)

I’ve used it some times and got a very funny result. The interface with Blender is just released, and its here.

Get Started Manual :spin:
Run the script into Blender (maybe you will see a error but, go on. I’m working on it)
Select a object. You can use the default cube :smiley: (Mesh, Bone or Camera NOT lattice)
See in the Object section: “import Movement From Wav File”
Mark (for example) just Location L.Z
Click the button “Import Wav”
Choose a file .wav
(it woks a lot better with just one voice or one instrument at a time. The script takes the sound of the file but, it cannot separate for example voice and guitar)
**** See the terminal window about the execution ****

Warning: Use a file with with some seconds to see the performance. It can take several minutes to process and import a large file. I’ve processed a 80MB file (7 minutes of audio) into a MESH in 3 minutes but, the same file in a bone to deform a mesh took 15 minutes (in a old Pentiun 4 :o). The major time is spend in import the values to Blender.

Advanced Manual (not so much):confused:
Audio Sensitivity:
See in the terminal window the value of samples. If you got just too low values (valued goes from 0 to 255), change the Sensibility from 1 to something up to 6.

Apply the movement:

If you want to to scale your object, mark S.X and/or S.Y and/or S.Z
If you want to to rotate your object, mark R.X and/or R.Y and/or R.Z
If you want to to move your object, mark L.X and/or L.Y and/or L.Z
You can mark some, and see a very funny mess

Scale:
If you want to increase or decrease the values that you get, use the Scale Factor.
Scale 1, gets 0 ~255
Scale 100, gets 0~2.55
To a mouth bone, maybe you will use a Scale of 2000

Frames /s
Its better to use the same setting of your scene to start.


There is a lot of work to do with it but, its working well in 2.53.1 svn r31541
If you find a bug let me know (i’m sure that there is some bugs :yes:)

Please, be patient about bugs. That’s my first Blender Script, my first Python script and i know Blender for just 4 months BUT, please, let me know if you find one!

Its a alpha release, there is some TODOs

Have fun :smiley:

Wow! I’ve been looking for something like this for a while now after seeing a tutorial on animating particles from a sound file. I tried recreating the the same effect in Blender but figured I would need scripting and I can’t script, and now you present me with a wonderful gift. Thanks much appreciated. I should start playing with it asap.

Thank you
Please, tell me if you get any problem or suggestion about it

I cannot seem to find the “Import Wav” button and Blender terminal complains about an unknown operator “Botao_GO”.

Where is the import wav button? D:

it appears to me :slight_smile:

Please, check if you are using at least Blender 2.53.1 svn r31541 (Blender splash screen)
Since the Python API is changing, this is the third time that i need to change something in 3 weeks.
Also, i uploaded again to the site (maybe a upload error?)

You can view screenshots here

Please, try again and tell me if its working

thank you
Sorry for the inconvenience

You can get a fresh new version of Blender at http://www.graphicall.org/builds/
or you can update by svn
(always keep a copy of your actual version, new versions can have new problems :slight_smile: )

I’d just tested the script at the last version r31584 and worked fine too

can’t you just use the “bake sound to fcurve” function?

Good question. (Obviously i don’t know this function :slight_smile: )
I will search and try the function

thank you

Seems to be different, but with the same idea.

One good difference to me: my script creates curves to sync to the audio and you can freely edit the curves after import (its not a Bake). It give to you also a reference to were to work and adjust everything.
Example, i want move a mouth and make fine adjusts manually

But please, i need help here to understand it all, and tell me if i’m wrong.
I’m having difficulties to find documentation. If possible, tell me where to find more documentation about it

thank you

hi, your script is very cool, keep up the great work.
i would like to add it to our svn collection,
letr me know via pm so i can give you some instructions/discuss
you can read the workflow here:
http://wiki.blender.org/index.php/Dev:Py/Sharing

Wow!
Thanks much appreciated.

It did not work for me.

I get a subclass already registered error and then it crashes.

Yes, this is the error that i mentioned but, the script don’t stop.
Please, select a object and look for the new options at the end of object options.
It should be there.

I’m still learning about Blender and Python but the script is working well

Please, tell me it it worked :slight_smile:

thank you
Sorry for the inconvenience

version Alpha 0.0.2 uploaded
Minor changes and the initial error gone

here

thanks for your patience

I tried with r31596 and it loaded ok. But when I load the wav file nothing happens.

I can include a screen shot. Any ideas? I took out the comments to print out the file name and directory just out of curiosity. Not a clue what is going on, but I would like to learn more about it.

http://www.bugsticks.com/BlenderPics/berror.JPG

Thanks for the cool script. Lots of possibilities with this…:slight_smile:

this looks good, i havent tried it yet, is it the same as soundtracker by technoestupido?
http://blenderartists.org/forum/showthread.php?t=113227

TRock, thank you
That is very strange.

Inside the function “getInputFilename” has a
print (" Selected file = ",filename)
And as you can see, the program don’t go there.

Works well on Linux, maybe the problem is when using Windows

I tried to open a file with spaces in name and it is OK

Could you please change this line:
getInputFilename(self.properties.directory + self.properties.filename, context)
to
getInputFilename(“c:\music est beat.wav”, context)
(just put the file .wav that you want)

and tell me if it work?

I’m thinking about the back slash, but i don’t have MS Windows to test right now.

thank you again

Hi, Wysiwyg

I don’t know the script “soundtracker” but i will take a look and see if i get some new idea.
Seems to be the same idea.

Thank you

TRock, i found some informations about backslashes in Python.

Tomorrow i will test this code:
def execute(self, context):
import os
f= os.path.join(self.properties.directory, self.properties.filename)
f= os.path.normpath(f)
getInputFilename(f, context)
return {‘FINISHED’}

Maybe it will solve the problem

Thank you again