MartinusMagneson's picture

Magneson (@MartinusMagneson)

Compositions

MartinusMagneson's picture
Magneson commented on jersmi's Discussion, “3D audio file display

You also have to add the two lists together again, forgot to mention that!

MartinusMagneson's picture
Magneson commented on jersmi's Discussion, “3D audio file display

I just looked at the header data with the two loose nodes at the top to confirm the data according to the spec. For the data itself I looked at the output object which confused me for a bit until I remembered the endian-thing. If you know the sample size per cycle it's just a matter of setting the byte count (Cut Data) to the double of the samples.

The wave data itself starts at byte 45 after the header, and from what I understand use two bytes per sample. There is no direct data -> samples conversion (maybe a FR is in place?), but you might get lucky with converting a real list to audio. To do so (in theory) you can feed the output from the Cut Data to a Deinterleave list where the second list gets calculated with (1/256) x ListItem and the first list would be calculated with ((1/256)/256) x ListItem

(The proper term is probably calculation, not formula. I've been baking too much the last 7 months..)

MartinusMagneson's picture
Magneson commented on jersmi's Discussion, “3D audio file display

The calculate list formula is:

(((((Height/ 255) * X) - (-(Height/2))) % ((Height/2) - (-(Height/2)))) + ((Height/2) - (-(Height/2)))) % ((Height/2) - (-(Height/2))) + (-(Height/2))

to deal with conversion from 8-bit to Vuo coordinates and place the parts correctly.

MartinusMagneson's picture
Magneson commented on jersmi's Discussion, “3D audio file display

If you're not scared of some heavy nerding, you can also just get the bytes from the wav files via the Data nodes and convert the sample range from the file to the Y-values you need. That way you get straight to the data you want instead of going through a build/process list step.

Be aware of the endianness of the wav data (Stackoverflow look at the second answer/The Canonical WAVE file format). Although the data starts at byte offset 45, it's little-endian meaning that you want to start at byte offset 46, and skip every other byte as you won't need the details for a display anyways. You can probably skip even more bytes in total, just add 2 to the skip count to decrease the resolution..

I'm too slow to figure out the formula, but you also probably want to shift all values above 127 to be in the negative range. Since the byte values are naturally unsigned they are subtracted from the maximum byte value (255).

MartinusMagneson's picture
Magneson commented on jersmi's Discussion, “3D audio file display

Oh, and you have an offset from the input in your lines. Your list starts at the beginning of the line, but the control signal doesn't come in until where the linear behaviour ends. This is probably why the waves are out of sync as well. Try cutting the input list going to the line object node from the beginning until it syncs up/starts at the wave.

Pages