So I was watching a tutorial and following along with how to make this audio visualizer: http://cgcookie.com/archive/building-an-audio-visualizer-in-python/
This is what the portion of the script in the video that I am having problems with looks like. It's on line 32:
This is my entire script so far (Up to the point in the video shown in the picture):
import bpy rows = 5 columns = 5 r = 0 c = 0 for i in range(0, rows*columns): if c == columns: r += 1 c = 0 bpy.ops.mesh.primitive_cube_add(location =(r*2, c*2, 0)) bpy.context.scene.cursor_location = bpy.context.active_object.location bpy.context.scene.cursor_location.z -= 1 bpy.ops.object.origin_set(type='ORIGIN_CURSOR') #### bpy.context.active_object.scale.x = 0.5 bpy.context.active_object.scale.y = 0.5 bpy.context.active_object.scale.z = 5 bpy.ops.object.transform_apply(scale=True) bpy.ops.anim.keyframe_insert_menu(type ='Scaling') bpy.context.active_object.animation_data.action.fcurves,lock = true bpy.context.active_object.animation_data.action.fcurves,lock = true bpy.context.area.type = 'GRAPH_EDITOR' step = 20000/ (rows*columns) bpy.ops.graph.sound_bake(filepath="/Users/USER/Desktop/14 Federation.m4a", low=i*step, high=i*step + step) bpy.context.active_object.animation_data.action.fcurves,lock = true c += 1
I can see that in the video the part with
step = 20000 and the part with
bpy.ops.graph.sound_bake(...) are on the same line, but when I do that, it gives me syntax errors.
As of now, this script tells me that it has failed and then tells me to look in the python console. In addition, it only creates one of the cubes that the script is supposed to make a 5x5 grid of. It also unlocks all of the scale parameters and changes nothing for the graph editor for the one cube that it creates.
Strangely enough, removing the entire portion starting with
bpy.context.area.type = 'GRAPH_EDITOR' to
bpy.context.active_object.animation_data... causes the full grid of 25 cubes to appear.