Animating a Bezier Curve to Music I'm trying to animate a bezier curve to music to create an visual equaliser type effect. I am not an experienced blender user, but I have some experience with python.

So far I have managed to put the below together which creates a curve with 64 segments, what I would like to be able to now do is to bake an fcurve for each of the segments based upon a frequency range for each. As I see it I need to create the fcurve for each of the sections and apply it to the y of the relevant bezier point. I have no idea how to do this and I can't find much in the way of information. Is it possible?

import bpy

# Create a curve with 64 divisions.
bpy.ops.curve.primitive_bezier_curve_add(enter_editmode=True)
bpy.ops.curve.subdivide(number_cuts=64)

# Cache a reference to the curve.
curve = bpy.context.active_object

obj_data = bpy.context.active_object.data

# Which parts of the curve to extrude ['HALF', 'FRONT', 'BACK', 'FULL'].
obj_data.fill_mode = 'FULL'

# Breadth of extrusion.
obj_data.extrude = 0.125

# Depth of extrusion.
# Which parts of the curve to extrude ['HALF', 'FRONT', 'BACK', 'FULL'].
obj_data.fill_mode = 'FULL'

# Breadth of extrusion.
obj_data.extrude = 0.125

# Depth of extrusion.
obj_data.bevel_depth = 0.125

# Smoothness of the segments on the curve.
obj_data.resolution_u = 20
obj_data.render_resolution_u = 32
obj_data.bevel_depth = 0.125

# Smoothness of the segments on the curve.
obj_data.resolution_u = 20
obj_data.render_resolution_u = 32

# Locate the array of bezier points.
bez_points = curve.data.splines[0].bezier_points

for i in range(0,64):
    bez_points[i].handle_left_type = 'ALIGNED'
    bez_points[i].handle_right_type =  'ALIGNED'

    bez_points[i].co.z = 0
    bez_points[i].co.x = (i**2)+20

    bez_points[i].co.y = 0

    xl = (i**2)
    xr = (i**2)+40

    bez_points[i].handle_left = (xl,y,0)
    bez_points[i].handle_right =  (xr,y,0)

    #Expression to determine the frequency range of the bars
    l = i**2 + 20
    h = (i+1)**2 + 20

# Return to object mode.
bpy.ops.object.mode_set(mode='OBJECT')

# Convert from a curve to a mesh.
bpy.ops.object.convert(target='MESH')

# Append modifiers.

subsurf_mod = bpy.curve.modifiers.new(name='Subsurf', type='SUBSURF')
stretch_mod = bpy.curve.modifiers.new(name='SimpleDeform', type='SIMPLE_DEFORM')

# Adjust modifier options.
skin_mod.use_smooth_shade = True
subsurf_mod.levels = 3
subsurf_mod.render_levels = 3
stretch_mod.deform_method = 'STRETCH'
stretch_mod.factor = 0.5



Sorry if my terminology is incorrect its all rather new to me! If someone can give me a little help or point me in the right direction, I'm struggling to piece it together from the API docs.
You can easily achieve this with the animation nodes add-on for blender (it's basically like coding but with nodes)
There's even a tutorial on YouTube for exactly what you are looking for!
:)