diff --git a/2022-09-02.lisp b/2022-09-02.lisp new file mode 100644 index 0000000..49e963c --- /dev/null +++ b/2022-09-02.lisp @@ -0,0 +1,101 @@ +;;; my yesterday's attempt + +(in-package #:cl-collider) +;; https://github.com/SCLOrkHub/SCLOrkSynths +;; https://github.com/SCLOrkHub/SCLOrkSynths/blob/master/SynthDefs/bass/acidOto3091.scd + +(defsynth bdrum ((amp 0.5) (out 0) ) + (out.ar out (* amp (sin-osc.ar (line.ar 120 60 1) 0 (env-gen.ar (env (list 0 1 0) (list 0.005 0.5)) :act :free))))) +(defsynth acid0to3091-my-attempt ((amp 0.5) (out 0) (gate 1) (freq 440) (pan 0) (att 0.001) (dec 0.5) (sus 0.1) (rel 0.5) (curve -4) (lagTime 0.12) (filterRange 6) (width 0.51) (rq 0.3)) + (let* ((freq (lag.kr freq lagTime)) + (ampEnv (env-gen.kr (adsr att dec sus rel amp 0) :gate gate)) + (filterEnv (env-gen.kr (adsr att (* 2 dec) (/ sus 2) (* 2 rel) (expt 2 filterRange) (* -1 curve) 1) :gate gate :act :free)) + (sndStep1 (_range nil (lf-pulse.ar freq 0.0 width) -1 1)) + (sndStep2 (rlpf.ar sndStep1 (* freq filterEnv) rq)) + (sndStep3 (* sndStep2 ampEnv))) + (out.ar out (pan2.ar sndStep3 pan)))) +(synth :acid0to3091-my-attempt :freq 80) +(stop) + +;; after getting help with translation of other synth examples +(defsynth acid0to3091-from-getting-help ((amp 0.5) (out 0) (gate 1) (freq 440) (pan 0) (att 0.001) (dec 0.5) (sus 0.1) (rel 0.5) (curve -4) (lagTime 0.12) (filterRange 6) (width 0.51) (rq 0.3)) + (let* ((freq (lag.kr freq lagTime)) + (ampEnv (env-gen.kr (adsr att dec sus rel amp 0) :gate gate)) + (filterEnv (env-gen.kr (adsr att (* 2 dec) (/ sus 2) (* 2 rel) (expt 2 filterRange) (list (* -1 curve) curve curve) 1) :gate gate :act :free)) + (sndStep1 (range (lf-pulse.ar freq 0.0 width) -1 1)) + (sndStep2 (rlpf.ar sndStep1 (* freq filterEnv) rq)) + (sndStep3 (* sndStep2 ampEnv))) + (out.ar out (pan2.ar sndStep3 pan)))) +(synth :acid0to3091-from-getting-help :freq 80) +(stop) +;; and let's remove gate? + +(defsynth acid0to3091-without-gate ((amp 0.5) (out 0) (freq 440) (pan 0) (att 0.001) (dec 0.5) (sus 0.1) (rel 0.5) (curve -4) (lagTime 0.12) (filterRange 6) (width 0.51) (rq 0.3)) + (let* ((freq (lag.kr freq lagTime)) + (ampEnv (env-gen.kr (adsr att dec sus rel amp 0))) + (filterEnv (env-gen.kr (adsr att (* 2 dec) (/ sus 2) (* 2 rel) (expt 2 filterRange) (list (* -1 curve) curve curve) 1) :act :free)) + (sndStep1 (range (lf-pulse.ar freq 0.0 width) -1 1)) + (sndStep2 (rlpf.ar sndStep1 (* freq filterEnv) rq)) + (sndStep3 (* sndStep2 ampEnv))) + (out.ar out (pan2.ar sndStep3 pan)))) +(synth :acid0to3091-without-gate :freq 80) +(stop) +;; just removing gate does nothing? so maybe gate should be controlled from patterns? by pasting in another +;; and sound the same, so I'd need to put in maybe an envelope? in a pattern? + +(in-package #:cl-patterns) +(pb :foo-with-acid + + :instrument :acid0to3091-from-getting-help + :play-quant 4 + :freq (pseq (list 40 50 60 70 80) 1) + :dur (pseq (list 1 2)) + ) +;; (play :foo-with-acid) +;; (end :foo-with-acid) +;; +;; wait, so it does work? maybe because "gate" is default parameter +;; that gets created when events with duration get created? + +;;; fmbass after getting help: +(in-package #:cl-collider) +;;; my attempt +;;; https://github.com/SCLOrkHub/SCLOrkSynths/blob/master/SynthDefs/bass/bassWarsaw.scd +(defsynth fmBass-my-attempt ((out 0) (freq 440) (gate 1) (amp 0.5) (pan 0) (att 0.01) (dec 0.3) (sus 0.4) (rel 0.1) (slideTime 0.17) (cutoff 1100) (width 0.15) (detune 1.005) (preamp 4)) + (let* ((env (env-gen.kr (adsr att dec sus rel) :gate gate :act :free)) + (freq (lag.kr freq slideTime)) + (sndStep1 (var-saw.ar freq 0 width preamp)) + (sndStep2 (distort sndStep1)) + (sndStep3 (* sndStep2 env)) + (sndStep4 (lpf.ar sndStep3 cutoff amp))) + (out.ar out (pan2.ar sndStep4 pan)))) +(synth :fmBass-my-attempt :freq 80) +(stop) +(defsynth fmBass ((out 0) (freq 440) (gate 1) (amp 0.5) (pan 0) (att 0.01) (dec 0.3) (sus 0.4) (rel 0.1) (slideTime 0.17) (cutoff 1100) (width 0.15) (detune 1.005) (preamp 4)) + (let* ((env (env-gen.kr (adsr att dec sus rel) :gate gate :act :free)) + (freq (lag.kr freq slideTime)) + (sndStep1 (var-saw.ar (list freq (* freq detune)) 0 width preamp)) + (sndStep2 (distort (mix sndStep1))) + (sndStep3 (* sndStep2 env)) + (sndStep4 (lpf.ar sndStep3 cutoff amp))) + (out.ar out (pan2.ar sndStep4 pan)))) +(synth :fmBass :freq 80) +(stop) + +(in-package #:cl-patterns) +(pb :foo-with-fmbass + :instrument :fmBass + :play-quant 4 + :legato 1 + :freq (pseq (list 40 50 60 70 80) 1) + :dur 1 ;; (pseq (list 1 2 3)) + ) +;; (play :foo-with-fmbass) +;; (end :foo-with-fmbass) + +;; changing :legato between 1 0.7 0.4 0.2 +;; and duration between 1 0.5 0.2 +;; produces cool sounds, and reevaluation while thing runs on #'PLAY is super cool +;; +;; apart from pitch model I'd like to learn how to merge patterns, so that all notes of phrase would play on one setting for :dur & :legato +;; then on others, diff --git a/programming-music-journal.org b/programming-music-journal.org index 0130c25..0be9c34 100644 --- a/programming-music-journal.org +++ b/programming-music-journal.org @@ -284,3 +284,13 @@ What I got produced an interesting sound, but didn't stop And I'm currently very far from being able to debug \ troubleshoot what's going on here, I do have one #'ENV-GEN that has :act :free but can't follow all the transformations, so have no idea what's going wrong +** [2022-09-02 Fri] +*** got a helpful response +with fixed synthdefs +*** tried synths in a pattern and they work! +even though they don't stop on their own, +so maybe `gate` is a default argument that passes control from the pattern system, using `dur` +*** NEXT - learn more about puttin melodies in, midinotes and stuff +what I want is "pitch model" +http://doc.sccode.org/Tutorials/Streams-Patterns-Events5.html +*** NEXT - how to keep same note pattern repeating with different settings of legato \ duration