From 602fc34c0a3488afd170985441a87dd4b8db3012 Mon Sep 17 00:00:00 2001 From: efim Date: Tue, 30 Aug 2022 05:51:26 +0000 Subject: [PATCH] from 28th, so little time to percussion --- 2022-08-28-trying-for-percussion-again.lisp | 70 +++++++++++++++++++++ programming-music-journal.org | 3 + 2 files changed, 73 insertions(+) create mode 100644 2022-08-28-trying-for-percussion-again.lisp diff --git a/2022-08-28-trying-for-percussion-again.lisp b/2022-08-28-trying-for-percussion-again.lisp new file mode 100644 index 0000000..da5fa1e --- /dev/null +++ b/2022-08-28-trying-for-percussion-again.lisp @@ -0,0 +1,70 @@ + +(in-package #:cl-collider) +(in-package #:cl-patterns) + +;;; so the copied from supercollider examples is +;; { +;; 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 + + +;; and that didn't work +;; (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) + +;;; advice I got: +;; As for your question about the snare synthdef, pulse-divider doesn't actually generate any triggers on its own, it just outputs a trigger every div triggers. So instead you could try something like this: +(in-package #:cl-collider) +(defsynth snare () + (out.ar 0 (white-noise.ar (decay2.ar (pulse-divider.ar (impulse.ar 4) 4 2) 0.005 0.5)))) +;; (synth :snare) +;; (stop) +;; +;; yup. that works (in a loop) +;; now I want to figure out that :free thing + +;;; continuation of advice +;; But if you just want to use snare in a pattern, I would write it like this: + +(defsynth snare ((amp 0.5) (out 0)) + (out.ar out (* amp (white-noise.ar (env-gen.ar (env (list 0 1 0) (list 0.005 0.5)) :act :free))))) + +;; that's a bit longer that I'd like + + +(in-package #:cl-patterns) +(pb :test + :instrument :snare + :dur 1 + ;; :amp (pwhite 0.0 0.5) + :pfindur 4) +;; (play :test) +;; (end :test) +;; +;; ok, that works +;; +;; of the things I really should do, is go and read +;; about Envelope generators, ones that have that :act :free thing +;; +;; one other thing - is to get one or two other drums and mock up a beat + +;; well, if I'm doing this in small steps, let's read about envelope +;; and make first snare synth usable in patterns +;; +;; tried to read just about EnvGen and Env +;; https://doc.sccode.org/Classes/EnvGen.html +;; https://doc.sccode.org/Classes/Env.html +;; +;; then got directed to the Tutorial, good idea to read it, +;; if not previous "first tutorial", then on concepts: +;; http://doc.sccode.org/Tutorials/Streams-Patterns-Events1.html diff --git a/programming-music-journal.org b/programming-music-journal.org index dd4c1cc..5e398f9 100644 --- a/programming-music-journal.org +++ b/programming-music-journal.org @@ -203,3 +203,6 @@ I'm not sure if that's what you were using for that recording, but it may be mor 2. try to get precussion 3. also let's try to get defpackage and stuff ** so, let's copy yesterdays instruments and patterns and try to join them in parallel +* [2022-08-28 Sun] +** ok, got new responses +more about :act :free and nuances of creating with pulse-driver