71 lines
2.3 KiB
Common Lisp
71 lines
2.3 KiB
Common Lisp
|
|
(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
|