2
$\begingroup$

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.ops.object.origin_set(type='ORIGIN_CURSOR')

    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.ops.anim.keyframe_insert_menu(type='Scaling')
    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
$\endgroup$
3
  • 5
    $\begingroup$ I'm voting to close this question as off-topic because it's about Python syntax, not Blender. $\endgroup$ Commented May 21, 2015 at 8:08
  • 1
    $\begingroup$ Looks like it's on-topic meta.blender.stackexchange.com/questions/329/is-this-off-topic $\endgroup$ Commented May 21, 2015 at 18:32
  • $\begingroup$ Borderline but I think this is ok. As long as it isn't pure python, we can accept these. $\endgroup$ Commented May 22, 2015 at 1:27

1 Answer 1

7
$\begingroup$

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))
$\endgroup$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.