Audio bake to f-curves fails with very high numbers I am working on an audio visualization generated by a script. I am programmatically creating a grid of hexagons that will each have a different range of frequencies baked to it. My question doesn't involve the hexagons, so I removed that part of my script. My method involves baking the sound to a custom property on each object so you can access the value through a driver on different properties (Location, Scale, Color, etc).

I can run the script safely creating only 2 objects. The custom properties and drivers are created, and the cubes react accordingly. But if I set my number_of_cubes variable to more than 2, the values generated from bpy.ops.graph.sound_bake() get really weird.

On the first 5 frames of my animation using only 3 objects, here are the values



And here is the graph editor for those frames. (Notice the vertical scale)



So I can safely assume that the baking is generating values too high for Blender to handle (-1.#IND being not a number). Because of the crazy baked values, the drivers fail and Blender crashes if you try to play the animation or change the frame. So in the script I commented out the lines

#add_driver_prop(obj, 'location', 2, '["audio_data"]', "data * " + str(multiplier))
#add_driver_prop(obj, 'scale', 2, '["audio_data"]', "data * " + str(multiplier))


so the drivers are not added. So why can't Blender handle baking to fcurves more than twice in the script? I watched the CGCookie tutorial on audio baking a few years ago, and referenced it again recently, but I can't see any difference in their methods that would make mine faulty.

I have already ruled out:


Hardware. I tried this at home and at school on different machines
Drivers. I disabled them and the fcurves are still going crazy. But at least Blender doesn't crash anymore.
Weird values for the low and high frequencies. If you divide by 3 (number of cubes), the low and high frequencies become 0.0 and 33333.33333333333336 for the first cube. Dividing by 4 creates nice even numbers, but the problem persists.


Here is my script. Make sure the .blend file is saved and the audio path is relative to the .blend, or it won't work.

Here is the audio I am using. I have tried it with other songs, but it doesn't work with those either.



I have also attempted to enter the high frequency manually (I left the low at 0.0). Here are the values that did not work:


33333.3, 30000.0, 40000.0, 


These values did work:


45000.0, 100.0, 300.0, 12345.0
If your sound bake is showing that behaviour try reducing your baking frequency High and Low to within the audible frequency range.

20 to 20,000 Hz

The SI unit of audio frequency is the hertz (Hz). It is the property of sound that most determines pitch. The generally accepted standard range of audible frequencies is 20 to 20,000 Hz, although the range of frequencies individuals hear is greatly influenced by environmental factors.

Audio frequency - Wikipedia, the free encyclopedia
https://en.wikipedia.org/wiki/Audio_frequency

Which is likely why the bakes returned rubbish on some audio formats.
The sound drivers addon bakes n frequencies over a channel range.  I've also put in the ability to bake on music note frequencies.  Here is a screenshot of rainbow_road.mp3 baked to the 88 notes of the keys on a piano.

Baked as custom properties on the speaker (data part) object.  Fcurve modifiers are used to map the range of the fcurve. A simple driver can be added to any object, and if using channel 0, in the case of image AH0 is used as a driver on the cone, a simple grid visualiser can be created.