# Is there any way I can make a curve and/or a mesh from a wavefile?

So I want to make a mesh surface based on a wave file. I have been trying to convert sound to curves so I could extrude it to a mesh plane, but I am relatively new to Blender so I am not sure how to do this. Do anyone have any suggestions for a solution?

You can do that with the Animation Nodes (AN) addon.

1. Make a new AN tree.

2. Make a Sound Bake node and load your sound. Then click on "Bake".

3. Create an "Evaluate Sound" node and set its Frame Type from Offset to Absolute. The sound object you baked should be selected automatically.

4. Create "Loop Input" node and connect the Index socket to the Frame input.

5. Click on the plus icon next to New Generator Output and type "Vector List". This should create a new node that you can move to the right.

6. Connect the "Strength" output socket with the "Vector" input. A new "Combine Vector" node should appear inbetween, because a vector consists of 3 values and the Strength is only a single value. Reconnect the sockets like in the image below.

7. Insert an optional Math node to be able to control the width of the curve.

8. Create a "Invoke Subprogram" node and choose the loop you just created. Then set the Iterations socket to the number of frames you want to have in the final curve (too high numbers can slow Blender down, you may want to uncheck "Always" in the toolbar so that AN doesn't recreate the curve multiple times every second)

9. Create a "Spline from Points" node and connect it to the Vector List output of the other node.

10. Create a "Set Splines on Object" node. Then click on the little plus icon which will create an empty curve object in your scene that you can use as output object. The last step is to take the Spline we created before and put it on the Curve object. If you do this connection a "Create List" node gets inserted automatically because the Set Splines on Object node expects multiple splines (but we only have one, so we create a list with one spline).

Now you should see the curve in the viewport. You can just remove all nodes now or just make a copy of the curve in order to edit it further.

• Thank you so much! This works like a charm. Seems like there's endless possibilities with sound in the animation node system. I really want to learn to use it better.. Is there any literature you can recommend I read to get a better understanding of how I can utilise it? – Marius Feb 21 '16 at 15:42
• Well there is the documentation here: animation-nodes-manual.readthedocs.org/en/latest It doesn't have much content... but there are a few links to external sites that can help you. – Jacques Lucke Feb 21 '16 at 16:07

I've done this myself in the past, but the way I did it was fairly indirect. I loaded the file into Audacity, and took a screenshot of the audio visualization. Then I opened that file in Inkscape and cropped the screenshot to just the part of the audio that I wanted. I traced the image and saved the file as an SVG. I then imported this SVG into blender. Here's what that looked like when finished.

If you need help with the intermediary steps, let me know. None of the steps are overly difficult, but using an unfamiliar program can always be a challenge. :)

• Hi Jacob :) I had this as a backup plan, but I wanted something a bit more detailed. Something like the f-curve you get when using the 'audio to markers' plugin, but as a curve in the 3d view instead. – Marius Feb 21 '16 at 9:18

Hi I dabbled with this in 2013 as part of my Sound Drivers (then Speaker Tools) addon. The code required is still there (soundsurface.py) but needs to be run & edited manually, once the addon is installed.

I did get as far as wiring up the curve surface, which is a nice way to demonstrate how this is done.

A wav file (batman.wav) is associated with a speaker and then baked using default settings across 16 frequency ranges to custom properties (the channels) AA0 to AA15 into action SOUND_AA_batman.wav

Clicking on the actions button in the visualisers toolbox gives me

the 16 frequencies as curves, which gives a nice vis of the "surface". This is simply the fcurves baked to a curve.

The following code uses the fcurves of the action going in the time directions and adds a crossing action to give me grid points, from which I created a displacement map, (top right hand corner of image below) which then used on a subdivided grid to give the surface effect.

The script to produce the displacement map is included in the sounddrivers addon as "soundsurface.py" and needs to be opened and run from the text editor.

This part needs to be edited, you will need to edit 'SOUND_AA_batman.wav' to match the channel and wav file name you use, and the settings on image size and frame step can be played around with,.

action = bpy.data.actions['SOUND_AA_batman.wav']

sound_surface_texture(action,
bpy.context,
frame_split=1,
image_size_x=1024,
image_size_y=1024)


All going well you will end up with an image named "SoundSurface" which can be applied to a grid as a displacement map texture.

• Thanks for the reply! :) I ended up using the Animation Node approach but I am stoked people want to help out in a matter of hours :) – Marius Feb 21 '16 at 15:46