I am trying to play with this Audio Viz from blendercookie, but I am having problems with the code, which is as follows…
import bpy
rows = 5
columns = 5
r = 0
c = 0
def spiral(X, Y):
x = y = 0
dx = 0
dy = -1
for i in range(max(X, Y)**2):
if (-X/2 < x <= X/2) and (-Y/2 < y <= Y/2):
bpy.ops.mesh.primitive_cube_add(location=(x, y, 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[0].lock = True
bpy.context.active_object.animation_data.action.fcurves[1].lock = True
bpy.context.area.type = 'GRAPH_EDITOR'
step = 20000/ (rows*columns)
bpy.ops.sound_bake(filepath=r"C:/Users/James/Desktop/Angular Momentum.mp3", low=i*step, high=i*step + step)
bpy.context.active_object.animation_data.action.fcurves[2].lock = True
if x == y or (x < 0 and x == -y) or (x > 0 and x == 1-y):
dx, dy = -dy, dx
x, y = x+dx, y+dy
spiral(rows, columns)
I keep getting an error that states:
Traceback…line 45 in <module> and line 34 in spiral…TypeError ‘BPyOpsSubMod’ object is not callable
OK, I am new to python and have no clue what this is. I have played with the indents and spelling and other, but for the life of me cannot get it to work.
Line 34 is where the sound file is identified
Line 45 is the last line.
Can someone help? Please? Thank you