extract waveform as float from music with python?

How would I extract a waveform as float from music using python?

Can I do this in real time or do I have to do it before hand?

Thanks in advance.

I found this

To make a graph or plot of the waveform, the usual Python appoach is to get the waveform into a numpyarray, and then use matplotlib to make the plot.
The easiest way to read the data into a numpy array is to use scipy.io.wavfile.read, though if you prefer not to use scipy (it’s a big package), it’s not difficult to read and convert the data using Python’swav module.

but I don’t know how

Please edit your posts, rather than writing a new reply.

Your best bet is to use an existing library. A number can be found here.
https://wiki.python.org/moin/PythonInMusic

I got Yaafe, but I am unsure about where to put it to make it accessible,

blender/lib/ python?


is this correct?

I just import it like mathutils or bge?

it appears yaafe only works on osx and linux :frowning:

ok, back to digging

I’m a little lost on what to get, and where to start , (what api and how to import etc)

I don’t know what you mean by “waveform as float”. If you’re just looking for the amplitude, you can get that with the built in wave module.

Example attached.

Attachments

amprise.blend (562 KB)

Thank you Goran, I will try and get it up and running with my visualizations,

Thank you again!!!

So, I have a hack I use to replace smb_marioDie by unpacking, then deleting, then renaming the wav I want to use to smb_mariodie…

but how would I use a file from disk instead of the packed one?

been having a lot of trouble…

I need some help linking to music on a computer, rather then a packed file

so I can make a better tutorial

what is chako.main?

I have been passing out links to this file so if it’s malicious…


Again, please edit your existing posts!

It’s unlikely to be malicious, as it would have to be bundled with the blend file. Check the text files.

it’s not in the outliner, under text

would calling it throw a error if it was not linked?

also, how do I use a pointer to a external file?

BPR - Use audaspace to load the sound file. Here’sa tutorial I wrote ages ago that should still work.

How could I extract amplitude, or pitch or?

Thank you btw.