I’ve created a single cycle waveform as a .wav file and I’m trying to convert it into a wavetable
to be loaded into an oscillator in a synthdef.
So far I’ve been able to get the following code to run but when I plot the final buffer the wavetable is loaded into I get a graph with nothing in it.
The float array values all seem to be 0 as well, so it’s not actually turning the amplitude information from the .wav file into values in the array. Its created an array of 2056 values, which seem like the right number for the waveform since it’s literally one cycle (maybe a tiny fraction of a second long at 44.1 sample rate).
Why would the values all be 0?
The code is
b = SoundFile.openRead("C:\\Users\\44774\\AppData\\Local\\SuperCollider\\Tables\\wubsquare.wav".standardizePath); a = FloatArray.newClear(b.numFrames); c = a.as(Signal); d = c.asWavetable; e = Buffer.loadCollection(s, d);
You can see I’ve opened the file, then sent it to an array, then converted the array into a signal, then converted the signal into a wavteable, and finally loaded that wavetable onto a buffer.
I tried running
And get just a flat graph which is basically silence, if I’m not mistaken?
Does anyone have any ideas on why that is?
Maybe there’s a better way to achieve what I’m trying to do?
Any help or suggestions are greatly appreciated!