💾 Archived View for heavysquare.com › noise › 2018-08-29.sc.txt captured on 2022-04-29 at 12:34:27.

View Raw

More Information

⬅️ Previous capture (2021-12-03)

-=-=-=-=-=-=-

/*

Lessons learnt from this session.

(a) there are \on and \off message types (also \kill is similar, but more abrupt)
    with which you can turn on and off (release) synths defined by SynthDef at
    patterned times

(b) there are gate based envelope generators, which behave nicely when an \off
    event is "played" on the synth, it goes quiet with a release envelope, which
    is nicer than the abrupt stop with \kill; you need to have a default 1 parameter
    for your synth named gate (|gate=1|), this is set to 0 on an \off (afaik)

(c) finite patterns can be easily recorded, the record funtionality will use out=0
    on the instruments triggered for you to hear it, but it records from some other
    assigned bus (like [6,7]) and running an extra instance of the synths, but with
    the parameter out:6 (6 as per the previous example numbers), so if you have
    your own SynthDefs playing to Out.ar, you have to have an out=0 parameter to your
    synth and play to that bus with like Out.ar(out,...)

(d) tanh maps numbers into [-1,1], makes it pretty suitable to normalize things back to
    something of an audio-like signal, though big numbers make harsh noises; it's
    rather some sort of clipping, but a weirdly sounding one

(e) you can write parametric unitgen applications and mix them over a range, as in
    sum({|i| ...}!8/7).tanh where !8 generates i=0..7 versions, /7 divides the
    signals which then could not grow too big in amplitude, then a safety tanh is
    applied; in case ... is producing pairs of signals (eg
    SinOsc.ar(110+[i,2*i]*40)), you can get interesting stereo sounds

(f) pay attention that 110+[i,i*2]*20 is actually (110+[i,i*2])*20 - sadness :(



s.boot;
Tempo.bpm = 120;

(
  {
    [
      LFSaw.ar(1/[25,24.8]),
      LFSaw.ar(1/[25,24.8]).round(1/16),
      LFSaw.ar(1/[25,24.8]).round(1/16)**(1/2)
    ].flatten
  }.plot(5)
)
// control

{ { |i| RHPF.ar(Saw.ar(LFSaw.ar(1/[25,24.8]).round(1/16)**(1/2)*8),2**i*[25,49],0.01) }!4 }.plot
// harmonics

{ sum({|i|AllpassN.ar(RHPF.ar(Saw.ar(LFSaw.ar(1/[25,24.8]).round(1/16)**(1/2)*8),2**i*[25,49],0.01))/9}!8).tanh }.plot(5)
// sound

(
  SynthDef(\test,
    {|gate=1,out=0|
      g=EnvGen.kr(Env.asr(1,1,1),gate,doneAction:2);
      Out.ar(out,g*sum({|i|AllpassN.ar(RHPF.ar(Saw.ar(LFSaw.ar(1/[25,24.8]).round(1/16)**(1/2)*8),2**i*[25,49],0.01))/9}!8).tanh)
    }
  ).add;
)

Pdef(\onoff, Pbind(\dur,Pseq([4,1,2,1]*4,2),\type,Pseq([\on,\off],2),\id,Server.default.nextNodeID,\instrument,\test))
Pdef(\onoff).record("/tmp/2018-08-29.wav",headerFormat:"WAV")

// spectro -- ffmpeg -i 2018-08-29.wav -lavfi showspectrumpic=s=800x600:color=channel:legend=disabled 2018-08-29-spectro.jpg