From c8c7b0a45c110ddb84809109e6a89a5b0c732caf Mon Sep 17 00:00:00 2001 From: efim Date: Sun, 4 Sep 2022 12:36:45 +0000 Subject: [PATCH] saturday after work things --- 2022-09-03-small-time-more-synthdefs.lisp | 59 +++++++++++++++++++++++ programming-music-journal.org | 13 +++-- 2 files changed, 67 insertions(+), 5 deletions(-) create mode 100644 2022-09-03-small-time-more-synthdefs.lisp diff --git a/2022-09-03-small-time-more-synthdefs.lisp b/2022-09-03-small-time-more-synthdefs.lisp new file mode 100644 index 0000000..1a23d6c --- /dev/null +++ b/2022-09-03-small-time-more-synthdefs.lisp @@ -0,0 +1,59 @@ +(in-package #:cl-collider) +;; https://github.com/SCLOrkHub/SCLOrkSynths +;; https://github.com/SCLOrkHub/SCLOrkSynths/blob/master/SynthDefs/strings/violin.scd +(freq 440) (gate 1) (amp 1) (pan 0) (out 0) (att 0.1) (dec 0.1) (sus 0.5) (rel 0.1) +(vRate 4.6) (vDepth 0.02) (vAtt 0.15) (vRateVar 0.25) (vDepthVar 0.05) +(pwmVarRate 2) (pwmMin 0.7) (pwmMax 0.8) (pwmRate 5) +(bridgeFreq 2500) (scratchDepth 0.15) + +(defsynth violin ((freq 440) (gate 1) (amp 1) (pan 0) (out 0) (att 0.1) (dec 0.1) (sus 0.5) (rel 0.1) + (vRate 4.6) (vDepth 0.02) (vAtt 0.15) (vRateVar 0.25) (vDepthVar 0.05) + (pwmVarRate 2) (pwmMin 0.7) (pwmMax 0.8) (pwmRate 5) + (bridgeFreq 2500) (scratchDepth 0.15)) + (let* ((scratch (+ 1.025 (env-gen.kr (perc att (* 1.25 dec) scratchDepth)))) + (envelope (env-gen.kr (adsr att dec sus rel) :gate gate :act :free)) + (freq (vibrato.kr freq vRate vDepth (+ att dec) vAtt vRateVar vDepthVar)) + (pwm-step-1 (range (sin-osc.kr pwmRate (rand.ir 0.0 1.0)) pwmMin pwmMax)) + (pwm-step-2 (* pwm-step-1 (range (lf-noise2.kr pwmVarRate) 0.2 0.8))) + (snd-step-1 (var-saw.ar (* + (lag.kr freq) + (range (lf-pulse.ar (* freq 1.5)) (/ 1 scratch) scratch)))) + (snd-step-2 (+ (* snd-step-1 0.7) + (bpf.ar snd-step-1 bridgeFreq 2 2))) + (snd-step-3 (* snd-step-2 envelope))) + (out.ar out (pan2.ar snd-step-3 pan))))) +;; (synth :violin :freq 400) +;; (stop) +(in-package #:cl-patterns) +(pb :foo-with-pluck-synth +:instrument :violin +:play-quant 4 +:decay 2 +:att 0.07 +:sus 0.8 +:legato 1 +:degree (pseq (list 0 1 2 3 4 5 6 7) 1) +:dur 2) +;; (play :foo-with-pluck-synth) +;; (end :foo-with-pluck-synth) +;; (stop :foo-with-pluck-synth) +;; +;; let's make it a simple gamma? +;; cool, and easy with the :degree (from pitch model http://doc.sccode.org/Tutorials/Streams-Patterns-Events5.html ) + +(pb :mary-had-a-little-lamb +:instrument :violin +:play-quant 16 +:legato 1 +:degree (pseq (list 6 5 4 5 6 6 6 5 5 5 6 6 6 6 5 4 5 6 6 6 6 5 5 6 5 4) 1) +:dur (pseq (list 1 1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 4)) +:scratchdepth (pseq (list 0.1 0 0 0)) +:vdepth (pseq (list 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.06)) +) + +;; (play :mary-had-a-little-lamb) +;; (end :mary-had-a-little-lamb) +;; (stop :mary-had-a-little-lamb) + +;; there has to be a better way to split the tacts +;; (render (pdef :mary-had-a-little-lamb) "/tmp/mary.wav" :dur 32) diff --git a/programming-music-journal.org b/programming-music-journal.org index 0be9c34..c8caeaa 100644 --- a/programming-music-journal.org +++ b/programming-music-journal.org @@ -284,13 +284,16 @@ 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 +* [2022-09-02 Fri] +** got a helpful response with fixed synthdefs -*** tried synths in a pattern and they work! +** 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 +** 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 +** NEXT - how to keep same note pattern repeating with different settings of legato \ duration +* [2022-09-04 Sun] +** evil marcro for wrapping consecutive values (or args) into pairwise brackets: +well, not being inserted due to backspace, sad