Week 5, lesson 3, superdirt synths part 2!

Hi @cycle1, if you're interested in getting your hands dirty with synthesis, @eris has a great video for you !

Here's the code:

SynthDef(\test, {
 |out,sustain=1,freq=440,speed=1,begin=0,end=1,pan,accelerate,offset,clamp=1|
 var line, env, volume, tone, outAudio;
 freq=freq*speed;
 line = Line.ar(begin,end,sustain/speed,doneAction: Done.freeSelf);
 env = Env.new(levels: [0, 1, 0.9, 0], times: [0.1, 0.5, 1], curve: [-5, 0, -5]);
 volume = IEnvGen.ar(env, line);
 tone = (Pulse.ar(freq,line)+Pulse.ar(freq*1.01,line)+Pulse.ar(freq*0.99,line))/3;
 outAudio = RLPF.ar(tone*volume, 20000*clamp*volume,0.3);
 OffsetOut.ar(out,DirtPan.ar(outAudio, ~dirt.numChannels, pan, volume));
}).add;

At the time of writing the subtitles are auto-generated, we're looking into getting them edited.

See also this comment by @julian, who made SuperDirt, and clears up some things about envelopes I wasn't sure about in my own video on the topic.

24 Likes

Awesome crash course on supercollider, which was quite alien to me. This opens so many possibilities! I will definitely try to dig deeper.
Also, the patterning trick seemed new to me :

d1 $ n"[ 7 0 3 0]*4" |+ n "<0 5 2 3>*2" |+ s "supersaw"

It seems the same pattern undergoing sequential transposition? I thought I could rewrite it this way :
d1 $ hurry 2 $ n "<[7 0 3 0] [12 5 8 5 ] [ 9 2 5 2] [10 3 6 3]>*2" # s "supersaw" but not!

Only this worked :
d1 $ hurry 2 $ n "<[7 0 3 0]*2 [12 5 8 5 ]*2 [ 9 2 5 2]*2 [10 3 6 3]*2>" # s "supersaw"

It still seems a bit magical. Applying this type of transformation to rhythms is cool for breaks : d1 $ n"[ 7 0 3 0]*4" |+ n "<0 5 2 3>*2" |+ s "drum" )!

Thanks a lot for this video!

3 Likes

Thanks, @eris!

1 Like

I've gone through this myself, and it cleared things up for me nicely too, thanks @eris!

1 Like

Ah yeah! I tend to separate out beat-level and cycle-level events like this because I'm thinking of it as an arpeggio over a chord progression, but I suppose it does have the pleasant side-effect of disambiguating the rhythmic end of things.

I've also got some helper functions that will constrain sequences like this to a given octave range that I should maybe cover. That way, you can do stuff like n "[7 0 3 0]" |+ n (slow 8 ((run 8) * 5)) to have a nice descending circle-of-5ths progression without having your pitches fly off into supersonic frequencies.

(also I'm so happy my video was helpful- thanks for the feedback!)

8 Likes

Hi Eris,

Great stuff, nice intro to SynthDefs, and really nice sounds too !

Cheers

@

1 Like

Woah! Thanks a lot for this video. Wasn't even aware one could even create synths such easily.

1 Like