Wie die meisten Webseiten nutzen wir Cookies. Nähere Informationen dazu, wie wir mit diesen Cookies umgehen, können Sie in unseren Datenschutzbestimmungen lesen.   Einverstanden

3D Forum > Combine scripts and modify blender functions

Combine scripts and modify blender functions

21.11.2021 12:14
ForrestSo. 21 Nov. 2021, 12:14 Uhr
Dear Blender friends,

i am working on a script with another programmer. We use it to read the pitch (or the frequencies) from an mp3 file to drive an animation with it.
So far is our progress in 2 seperate Scripts:

He is able to read the pitch and gets number arrays from his script. They are showing up in the blender Console.

My script is able to create emptys with a, from an audio files amplitude baked f-curve (its a function from blender in the f-curve editor--> "bake sound from f-curves"). and bakes the animation.

So far so good. But now we want to combine our work to 1 script. My dream scenario would be, that in the line of my little script where i command blender to use the "bake sound to f curve" function, it runs the other script instead. After that i want to use the number arrays from the other script to sample an f-curve with it.

My programmer friend told me, that maybee its possible to use the "bake sound to f-curves" function code, to modifiy it to our needs. He gave me the task to research to this topic.

But i have absolutely no clue about stuff like that. I was really a hustle for me to get my script running, cause my programmer sklills are still really limited ^^.

So does anyone an advice where to start at least? Everything helpfull to get a step further in our project is highly apreciated!


The scripts:


import bpy
# add empty, create variable for it and name it
bpy.ops.object.empty_add(type='SPHERE', align='WORLD', location=(0, 0, 0), scale=(1, 1, 1))
driverslave = bpy.context.object
driverslave.name = "Driverslave"

# select only driverslave in the scene


driverslave.keyframe_insert(data_path='location', index = 2, frame = 1)

bpy.context.area.type = "GRAPH_EDITOR";
bpy.ops.graph.sound_bake(filepath="D:Blender 2.80NOKatanaganjaAudioOni Premaster Demo.mp3")

bpy.context.area.type = "VIEW_3D";
bpy.ops.nla.bake(frame_start=1, frame_end=250, bake_types={'OBJECT'})

bpy.context.area.type = "GRAPH_EDITOR";

His: as File to download below

TilesSo. 21 Nov. 2021, 12:27 Uhr

Are you looking for something like this? https://github.com/doakey3/Bizualizer


© 3D-Ring - deutsche 3D Software Community, Archiv 2001 - 2006