How to map musical data to objects in blender amd export 3D printable .stl file
Assuming you have already baked a sound file to curve, you could evalutate the f-curves values and assign them to a prepared object e.g. massivley loop-cut cube.

import bpy

obj = bpy.context.scene.objects["Cube"]
action = obj.animation_data.action

fcurves = action.fcurves
for f in fcurves:
    print(f.data_path)

coords = []
for vert in obj.data.vertices:
    if vert.co.z &gt; 0:
        coords.append( vert.co )
        print( vert.co )

ysorted = sorted(coords, key=lambda element: (element[1] ))

cidx=0            
for i in range(200,250):
    curve_val = f.evaluate(i)
    ysorted[cidx].z = curve_val
    cidx = cidx + 1
    ysorted[cidx].z = curve_val
    cidx = cidx + 1




The vertices are first filtered by positive z-coordinste and sorted by y-coordinate so that opposite (on x-axis) vertices follow in a sequence. After that the curve value is evaluated and assigned to the z component of the vertex.

The resulting mesh is manifold and can be exported to.STL format.