Inserting a .WAV file (audio) and create curves using Firefly?

Hello,

I am trying to insert a recording in .wav format to be able to draw the audio curves in a graphical format using the recommended plugin Firefly.
I know there used to be a component part of the Buzz plugin called ‘read Wav’, but seems to not be available anymore.

Using the below script, can anyone help me understand if it’s possible to read the audio file or if it has to be played turning on one of the plugs?

sound to curve.gh (11.5 KB)

Many thanks in advance!

This seems applicable.

2 Likes

I have a C# that reads wav files and outputs values for L, R channels. But is rather slow (results for reading a 700KB test wav: 4000 ms ! (mama mia) … meaning that it could take days/weeks/months/years for a real-life song). Anyway notify if you think that you may need such a solution.

PS: Of course you’ll need to create your curves after getting the L, R values (I do hope that you know how to do it)…

1 Like

Thank you very much for this Pfotiad0!
My files should only be around 100/150KB so I’m willing to give it a try.
Could you please send me your C#?

Thank you again!

Thank you very much for this Rickson!
I’m afraid the Mac version is still not available, unless you know differently?

In the meantime I’ll try it on a Windows.

Thank you!

OK, but … is kinda a Harley Davidson : pathetic to the max.

Read_WAV.gh (119.5 KB)

PS: Added a few lines more for the graph part

2 Likes

This is great! Thank you so much!

Could you also send me a screenshot of the coding inside C# please?

Er … what do you mean? You propably mixed a compiled add-on (I never/ever do that) with C# … meaning that the thing is open/exposed for anything and to anyone: just double click it.

But better safe than sorry: do a copy before change things, he he.

Once I’ve double clicked and inserted my WAV file, this is what I get:

So I was wondering if anything needs to be changed inside the C#…
And nothing is generated in Rhino either

Yikes + Yikes: That’s a first to me. Hard to believe what I’m seeing (but never say never, he he).

Anyway zip the WAV file and attach it here ASAP (wav is not supported as attachment).

WAIT A MINUTE: what do you mean by double clicked and inserted your file ?: I do hope that you haven’t … er … hmm … inserted a wav file into the C# body??

If so > Math.Pow(Mama Mia, Mama mia);

This is the compressed WAV:
Boat Bagan to Mandalay still.wav.zip (1.1 MB)

I double clicked into the toggle to add the file, not the C# body, is that what I should do?

Thank you for your great help!

If you make the getWAVfile toggle true … a classic win dialog opens and then you should locate and pick your wav file (extension: wav). Double clicking on the C# … has nothing to do with all that.

Anyway: your stuff has only 13 values per L/R channel :

1M Q: are you in the Mac bandwagon? If so … well … I have no idea what’s happening because I never work on a Mac.

Yes I assume mine is acting funny because I’m using a Mac, I’m sure it’ll work perfectly on a Windows by following your instructions.

So I’ll do that!

Thank you infinitely!

Mac is 1M miles away from my game (I’m in the AEC market sector using things the likes of CATIA, AECOSim [and GH some times] on Win [7 and/or 10] based workstations).

Anyway just tested about 20 wav files: guess what? No problem(s) at all:

But still: a wav file with just 13 L/R values (your stuff) appears ominous to me.

BTW: If your channels have a lot of doubles … the skip (i.e. take values every skip index etc etc) takes care of the issue of making a polyline out of 1M points. But if the skip > your values … this means that you’ll get nothing as a graph. Tip: For a typical small (Windows style) wav file with 400K values per channel … set skip to 200.

Yes that’s a good tip! I’ll test my audio files on Windows and see how that goes.
Thank you again

Hello Pfotiad0,

I managed to make it work on a Windows so thank you!
I have one other question: what are the values that the C# is extracting form the WAV file?

I know it’s left and right channel, but I’m interested in frequency, amplitude and the time related if that’s extractable?

Thank you in advance!

http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html

1 Like