SuperCollider code for Ball of Confusion wavetables

This is pretty niche but since it took me some frustrating minutes to get it right I thought I would share, in case anyone else uses SuperCollider with VCV.

I wanted to make some custom wavetables for the very fun Ball of Confusion module using SuperCollider. They need to be mono, 2048-sample, and I think 32-bit float wav files as far as I can tell. I tried some other ways to do it but this seems to be the simplest. Below is a single example that works for 48000 samples per second audio; of course the real fun is making a large family of sounds for the Ball with some loops.

(
// I don't think this is necessary but I try to keep all my rates 48000
s.options.sampleRate_(48000);
s.reboot;
)

(
a = Signal.newClear(2048);
// arbitrary example function
a.waveFill({ arg x, old, i; 0.5*sin(x*2*pi*(x + 1))}, 0, 1);
a.waveFill({ arg x, old, i; sin(x)*0.5 + old}, 0, 2*pi);
f = SoundFile.new.headerFormat_("WAV").sampleFormat_("float").numChannels_(1).sampleRate_(48000);
f.openWrite("/whatever/path/you/want/example.wav");
f.writeData(a);
f.close;
)
7 Likes

Well now, thank you very much for that little snippet ! I am an occasional user of SC3, I’ll give your code a whirl later today.

Best regards,

dp

1 Like

you wouldn’t happen to be the Swiss Dave Phillips of Fear God, Rudolf Eb.er cohort, etc.?

Nope, sorry.