Converting data into audio

I would like to take a spread of numbers and save them as a wave file, how to do that?

Sounds like you will be dealing with some large spreads then, or short samples?

What exactly do you have in mind?

Somehow you might already be able to do it with VAudio even if I don’t think there’s an elegant way currently. For example there’s the WaveTable node although that plays the data in a loop so you’d have to stop recording manually.

It seems pretty straightforward to do a Node/Plugin using NAudio (library used by VAudio) and it’s WaveFileWriter function.

Maybe some NRT nodes would be a good addition to VAudio?

Ok, I’ve written a simple node for this now. Maybe I will have a test uploaded to this thread in a day or two, maybe later in the week depending on my available coding time.

For multi-channel files what do you is best?

  1. A pin with channel count and then the user has to interleave the input samples with Zip Node.
  2. A PinGroup for samples, the user has to set the channel count as pin count with Herr Inspektor resulting in different input pins per channel.

@beyon that sounds amazing, I was about to patch something like that myself but I still get at bit confused about raw.

I would like it so work either like the WaveTable from the VAudio pack where you define a spread size, perhaps the most safe way of doing it, except one would need to figure out what to do if there were multiple bin sizes of different size.

Alternatively it could just be a channel count and the input data would be split into lengths defined by the total size of the input spread.

In any case I think the interleaving should be done inside the WaveWriter node so you feed the node a spread with sub-spreads with a bin size. Perhaps with a padding function if the sizes of the channels doesn’t match.
I don’t like the node where you change the number of input pins in the inspektor.

also try SourceBuffer (DShow9)

Ok, sorry for the delay. One part lack of time and also because of the devil in the details as soon as you code something that’s not just a quick hack/proof of concept.

For now put in \packs\VVVV.Audio\nodes\plugins , I think it should work with any vvvv version latest VAudio pack works with but to be sure use beta34.2 or later.

I used VAudio name because I was already working on something with the VVVV.Audio solution and it depends on the NAudio.dll and didn’t feel like duplicating that.

On the other hand I’m not sure if it really should be packed with VAudio since it doesn’t really depend on anything in it apart from the same NAudio dependency and doesn’t have anything to do with any other audio nodes. So maybe in the end it should go in the addon pack.

This version needs multi channel audio to be interleaved so you have to use zip node or something else to structure the input spread correctly when not doing mono audio. It adds a few padding zero samples when needed if the spread count isn’t evenly divisible with the channel count. I went with this because it was simpler and leaves more in control of the user. What I don’t like is that this means you have to set the number of inputs on the zip node meaning less dynamic/flexible patches.

I may attempt changing to some bin size logic with settings for how differing channel data lengths should be handled (silence/repeat) plus it would also be nice to be able to write multiple files in one go.

Added functionality to ensure the samples are in the -1.0 to 1.0 range since this is what most audio software expects. Either scales or clips the samples. Maybe there should be a max volume pin too though since most commonly you limit the amplitude to something at least a few dB below the max swing.

I haven’t done extensive testing so consider this alpha. If you try to do a few minutes of audio you will start getting out of memory problems…

Should do a 64-bit build too but haven’t tested that yet.

Hope you can make use of it and provide some feedback!

Writer (VAudio NRT) (1.1 MB)

Sounds awesome @beyon, on the train right now, so I cant test right now, will do soon.

The ideal solution in my eyes would be to use VAudio buffers, like I suggest here: maybe that will happen some day, it is up to @tonfilm.

I will surely provide feedback, the immediate thing I can think of is that this would be an ideal case for x64 so we can use more memory in case we want really large datasets changed into audio.

thanks again.

“…in case we want really large datasets changed into audio.”

In that case I think a different design is needed more than just more memory, having hundreds of million of slices all at once across many nodes just won’t be a good experience as far as I can tell.

So… do you actually have a specific project in mind or just thinking freely/experimenting?

I placed it in the VAudio folder in \packs\VVVV.Audio\nodes\plugins in an x86 version of beta34.2 and it shows up red, the folder seems to be located correctly since the other VAudio nodes show up normal.

so no luck so far

Ok, here’s 64-bit version. It does give you more minutes but, I would still only recommend patching shorter sounds with this plugin since enormous spreads aren’t that nice to work with.

I should probably be able to compile an AnyCPU version instead but I haven’t looked into the project settings enough to know how when some of the vvvv dependencies seem to require specifying the platform.

Writer (VAudio NRT) (1.1 MB)

Hmm, don’t know if I can help you atm.

Can check on some other computers tomorrow and see if it needs anything more in order to work.

Could be the dlls are targeting .NET framework 4.6.1
What version of windows are you on? If 10 you should be fine, otherwise maybe not:

If this seems to be the case, maybe I can look at building versions targeting slightly older .NET framework tomorrow.

Try these built for .NET framework 4.5.2 which seem to be what current VVVV releases target according to the downloads page.

Writer (VAudio NRT) (1.1 MB)
Writer (VAudio NRT) (1.1 MB)

Sunep: Did you ever get this to work/try the latest files?

at leat your help patch works… this is super cool!