I did everything right from the Monstercat Audio Visualization tutorial, but when I say run script, line 27 is said to be a syntax error. Here is the entire script. What am I doing wrong? I checked for commas instead of periods, even retyped it, checked mine against the video. Not sure what else to.

import bpy

for i in range(0,64):

    bpy.ops.mesh.primitive_plane_add(location = ((i + (i*0.5))), 0, 0)
    bpy.context.scene.cursor_location = bpy.context.active_object.location
    bpy.context.scene.cursor_location.y -= 1

    bpy.context.active_object.scale.x = 0.5
    bpy.context.active_object.scale.y = 20
    bpy.ops.object.transform_apply(location=False, rotation=False, scale=True)

    bpy.context.active_object.animation_data.action.fcurves[0].lock = True
    bpy.context.active_object.animation_dada.action.fcurves[2].lock = True

    bpy.context.area.type = 'GRAPH_EDITOR'

    l = i**2 + 20
    h = (i*1)**2 + 20

    print(str(i) + str(l) + str(h))

    bpy.ops.graph.sound_bake(filepath=r'C:\Users\H20\Videos\Youtube\Onyx Leaf\Nightcore\Take Me To Church\Take Me To Church.mp4' , low = (l), high = (h)

    bpy.context.active_object.animation_data.action.fcurves[1].lock = True
  • 5
    $\begingroup$ I'm voting to close this question as off-topic because it's about Python syntax, not Blender. $\endgroup$ – CodeManX May 21 '15 at 8:08
  • 1
    $\begingroup$ Looks like it's on-topic meta.blender.stackexchange.com/questions/329/is-this-off-topic $\endgroup$ – qubodup May 21 '15 at 18:32
  • $\begingroup$ Borderline but I think this is ok. As long as it isn't pure python, we can accept these. $\endgroup$ – iKlsR May 22 '15 at 1:27

Line 25 is missing a closing bracket. Python assumes line 27 is part of the high = (h) parameter to the sound_bake() function.

    bpy.ops.graph.sound_bake(filepath=r'path/to/file' , low = (l), high = (h)

should be:

    bpy.ops.graph.sound_bake(filepath=r'path/to/file' , low = (l), high = (h))
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.