|
Tutorials at Lizard Lounge Graphics : Maya - Audio Data into Maya
Updated on 14th July, 2010.
A while back I was working on a project where we wanted to have objects in Maya "driven" by music. It turns out that the included audiowave plugin has not really worked since version 4.x of Maya. This is a bummer, but not to be detered I came up with a recipe to manually export information from AfterEffects using Trapcode's SoundKeys. This is a great to way to work as it allows you to export up to 3 data tracks in one pass from your audio file. Here's the recipe.
The recipe: (as tested under Windows and Mac up to Maya 2008, but should work in later versions)
- Set up an AE project with a soundkeys effect track, tweak and apply.
- Expand the track so you can select and copy the range of keyframes from
the timeline in AE.
- Open a text document and paste in the AE data.
What comes out of AE:
Adobe After Effects 6.0 Keyframe Data
Units Per Second 30
Source Width 640
Source Height 480
Source Pixel Aspect Ratio 1
Comp Pixel Aspect Ratio 1
Effects Sound Keys #1 Output 1 #22
Frame
0 0.17489
1 0.261281
2 0.361762
3 0.400085
4 0.411538
5 0.434799
6 0.41712
7 0.422151
8 0.43181
9 0.411811
|
- Delete all the lines above the actual frame numbers and values. Make certain there are no blank lines at the top of the document as Maya will error on reading blank lines. Run a find and replace (requires a decent text editor that can spot tab characters - I use Crimson Editor) with a simple expression the unwanted data with nothing to strip it away. You may need to run this several times. I've also noticed that AE will copy zero values (0) as an integer (whole number) and Maya will be expecting a float or decimal number. You will need to make certain to convert all lines with only a zero (0) to read "0.0".
A quick note on Regular Expressions. If you've never used these before and are new to scripting then you should take a moment to familiarise yourself with these very handy ways of finding something in a text file. You'll need to make certain that your find and replace tools are set to work with regular expressions, otherwise the code samples below won't work.
A regular expression that starts with a caret symbol "^" (shift-6 on English keyboards) sets the regular expression to look for something at the start of a line. A regular expression which ends with a "$" will look for something at the end of a line.
"^foo" will look for "foo" at the start of a line and "foo$" will look for "foo" at the end of a line. This is a very useful feature of regular expressions.
Another important thing is that often times regular expressions are indicated by having the search string enclosed in parentheses. Crimson is a funny beast in that it does not need these added, so if you are using some other program on a Mac like Smultron you will need to add in the parentheses.
Examples of simple text expressions:
^\t[0-9]\t
Locates (in Crimson) at the start of a line: two tabs with the decimals 0-9
between them.
(^\t[0-9]\t)
Same as above, but in other regular expression searches.
|
^\t[0-9][0-9]\t
Locates (in Crimson) at the start of a line: two tabs with the decimals
10-99 between them.
(^\t[0-9][0-9]\t)
Same as above, but in other regular expression searches.
|
^\t[0-9][0-9][0-9]\t
Locates (in Crimson) at the start of a line: two tabs with the decimals
100-999 between them.
(^\t[0-9][0-9][0-9]\t)
Same as above, but in other regular expression searches. |
^0$
Locates any zero only lines which will cause Maya to fail when the file
is read.
(^0$)
Same as above, but in other regular expression searches.
Replace with:
0.00000
Does not need to have more than one zero - I think it looks better this way. |
This is what you want when you are done:
0.17489
0.261281
0.361762
0.400085
0.411538
0.434799
0.41712
0.422151
0.43181
0.411811
|
- The resulting file can then be saved and imported easily into Maya as a Move file (*.mov).

(click to enlarge)
- Go wild from there.
|