(in-package #:cl-collider) (defsynth tone-pluck ((freq 440) (amp 0.2)) (out.ar 0 (* (saw.ar (let ((detune (* freq 0.01))) (list (- freq detune) (+ freq detune)))) (env-gen.kr (perc 0.1 1.8) :level-scale amp :act :free)))) ;; (synth :tone-pluck) (defsynth kik ((freq 440) (out 0)) (let* ((env (env-gen.kr (env (list 0 1 0) (list 0.001 1)) :act :free)) (fenv (env-gen.kr (env (list 1 0) (list 0.25)) :level-scale freq)) (sig (sin-osc.ar fenv 0 0.2))) (out.ar out (pan2.ar sig 0 env)))) ;; (synth :kik) (in-package #:cl-patterns) (pb :what-predef-chord :instrument :tone-pluck :note (pseq (mapcar #'chord-notes (list (chord "Major Triad") (chord "Minor Triad") (chord "Minor 7th") (chord "Major 7th") (chord "Diminished Triad") (chord "Major Triad"))) 1) :octave 4 :root 2 :dur (pseq '(2 2 4)) ;; :play-quant 4 ) ;; (play :what-predef-chord) ;; (end :what-predef-chord) (pb :what-basic-percussion :instrument :kik :note 0 :dur (pseq '(1 1 1 1 1) 1) ; ok, too hard again, want to finish something and go on :play-quant 4) ;; (play :what-basic-percussion) ;; (stop :what-basic-percussion) ;;; now, previous stuff copied off the (pdef :maybe-parallel (ppar (list (pdef :what-basic-percussion) (pdef :what-predef-chord)))) (setq *maybe-parallel* (ppar (list (pdef :what-basic-percussion) (pdef :what-predef-chord)))) ;; (play *maybe-parallel*) ;; (play :maybe-parallel) ;; (stop :maybe-parallel) ;; ok, that is a bit interesting? there's additional beep in the beginning ;; yay. so, it did parallel. ;; how do I add pauses then? (pb :what-symbols-percussion :instrument :kik :note 0 :embed (pcycles "oo-o-o--oo--o--o") :dur 1 :play-quant 4) ;; (play :what-symbols-percussion) ;; (stop :what-symbols-percussion) (pdef :better-parallel (ppar (list (pdef :what-symbols-percussion) (pdef :what-predef-chord)))) ;; (play :better-parallel) ;; (stop :better-parallel) ;; well, I still don't understand the metering ;; but good enough for now. let's go looking for the better definitions of percussions? ;;; let's start with trying to get synthdefs from super-collider guide? ;; https://supercollider.github.io/examples ;; ;; ;; { ;; var snare, bdrum, hihat; ;; var tempo = 4; ;; tempo = Impulse.ar(tempo); // for a drunk drummer replace Impulse with Dust !!! ;; snare = WhiteNoise.ar(Decay2.ar(PulseDivider.ar(tempo, 4, 2), 0.005, 0.5)); ;; bdrum = SinOsc.ar(Line.ar(120,60, 1), 0, Decay2.ar(PulseDivider.ar(tempo, 4, 0), 0.005, 0.5)); ;; hihat = HPF.ar(WhiteNoise.ar(1), 10000) * Decay2.ar(tempo, 0.005, 0.5); ;; Out.ar(0, (snare + bdrum + hihat) * 0.4 ! 2) ;; }.play (in-package #:cl-collider) (defsynth tempo () (out.ar 0 (impulse.ar 4))) ;; (synth :tempo) ;; (stop) ;; ;; but is that multiple repeating ;; (defsynth kik ((freq 440) (out 0)) ;; (let* ((env (env-gen.kr (env (list 0 1 0) (list 0.001 1)) :act :free)) ;; (fenv (env-gen.kr (env (list 1 0) (list 0.25)) :level-scale freq)) ;; (sig (sin-osc.ar fenv 0 0.2))) ;; (out.ar out (pan2.ar sig 0 env)))) ;; ;; (synth :kik) ;; ;; and how would I add :free / end to the synth thingy ;; ;; let's try snare ;; WhiteNoise.ar(Decay2.ar(PulseDivider.ar(tempo, 4, 2), 0.005, 0.5)); (defsynth snare () (out.ar 0 (decay2.ar (pulse-divider.ar 4 4 2) 0.005 0.5)) ;; (white-noise.ar (decay2.ar (pulse-divider.ar 4 4 2) 0.005 0.5)) ) ;; (synth :snare) ;; (stop) ;;; let's try to figure out white noise (defsynth wh-no () ;; (out.ar 0 (white-noise.ar 1 1)) (out.ar 0 (white-noise.ar)) ) ;; (synth :wh-no) ;; (stop) ;; ;; so, pulse-divider is a way to emit frequencies? ;; https://doc.sccode.org/Classes/PulseDivider.html ;; ;; now to decay ;; https://doc.sccode.org/Classes/Decay2.html ;; ;; still snare doesn't seem to work, even though I kind of understand it ;; maybe if I add it to pattern as instrument? (in-package #:cl-patterns) (all-instruments) (pb :what-test-percussion :instrument :wh-no :note 0 :dur (pseq '(1 1 1 1 1) 1) ; ok, too hard again, want to finish something and go on :play-quant 4) ;; (play :what-test-percussion) ;; (stop :what-test-percussion) ;; // since attack and decay are a difference of two Decays, ;; // swapping the values, the envelope turns upside down: ;; plot({ Decay2.ar(Impulse.ar(1), 0.001, 0.01) }) ;; plot({ Decay2.ar(Impulse.ar(1), 0.01, 0.001) }) ;; // used as an envelope ;; { Decay2.ar(Impulse.ar(XLine.kr(1,50,20), 0.25), 0.01, 0.2, FSinOsc.ar(600)) }.play; ;; // compare the above with Decay used as the envelope ;; { Decay.ar(Impulse.ar(XLine.kr(1,50,20), 0.25), 0.2, FSinOsc.ar(600), 0) }.play; (in-package #:cl-collider) (defsynth decay2 () (out.ar 0 (decay2.ar (impulse.ar (x-line.kr 1 50 20) 0.2 (sin-osc.ar 600) 0))) ;; (out.ar 0 (decay2.ar (impulse.ar (x-line.kr 1 50 20) 0.2 (sin-osc.ar 600) 0))) ;; (white-noise.ar (decay2.ar (pulse-divider.ar 4 4 2) 0.005 0.5)) ) ;; (synth :decay2) ;; (stop) ;; bdrum = SinOsc.ar(Line.ar(120,60, 1), 0, Decay2.ar(PulseDivider.ar(tempo, 4, 0), 0.005, 0.5)); ;; well, let's try this one? (defsynth maybe-bdrum () (out.ar 0 (sin-osc.ar (line.ar 120 60 1) 0 (decay2.ar (pulse-divider.ar 4 4 4) 0.005 0.5))) ) ;; (synth :maybe-bdrum) ;; (stop)