simple audio visuelizer useing existing blocks


hello i am attempting to make a simple audio visuilizer for my youtube videos at the moment i have the blocks in the configuration i want so i dont want to go to all the trouble of spawning in new entitys via code (mostly because i am a horrible coder). but i want to set each block to a different range (the only part i can’t figure out)
here is an example of what i am trying to work with.

directory = "audio file.MP3"
#set cube 1
bpy.ops.object.select_pattern(pattern="c001")

bpy.ops.anim.keyframe_insert_menu(type='Scaling')

bpy.context.area.type='GRAPH_EDITOR'

bpy.ops.graph.sound_bake (filepath= directory,low=0, high=69)

bpy.context.active_object.animation_data.action.fcurves[0].lock = False 
bpy.context.active_object.animation_data.action.fcurves[1].lock = False 
bpy.context.active_object.animation_data.action.fcurves[2].lock = False 

bpy.context.active_object.scale.x = 0.320
bpy.context.active_object.scale.y = 0.07

#set cube 2
bpy.ops.object.select_pattern(pattern="c002")

bpy.ops.anim.keyframe_insert_menu(type='Scaling')

bpy.context.area.type='GRAPH_EDITOR'

bpy.ops.graph.sound_bake (filepath= directory,low = 69, high = 138)

bpy.context.active_object.animation_data.action.fcurves[0].lock = False 
bpy.context.active_object.animation_data.action.fcurves[1].lock = False 
bpy.context.active_object.animation_data.action.fcurves[2].lock = False 

bpy.context.active_object.scale.x = 0.320
bpy.context.active_object.scale.y = 0.07

and so on and so forth for all 18 blocks. i know i am probably doing this is the worst way possible (mostly because it dousn’t work). the only problem i am haveing doing it this way is that the low and high variables get reset each step and for some reason it is binding all the steps to the last variable entered.also if someone can help me fix this code so it only minipulates the Z scale that would help(i have just muted the X and Y in the graph editor and that seems to be working fine)

well the problem was by not deselecting the blocks it was rebakeing all past blocks for each step
this project is done and can be townloaded on my google drive here
i know new accounts are not supposed to post links but honestly this was the only reason i made this account so i probably will not be revisiting this website.