Bug in IPO module?

Hi all,

I’m working on an animation of a curved piano keyboard, and I’ve been trying to write a python script to generate the IPO curves for the keystrokes, but with no success so far. The problem is the following: because the keyboard is curved, I have to rotate the keys using their local axes (which follow the keyboard curvature). Doing this from the GUI, key by key, works fine, but it would be much easier with a script, given the large number of keys (and music synchronization issues). The thing is that when I create the IPO curves procedurally, the local axes of the keys get automatically aligned to the global axes, which completely screws up the animation. Is this a bug (my impression is that it is, since the GUI works ok), or am I just doing something wrong?

Thanks!
Andres

I don’t think this is a bug.

I guess that you have some model piano key
with a fixed “local” axes = “global” axes
for which you edit the ipo then you link
the ipo to one of the other keys on the keyboard

right?

The ipo just overwrites the rotation matrix of the object
you want it to be composed with a matrix that carries
the new “local” axis rotation.

Here is a solution (without scripts)

1/ create an empty for each piano key.

2/ rotate/translate
the empty so that its axis is the desired
“local” axis of the key.

You can do this using the copy menu ctrl C

3/ parent the key to the empty.

When you link the ipos Blender now multiplies
2 matrices - the “local” transformation matrix of the empty
and the “global” matrix from the ipo.

… and here’s another solution

Otherwise you could write a script that
does the matrix calculation above
(using the Mathutils module) but
I hate thinking about algebra before breakfast.

But that’s more complicated

…you can of course do the parenting of the empties automatically

http://www.picard.ups-tlse.fr/~mcshane/exampe.gz

and run the script once

all the keys are linked to a single “global” ipo
but each key has its own empty to give the “local”
transformation.

BTW I had benn thinking about making a curved keyboard
so I knew the answer to this.

You don’t have a script that can convert musical partitions
into keyboard IPO’s which is beyond me ?

http://www.picard.ups-tlse.fr/~mcshane/example.gz

Thanks a lot for your answers!

> You don’t have a script that can convert musical partitions
> into keyboard IPO’s which is beyond me ?

I wish I do! Right now I’m doing the sync manually (it is a pain in the neck, of course). I’d like to work on a more complex script to convert partitions into IPOs directly, but right now is beyond me as well.

I’ll upload the animation and the blend file to my webpage once I finish with this project.

You want to sync the animation with what?

1/ pre recorded music

2/ a friend playing a keyboard

If 2 then you could try and capture (keylog)
the MIDI keyboard data (keypress + time)
and use that to generate the curve data.

This isn’t quite what you need but it’s close…

http://linuxaudioblog.jawebada.de/software/alsa/midi-routing-with-python-and-alsa.html

The idea was to use 2), but ended up doing 1) (with no much success). In any case, here you can grab the python scripts and blend files I used in my project:

http://protlib.uchicago.edu/blender.html

For future work, the link you mentioned seems very interesting indeed.