Compare commits
5 Commits
c563cae51b
...
babaf1156a
Author | SHA1 | Date |
---|---|---|
|
babaf1156a | |
|
e4a109e45e | |
|
602fc34c0a | |
|
ba4ee2767d | |
|
da7eaa45b5 |
|
@ -181,7 +181,7 @@
|
|||
|
||||
(pb :what-note
|
||||
:note (pseq '(0 1 2 3 4 5 6 7 (0 7)) 1)
|
||||
:octave 3
|
||||
:octave 5
|
||||
:dur (pseq (concatenate 'list (make-list 7 :initial-element 1) '(2 4)))
|
||||
:play-quant 4
|
||||
)
|
||||
|
@ -283,19 +283,24 @@
|
|||
(all-scales)
|
||||
(all-tunings)
|
||||
|
||||
(defparameter *some-chord* (chord "Major Triad"))
|
||||
(chord-notes *some-chord*)
|
||||
|
||||
;;; can I just use chord as :note ?
|
||||
(mapcar #'chord-notes (list (chord "Major Triad") (chord "Minor Triad")))
|
||||
|
||||
(pb :what-predef-chord
|
||||
:note (pseq `((chord "Major Triad") (chord "Minor Triad")))
|
||||
: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) 1)
|
||||
:dur (pseq '(2 2 4))
|
||||
;; :play-quant 4
|
||||
)
|
||||
|
||||
(play :what-predef-chord)
|
||||
(end :what-predef-chord)
|
||||
|
||||
|
||||
(in-package #:cl-collider)
|
||||
(proxy :foo (sin-osc.ar 440 0 0.2))
|
||||
|
||||
|
|
|
@ -0,0 +1,268 @@
|
|||
|
||||
(setq *M1* '(0 2 4))
|
||||
(setq *Min1* '(0 1.5 4))
|
||||
(setq *M3* '(2 4 6))
|
||||
|
||||
(setq *chord* *Min1*)
|
||||
|
||||
(in-package #:cl-patterns)
|
||||
(start-clock-loop :tempo 110/60)
|
||||
(pb :what-chord
|
||||
:note (pseq `(,*m1* ,*min1*))
|
||||
:octave 4
|
||||
:root 2
|
||||
:dur (pseq '(2 2) 1)
|
||||
;; :play-quant 4
|
||||
)
|
||||
|
||||
;; (play :what-chord)
|
||||
;; (end :what-chord)
|
||||
|
||||
(in-package #:cl-collider)
|
||||
(defsynth default ((gate 1) (freq 440) (out 0))
|
||||
(let* ((env (env-gen.kr (asr 0.01 1 0.1) :gate gate :act :free))
|
||||
(sig (sin-osc.ar freq 0 0.2)))
|
||||
(out.ar out (pan2.ar sig 0 env))))
|
||||
|
||||
(server-query-all-nodes) ; not sure how to interpret, but all things submitted to servier to play?
|
||||
|
||||
|
||||
;; ok, reading found article: https://nunotrocado.com/software/cl-collider-tutorial-1.html
|
||||
(defsynth tone ((freq 440) (amp 0.2))
|
||||
(out.ar 0 (saw.ar freq amp)))
|
||||
;; (synth 'tone)
|
||||
;; (stop)
|
||||
|
||||
(defparameter *tone*
|
||||
(synth 'tone
|
||||
:freq (midicps 42)
|
||||
:amp 0.3))
|
||||
(free *tone*)
|
||||
|
||||
|
||||
(defsynth tone-buzz ((freq 440) (amp 0.2))
|
||||
(out.ar 0 (saw.ar (let ((detune (* freq 0.01)))
|
||||
(list (- freq detune) (+ freq detune)))
|
||||
(/ amp 2))))
|
||||
|
||||
;; (let ((node (synth 'tone-buzz)))
|
||||
;; (sleep 2)
|
||||
;; (free node))
|
||||
|
||||
(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)
|
||||
|
||||
;; (in-package #:cl-patterns)
|
||||
(all-instruments)
|
||||
(pb :what-instrumented
|
||||
:intrument :tone-pluck
|
||||
;; :note (pseq `(,*m1* ,*min1*))
|
||||
:note (pseq '(0 3 7) 1)
|
||||
:octave 4
|
||||
:root 2
|
||||
:dur (pseq '(2 2) )
|
||||
;; :play-quant 4
|
||||
)
|
||||
|
||||
;; (play :what-instrumented)
|
||||
;; (stop :what-instrumented)
|
||||
|
||||
;;; yo, I think I understood that predef chords stuff:
|
||||
|
||||
(pb :what-predef-chord
|
||||
:instrument :tone-buzz
|
||||
: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-try-instrument
|
||||
:instrument :tone-pluck
|
||||
:note (pseq '(1 2 3 7) 1)
|
||||
:octave 4
|
||||
:root 2
|
||||
:dur (pseq '(2 2 4))
|
||||
;; :play-quant 4
|
||||
)
|
||||
|
||||
|
||||
;; (play :what-try-instrument)
|
||||
;; (stop :what-try-instrument)
|
||||
|
||||
(pb :what-instrumented-2-maybe
|
||||
:instrument :tone-pluck
|
||||
;; :note (pseq `(,*m1* ,*min1*))
|
||||
:note (pseq '(0 3 7) 1)
|
||||
:octave 4
|
||||
:root 2
|
||||
:dur (pseq '(2 2) )
|
||||
;; :play-quant 4
|
||||
)
|
||||
|
||||
;; (play :what-instrumented-2-maybe)
|
||||
;; (stop :what-instrumented-2-maybe)
|
||||
|
||||
|
||||
|
||||
;;; now let's try to get some synths for percussions?
|
||||
|
||||
|
||||
|
||||
|
||||
;; copied from https://github.com/defaultxr/cl-patterns/blob/master/doc/supercollider-example.lisp
|
||||
|
||||
(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-percussion
|
||||
:instrument :kik
|
||||
;; :note (pseq `(,*m1* ,*min1*))
|
||||
:note (pseq '(0 3 7) 1)
|
||||
:octave 4
|
||||
:root 2
|
||||
:dur (pseq '(2 2) )
|
||||
;; :play-quant 4
|
||||
)
|
||||
;; (play :what-percussion)
|
||||
;; (stop :what-percussion)
|
||||
|
||||
;; well, I don't understand, do I go read supercollider docs?
|
||||
;; about EnvGen SinOsc ?
|
||||
;; woa, there's old archived https://github.com/madskjeldgaard/awesome-supercollider
|
||||
;;; let's try to convert drum-kik https://github.com/everythingwillbetakenaway/Synthdefs/blob/master/drum_kick.scd
|
||||
;; (
|
||||
;; SynthDef(\drum_kick, {
|
||||
;; arg freq=440, gate=1, amp=0.5, source,pan = 0.0 ;
|
||||
;; source =
|
||||
;; Pan2.ar(
|
||||
;; SinOsc.ar(EnvGen.kr(Env.perc(0.0001, 1.5, 1, -200), gate, 1000, 45, doneAction:2), 1, 1) +
|
||||
;; ((BPF.ar([GrayNoise.ar(6),GrayNoise.ar(6)],EnvGen.kr(Env.perc(0.001, 0.3, 1, -200), gate, 6000, 70), 1.5)).distort * Line.kr(0.3,0,0.1))
|
||||
;; *
|
||||
;; EnvGen.kr(Env.perc(0.0001, 0.09, amp, 8)),0);
|
||||
;; Out.ar(0, source);
|
||||
;; }).add;
|
||||
;; )
|
||||
;; Synth(\drum_kick);
|
||||
|
||||
(in-package #:cl-collider)
|
||||
|
||||
(defsynth drum-kik ((freq 440) (out 0) (gate 1) (amp 0.5) (pan 0.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))
|
||||
(pan (pan2.ar sig 0 env)))
|
||||
(out.ar out pan)))
|
||||
(synth :drum-kik)
|
||||
(cl-patterns::all-instruments)
|
||||
|
||||
;;; ok, fuck that let's play
|
||||
;; just do some percussion with existing kik and chord progressions, and maybe a melody
|
||||
|
||||
|
||||
(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) ; ok, too hard again, want to finish something and go on
|
||||
:play-quant 4)
|
||||
|
||||
;; (play :what-basic-percussion)
|
||||
;; (stop :what-basic-percussion)
|
||||
|
||||
;; how do I now join both of these?
|
||||
|
||||
(pb :first-composition (ppar (list :what-predef-chord :what-basic-percussion))) ; bs, wtf
|
||||
|
||||
(next-upto-n (ppar (list (pbind :dur (pn 1/2 4))
|
||||
(pbind :dur (pn 2/3 4)))))
|
||||
|
||||
(next-upto-n (ppar (list :what-basic-percussion :what-predef-chord)))
|
||||
|
||||
;; (play :first-composition)
|
||||
;; (stop :first-composition)
|
||||
|
||||
;; (next-upto-n (pmeta :pattern (pseq (list :what-basic-percussion :what-predef-chord) 1) :sync 2))
|
||||
|
||||
;; god, I have no idea how to have two patterns play at the same time =C
|
||||
|
||||
;; (play (list :what-basic-percussion :what-predef-chord))
|
||||
;; (stop (list :what-basic-percussion :what-predef-chord))
|
||||
;;
|
||||
;; welp that workds
|
||||
;; bs, but maybe I'll put it into file and get a break already
|
||||
|
||||
(in-package #:cl-collider)
|
||||
|
||||
;; from https://github.com/byulparan/cl-collider
|
||||
;;; write a single channel to disk
|
||||
|
||||
;; we can write to buffer number out_buf_num by reading in from the 0 bus
|
||||
(defsynth disk_writer ((out_buf_num 99))
|
||||
(disk-out.ar out_buf_num (in.ar 0)))
|
||||
|
||||
(setf mybuffer (buffer-alloc (expt 2 17)))
|
||||
mybuffer
|
||||
|
||||
;; start a disk_writer synth
|
||||
(setf writer_0 (synth 'disk_writer))
|
||||
|
||||
;; make it output to buffer you allocated
|
||||
(ctrl writer_0 :out_buf_num (bufnum mybuffer))
|
||||
|
||||
;; continuously write the buffer contents to a file
|
||||
(buffer-write mybuffer "/tmp/foo.aiff" :leave-open-p t)
|
||||
|
||||
;; now play whatever sounds you like
|
||||
|
||||
;; e.g.
|
||||
(proxy :blah (sin-osc.ar 440))
|
||||
(free :blah)
|
||||
|
||||
|
||||
;; then when you are done
|
||||
|
||||
;; stop the disk_writer synth
|
||||
(free writer_0)
|
||||
|
||||
;; close and free the buffer
|
||||
(buffer-close mybuffer)
|
||||
(buffer-free mybuffer)
|
||||
|
||||
|
||||
;; then you can play what you recorded with a utility like mpv:
|
||||
;; mpv /tmp/foo.aiff
|
||||
|
||||
|
||||
|
||||
|
||||
;; (cl-patterns:stop t)
|
|
@ -0,0 +1,171 @@
|
|||
|
||||
(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)
|
|
@ -0,0 +1,204 @@
|
|||
|
||||
(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 8) 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:
|
||||
|
||||
(in-package #:cl-collider)
|
||||
(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)))))
|
||||
|
||||
;; (synth :snare)
|
||||
;; (stop)
|
||||
;; 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
|
||||
|
||||
|
||||
;;; So, env-gen takes in lists for intensity and timings, from that builds output signal that can be used in other gens?
|
||||
|
||||
(in-package #:cl-collider)
|
||||
(defsynth env-test-1 ((amp 0.5) (out 0))
|
||||
(out.ar out (* amp (sin-osc.ar 440.0 0.0 (env-gen.ar (env (list 0 1 0) (list 0.005 0.5)) :act :free)))))
|
||||
|
||||
;; (synth :env-test-1)
|
||||
;; (stop)
|
||||
|
||||
(in-package #:cl-collider)
|
||||
(defsynth env-test-1-1 ((amp 0.5) (out 0))
|
||||
(out.ar out (* amp (sin-osc.ar 440.0 0.0 (env-gen.ar (env (list 0 1 0.1 0) (list 0.005 0.01 0.5)) :act :free)))))
|
||||
|
||||
;; (synth :env-test-1-1)
|
||||
;; (stop)
|
||||
(in-package #:cl-collider)
|
||||
(defsynth env-test-2 ((amp 0.5) (out 0) (start 100) (middle 400) (end 200))
|
||||
(out.ar out (* amp (sin-osc.ar (env-gen.ar (env (list start middle end) (list 0.5 1.0)) :act :free)))))
|
||||
|
||||
;; (synth :env-test-2)
|
||||
;; (synth :env-test-2 :start 200 :middle 200 :end 200)
|
||||
;; (synth :env-test-2 :start 200 :middle 300 :end 200)
|
||||
;; (synth :env-test-2 :start 100 :middle 400 :end 100)
|
||||
;; (stop)
|
||||
;;
|
||||
;; so, yes, env-gen can define stream of numbers by times, and the numbers can be used for example in sin-osc.ar frequency input
|
||||
|
||||
;; now, how could I make other percussions? attempting to look at the example from SC
|
||||
|
||||
;; {
|
||||
;; 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
|
||||
;;
|
||||
;; so let's try bdrum?
|
||||
|
||||
(in-package #:cl-collider)
|
||||
(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)))))
|
||||
|
||||
;; (synth :bdrum :amp 1)
|
||||
|
||||
|
||||
(in-package #:cl-collider)
|
||||
(defsynth snare ((amp 0.5) (out 0))
|
||||
(out.ar out (* amp (white-noise.ar (env-gen.ar (env (list 0 1 0.3 0) (list 0.005 0.01 0.5)) :act :free)))))
|
||||
|
||||
;; (synth :snare)
|
||||
|
||||
(in-package #:cl-collider)
|
||||
(defsynth hihat ((amp 0.5) (out 0))
|
||||
(out.ar out (* amp (hpf.ar (white-noise.ar 1) 10000) (env-gen.ar (env (list 0 1 0) (list 0.005 0.5)) :act :free))))
|
||||
;; hihat = HPF.ar(WhiteNoise.ar(1), 10000) * Decay2.ar(tempo, 0.005, 0.5);
|
||||
;; (synth :hihat)
|
||||
|
||||
;;; whoa, now I can try to combine these in a pattern!
|
||||
;; let's just copy another pattern with my instruments maybe?
|
||||
|
||||
(in-package #:cl-patterns)
|
||||
(pb :foo ;; define a new pattern named :foo
|
||||
:instrument :bdrum ;; use the :kik synth we defined above
|
||||
:play-quant 4 ;; make sure the pattern will only start on a beat that is divisible by 4, to stay in sync
|
||||
:dur 2 ;; give each event a duration of 1 beat
|
||||
:pfin 2 ;; limit the length of the pattern to 4 events (the default is infinite events)
|
||||
)
|
||||
;; (play :foo)
|
||||
;; (end :foo)
|
||||
|
||||
(pb :fee ;; define a new pattern named :foo
|
||||
:instrument :hihat ;; use the :kik synth we defined above
|
||||
:play-quant 4 ;; make sure the pattern will only start on a beat that is divisible by 4, to stay in sync
|
||||
:dur 3 ;; give each event a duration of 1 beat
|
||||
:pfin 1 ;; limit the length of the pattern to 4 events (the default is infinite events)
|
||||
)
|
||||
;; (play :fee)
|
||||
;; (end :fee)
|
||||
|
||||
(pb :fum ;; define a new pattern named :foo
|
||||
:instrument :snare ;; use the :kik synth we defined above
|
||||
:play-quant 4 ;; make sure the pattern will only start on a beat that is divisible by 4, to stay in sync
|
||||
:dur 0.5 ;; give each event a duration of 1 beat
|
||||
:pfin 8 ;; limit the length of the pattern to 4 events (the default is infinite events)
|
||||
:amp 0.1
|
||||
)
|
||||
;; (play :fum)
|
||||
;; (end :fum)
|
||||
|
||||
(pdef :all-parallel (ppar (list (pdef :foo) (pdef :fee) (pdef :fum))))
|
||||
;; (play :all-parallel)
|
||||
;; (end :all-parallel)
|
||||
;;
|
||||
|
||||
;; (in-package #:cl-patterns)
|
||||
;; (render (pdef :all-parallel) "/tmp/perc-1.aiff" :dur 16)
|
||||
;; doesn't work for some reason
|
||||
;; let's write as I did previously, and maybe ask a question later
|
||||
|
||||
(in-package #:cl-collider)
|
||||
(defsynth disk_writer ((out_buf_num 99))
|
||||
(disk-out.ar out_buf_num (in.ar 0)))
|
||||
|
||||
(setf mybuffer (buffer-alloc (expt 2 17)))
|
||||
mybuffer
|
||||
|
||||
;; start a disk_writer synth
|
||||
(setf writer_0 (synth 'disk_writer))
|
||||
|
||||
;; make it output to buffer you allocated
|
||||
(ctrl writer_0 :out_buf_num (bufnum mybuffer))
|
||||
|
||||
;; continuously write the buffer contents to a file
|
||||
(buffer-write mybuffer "/tmp/foo.aiff" :leave-open-p t)
|
||||
|
||||
;; now play whatever sounds you like
|
||||
|
||||
;; stop the disk_writer synth
|
||||
(free writer_0)
|
||||
|
||||
;; close and free the buffer
|
||||
(buffer-close mybuffer)
|
||||
(buffer-free mybuffer)
|
||||
;; wow, now that's a success
|
||||
;; question on how to write
|
||||
;; and what else?
|
|
@ -0,0 +1,317 @@
|
|||
;;; copy from previous day
|
||||
|
||||
(in-package #:cl-collider)
|
||||
(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)))))
|
||||
|
||||
;; (synth :bdrum :amp 1)
|
||||
|
||||
(in-package #:cl-collider)
|
||||
(defsynth snare ((amp 0.5) (out 0))
|
||||
(out.ar out (* amp (white-noise.ar (env-gen.ar (env (list 0 1 0.3 0) (list 0.005 0.01 0.5)) :act :free)))))
|
||||
|
||||
;; (synth :snare)
|
||||
|
||||
(in-package #:cl-collider)
|
||||
(defsynth hihat ((amp 0.5) (out 0))
|
||||
(out.ar out (* amp (hpf.ar (white-noise.ar 1) 10000) (env-gen.ar (env (list 0 1 0) (list 0.005 0.5)) :act :free))))
|
||||
;; hihat = HPF.ar(WhiteNoise.ar(1), 10000) * Decay2.ar(tempo, 0.005, 0.5);
|
||||
;; (synth :hihat)
|
||||
|
||||
;;; whoa, now I can try to combine these in a pattern!
|
||||
;; let's just copy another pattern with my instruments maybe?
|
||||
|
||||
(in-package #:cl-patterns)
|
||||
(pb :foo ;; define a new pattern named :foo
|
||||
:instrument :bdrum ;; use the :kik synth we defined above
|
||||
:play-quant 4 ;; make sure the pattern will only start on a beat that is divisible by 4, to stay in sync
|
||||
:dur 2 ;; give each event a duration of 1 beat
|
||||
:pfin 2 ;; limit the length of the pattern to 4 events (the default is infinite events)
|
||||
)
|
||||
;; (play :foo)
|
||||
;; (end :foo)
|
||||
|
||||
(pb :fee ;; define a new pattern named :foo
|
||||
:instrument :hihat ;; use the :kik synth we defined above
|
||||
:play-quant 4 ;; make sure the pattern will only start on a beat that is divisible by 4, to stay in sync
|
||||
:dur 1 ;; give each event a duration of 1 beat
|
||||
:pfin 1 ;; limit the length of the pattern to 4 events (the default is infinite events)
|
||||
)
|
||||
;; (play :fee)
|
||||
;; (end :fee)
|
||||
|
||||
(pb :fum ;; define a new pattern named :foo
|
||||
:instrument :snare ;; use the :kik synth we defined above
|
||||
:play-quant 4 ;; make sure the pattern will only start on a beat that is divisible by 4, to stay in sync
|
||||
:dur 0.5 ;; give each event a duration of 1 beat
|
||||
:pfin 8 ;; limit the length of the pattern to 4 events (the default is infinite events)
|
||||
:amp 0.1
|
||||
)
|
||||
;; (play :fum)
|
||||
;; (end :fum)
|
||||
|
||||
(pdef :all-parallel (ppar (list (pdef :foo) (pdef :fee) (pdef :fum))))
|
||||
;; (play :all-parallel)
|
||||
;; (end :all-parallel)
|
||||
|
||||
;;; new day.
|
||||
;; let's think more about it.
|
||||
;; my guess is that things don't align properly
|
||||
|
||||
|
||||
;; another new thing, I guess here drum is every 2nd beat, hihat every beat and snare double beats
|
||||
|
||||
;; let's try another beat by drum?
|
||||
;; tuum, tu-tu-tum, tum-tum-tum
|
||||
|
||||
(in-package #:cl-patterns)
|
||||
;; 2 tacts of 4 beats each
|
||||
(pb :more-drum ;; define a new pattern named :more-drum
|
||||
:instrument :bdrum ;; use the :kik synth we defined above
|
||||
;; :play-quant 4 ;; make sure the pattern will only start on a beat that is divisible by 4, to stay in sync
|
||||
:dur (pseq '(2.5 0.5 1 1 1 1 1) 1)
|
||||
)
|
||||
;; (play :more-drum)
|
||||
;; (end :more-drum)
|
||||
;; (stop :more-drum)
|
||||
;;
|
||||
;; what I need is seq as duration?
|
||||
;;
|
||||
;; ok. what kind of plates I need?
|
||||
;; maybe quick 6 pause 2, repeat
|
||||
(pb :hihat-aligned-with-long-notes-to-4
|
||||
:instrument :hihat
|
||||
:play-quant 4 ; that helps to start this rhythm not on current beat, but on some beat in future
|
||||
; to sync with others, ok.
|
||||
; but only works for startup? not for aligning after end of 1 cycle?
|
||||
:dur (pseq '(1 0.5 0.5 2) 1)
|
||||
:amp (pseq '(1 0.5 0.5 0.5) 1)
|
||||
;; how to make pause for 2?
|
||||
)
|
||||
;; (play :hihat-aligned-with-long-notes-to-4)
|
||||
;; (end :hihat-aligned-with-long-notes-to-4)
|
||||
|
||||
;; so, I'd like a pause in the beginning?
|
||||
;; like 2 beat pause in the beginning, start with 3rd beat?
|
||||
;; would aligning work for that?
|
||||
;;
|
||||
;; i don't think so.
|
||||
;;
|
||||
;; then let's try to read more articles on patterns (in SC)?
|
||||
;; maybe there will something about pauses
|
||||
;;
|
||||
;; or, let's finish this with long hihat in beginning
|
||||
|
||||
;; maybe 1 drum per beat will help me understand :play-quant better?
|
||||
;; i tried setting it to 16 for hihat and it still repeated itself without stop
|
||||
;; while I expected it to play once every two 4 tacts
|
||||
(pb :metered-beat
|
||||
:instrument :bdrum
|
||||
:dur 1
|
||||
:play-quant 4 ; skip first two beats?
|
||||
:amp (pseq '(1 0.5 0.5 0.5) 1))
|
||||
;; (play :metered-beat)
|
||||
;; (stop :metered-beat)
|
||||
;; I could try adding accents?
|
||||
|
||||
|
||||
(pb :single-hihat
|
||||
:instrument :hihat
|
||||
:dur (pseq '(1) 1)
|
||||
:play-quant 4)
|
||||
;; (play :single-hihat)
|
||||
;; (end :single-hihat)
|
||||
;; (stop :single-hihat)
|
||||
|
||||
;; so, it still repeats? hmmmmmm
|
||||
|
||||
;; ok, I have no idea how to alighn things with pauses
|
||||
;;
|
||||
;; let's go on and read http://doc.sccode.org/Tutorials/Streams-Patterns-Events3.html
|
||||
;; so Pseq would have offset? would that be used for pauses in between?
|
||||
;; and "pauses during pattern" could be simulated with "longer beats", even though how do I separate that from long-notes?
|
||||
|
||||
;; well, from
|
||||
;; pb :hihat-aligned-with-long-notes-to-4
|
||||
;; pb :single-hihat
|
||||
;; it seems that :play-quant helps to start-up new pattern on particular beat, for example 4th
|
||||
;; (starting from 0 that's start of a new tact in 4/4 meter)
|
||||
;; but doesn't help if pattern is less than 4 beats to align each repetition with start of new tact
|
||||
|
||||
;; (midinote-freq) ; this is for writing melodies
|
||||
|
||||
;;; so, some synths from article http://doc.sccode.org/Tutorials/Streams-Patterns-Events3.html
|
||||
;; (
|
||||
;; SynthDef( \help_SPE3_Mridangam, { |out, t_amp|
|
||||
;; var sound;
|
||||
|
||||
;; sound = Resonz.ar(
|
||||
;; WhiteNoise.ar(70) * Decay2.kr( t_amp, 0.002, 0.1 ),
|
||||
;; 60.midicps,
|
||||
;; 0.02,
|
||||
;; 4
|
||||
;; ).distort * 0.4;
|
||||
|
||||
;; Out.ar(out, sound);
|
||||
;; DetectSilence.ar(sound, doneAction: Done.freeSelf);
|
||||
;; }).add;
|
||||
|
||||
;; (in-package #:cl-collider)
|
||||
;; (defsynth help_spe3_mridangam ((amp 0.5) (out 0))
|
||||
;; (let* ((sound '())))
|
||||
;; (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)))))
|
||||
|
||||
;; ;; (synth ::bdrum)
|
||||
;; ;; (stop)
|
||||
;;
|
||||
;; well, it seems that these generators are not present in the cl library, that's ok
|
||||
;;
|
||||
;; should I try doing pauses by setting amptitude to 0?
|
||||
|
||||
(pb :single-hihat
|
||||
:instrument :hihat
|
||||
:dur (pseq '(1) )
|
||||
:amp (pseq '(0.5 0 0 0) 1)
|
||||
:play-quant 4)
|
||||
;; (play :single-hihat)
|
||||
;; (end :single-hihat)
|
||||
;; (stop :single-hihat)
|
||||
|
||||
;;; cool, i like that.
|
||||
;; so initial thing - metered beat and attempt at hiheads with pauses
|
||||
(pdef :metered-and-first-hihead
|
||||
(ppar (list (pdef :metered-beat) (pdef :hihat-aligned-with-long-notes-to-4))))
|
||||
;; (play :metered-and-first-hihead)
|
||||
;; (end :metered-and-first-hihead)
|
||||
|
||||
;;; trying quick 3-hihead, aligned with pauses
|
||||
(pb :hihead-3-quick-with-pauses-to-tact
|
||||
:instrument :hihat
|
||||
:play-quant 4 ; that helps to start this rhythm not on current beat, but on some beat in future
|
||||
; to sync with others, ok.
|
||||
; but only works for startup? not for aligning after end of 1 cycle?
|
||||
:dur (pseq '(1 0.5 0.5 0.5 1.5) 1)
|
||||
:amp (pseq '(0 0.5 0.5 0.5 0) 1)
|
||||
;; how to make pause for 2?
|
||||
)
|
||||
;; (play :hihead-3-quick-with-pauses-to-tact)
|
||||
;; (end :hihead-3-quick-with-pauses-to-tact)
|
||||
|
||||
(pdef :metered-and-three-quick
|
||||
(ppar (list (pdef :metered-beat) (pdef :hihead-3-quick-with-pauses-to-tact))))
|
||||
;; (play :metered-and-three-quick)
|
||||
;; (end :metered-and-three-quick)
|
||||
|
||||
(pb :pause-tact
|
||||
:instrument :hihat ; without instrument - :amp doesn't do anything
|
||||
:dur (pseq '(4) 1) ; just having 4 - repeats endlessly
|
||||
:amp 0)
|
||||
;; (play :pause-tact)
|
||||
;; (end :pause-tact)
|
||||
;; (stop :pause-tact)
|
||||
|
||||
;;; now let's add a pause tact
|
||||
(pdef :hihead-3-quick-and-pause
|
||||
(pseq (list
|
||||
(pdef :hihead-3-quick-with-pauses-to-tact)
|
||||
(pdef :pause-tact)) 1))
|
||||
;; (play :hihead-3-quick-and-pause)
|
||||
;; (end :hihead-3-quick-and-pause)
|
||||
;; (stop :hihead-3-quick-and-pause)
|
||||
|
||||
;;; well, that works somewhat.
|
||||
;; let's add this to my "more complicated drum line"
|
||||
(pdef :more-complicated-drum-and-three-quick-hiheads
|
||||
(ppar (list (pdef :more-drum) (pdef :hihead-3-quick-and-pause))))
|
||||
;; (play :more-complicated-drum-and-three-quick-hiheads)
|
||||
;; (end :more-complicated-drum-and-three-quick-hiheads)
|
||||
;;
|
||||
;;; yay, I guess!
|
||||
|
||||
;;; let's play all three in order?
|
||||
(pdef :all-from-today-in-order
|
||||
(pseq (list
|
||||
(pseq (list (pdef :metered-and-first-hihead)) 4)
|
||||
(pseq (list (pdef :all-parallel)) 3)
|
||||
(pseq (list (pdef :more-complicated-drum-and-three-quick-hiheads)) 4)
|
||||
(pseq (list (pdef :all-parallel)) 3)) 1))
|
||||
;; (play :all-from-today-in-order)
|
||||
;; (end :all-from-today-in-order)
|
||||
;; (stop :all-from-today-in-order)
|
||||
|
||||
;;; now let's try again to write this down with a more advised function
|
||||
|
||||
;; (in-package #:cl-collider)
|
||||
;; (in-package #:cl-patterns)
|
||||
;; (render (pdef :metered-and-three-quick) "/tmp/attempt-1.wav" :dur 4)
|
||||
;; let's copy the error
|
||||
;; There is no applicable method for the generic function
|
||||
;; #<STANDARD-GENERIC-FUNCTION CL-PATTERNS::BACKEND-INSTRUMENT-CONTROLS (1)>
|
||||
;; when called with arguments
|
||||
;; (:BDRUM (EVENT :INSTRUMENT :BDRUM :DUR 2.5 :DELTA 0)).
|
||||
;; [Condition of type SB-PCL::NO-APPLICABLE-METHOD-ERROR]
|
||||
;;
|
||||
;; with other pattern:
|
||||
;; There is no applicable method for the generic function
|
||||
;; #<STANDARD-GENERIC-FUNCTION CL-PATTERNS::BACKEND-INSTRUMENT-CONTROLS (1)>
|
||||
;; when called with arguments
|
||||
;; (:BDRUM
|
||||
;; (EVENT :INSTRUMENT :BDRUM :DUR 1 :PLAY-QUANT (4) :AMP 1 :DELTA 0)).
|
||||
;; [Condition of type SB-PCL::NO-APPLICABLE-METHOD-ERROR]
|
||||
|
||||
;;; so let's write them with previous writing method?
|
||||
;; and save a link to it?
|
||||
|
||||
;;; oh, but there's "non-real time rendering" in cl-collider
|
||||
;; let's try that? I don't see how to connect it with the patterns
|
||||
;;
|
||||
;; so https://github.com/byulparan/cl-collider#record-audio-output it is
|
||||
;;; write a single channel to disk
|
||||
|
||||
;; we can write to buffer number out_buf_num by reading in from the 0 bus
|
||||
(in-package #:cl-collider)
|
||||
|
||||
(defsynth disk_writer ((out_buf_num 99))
|
||||
(disk-out.ar out_buf_num (in.ar 0)))
|
||||
|
||||
(setf mybuffer (buffer-alloc (expt 2 17)))
|
||||
mybuffer
|
||||
|
||||
;; start a disk_writer synth
|
||||
(setf writer_0 (synth 'disk_writer))
|
||||
|
||||
;; make it output to buffer you allocated
|
||||
(ctrl writer_0 :out_buf_num (bufnum mybuffer))
|
||||
|
||||
;; continuously write the buffer contents to a file
|
||||
(buffer-write mybuffer "/tmp/all-from-today-in-order.aiff" :leave-open-p t)
|
||||
|
||||
(in-package #:cl-patterns)
|
||||
;; now play whatever sounds you like
|
||||
(play :all-parallel)
|
||||
(end :all-parallel)
|
||||
(play :metered-and-first-hihead)
|
||||
(end :metered-and-first-hihead)
|
||||
(play :more-complicated-drum-and-three-quick-hiheads)
|
||||
(end :more-complicated-drum-and-three-quick-hiheads)
|
||||
(play :all-from-today-in-order)
|
||||
(end :all-from-today-in-order)
|
||||
|
||||
;; e.g.
|
||||
(proxy :blah (sin-osc.ar 440))
|
||||
(free :blah)
|
||||
|
||||
|
||||
;; then when you are done
|
||||
|
||||
(in-package #:cl-collider)
|
||||
;; stop the disk_writer synth
|
||||
(free writer_0)
|
||||
|
||||
;; close and free the buffer
|
||||
(buffer-close mybuffer)
|
||||
(buffer-free mybuffer)
|
||||
|
||||
|
||||
;; then you can play what you recorded with a utility like mpv:
|
||||
;; mpv /tmp/foo.aiff
|
|
@ -69,3 +69,159 @@ do I go to cl-collider package for explanation of synths and such?
|
|||
- some combined sounds, which don't sound nice
|
||||
- maybe reliant startup procedure
|
||||
- and attempting to run chords hangs it all
|
||||
** cl-patterns docs:
|
||||
https://github.com/defaultxr/cl-patterns/tree/master/doc
|
||||
that's all files
|
||||
* [2022-08-20 Sat]
|
||||
** now I'd like to create an instrument for which chords would sound nice
|
||||
and after than some kind of percussion things
|
||||
** cool! that was just my type :instument instead of :instrument
|
||||
and article on cl-collider now helps with some cool synhts, like chord strum
|
||||
#+begin_src common-lisp
|
||||
(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)
|
||||
|
||||
(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)
|
||||
;; (stop :what-predef-chord)
|
||||
|
||||
#+end_src
|
||||
|
||||
yay.
|
||||
** now let's figure out percussions?
|
||||
** searching : "super collider percussion synth"
|
||||
got all sorts of cool results:
|
||||
*** main page of supercollider: https://supercollider.github.io/
|
||||
*** awesome list : https://github.com/madskjeldgaard/awesome-supercollider#synthdefs
|
||||
and it has link to defs!
|
||||
*** defs : https://github.com/everythingwillbetakenaway/Synthdefs
|
||||
for example a drum kik which I'd try to convert?
|
||||
https://github.com/everythingwillbetakenaway/Synthdefs/blob/master/drum_kick.scd
|
||||
** to file https://github.com/byulparan/cl-collider#record-audio-output
|
||||
whoh
|
||||
** now for the well deserved fucking rest
|
||||
** things I want to figure out in the future:
|
||||
1. joining patterns in parallel - percussion + rythm + solo
|
||||
2. having 3 beats in percussion but aligning to 4 beats
|
||||
3. getting cool instruments from existing repos for supercollider
|
||||
* [2022-08-21 Sun]
|
||||
** now, I got another response!
|
||||
Yes unfortunately it's not always easy to directly translate synthdefs from SC into cl-collider. Some of the UGens are named differently (i.e. SinOsc in SC is sin-osc in cl-collider). The UGens are defined in cl-collider with defugen though, so you could do a grep or similar on the library to get a list of the defined ugens.
|
||||
Regarding the "attributes" you mention, do you mean the arguments for each ugen? If so, are you using Emacs or another editor? I believe Emacs should show the function signature in the echo area at the bottom of the screen if you're in the right package (i.e. you need to have an in-package form in your file)
|
||||
If you have a specific synthdef you're having trouble translating, feel free to link me to it and I'll see if I can translate it for you as an example
|
||||
Oh I see you do have an in-package in the example you posted. It might not be showing the function signature since you're doing in-package cl-patterns but the cl-patterns package doesn't include the UGens. so you might have to make a new package that :uses cl-patterns and cl-collider, so it has all the ugens as well as all the patterns.
|
||||
efim
|
||||
Apart from guidance on how to better translate SC definition of sync into DEFSYNTH attributes to get other instruments
|
||||
|
||||
could you help me understand how to join patterns?
|
||||
|
||||
I created two
|
||||
|
||||
(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
|
||||
)
|
||||
|
||||
|
||||
(pb :what-basic-percussion
|
||||
:instrument :kik
|
||||
:note 0
|
||||
:dur (pseq '(1) 1)
|
||||
:play-quant 4)
|
||||
and wanted to join them to play in parallel as a pattern
|
||||
|
||||
and I think I'm getting lost in understanding types, what is pattern, what isn't
|
||||
|
||||
because there's an example for PPAR:
|
||||
|
||||
(next-upto-n (ppar (list (pbind :dur (pn 1/2 4))
|
||||
(pbind :dur (pn 2/3 4)))))
|
||||
but doing
|
||||
(next-upto-n (ppar (list :what-basic-percussion :what-predef-chord)))
|
||||
|
||||
doesn't yield sound events
|
||||
|
||||
so maybe I can't reference patterns by name they get in PB ?
|
||||
|
||||
would I need to use PBIND to define both of previous patterns,
|
||||
set them to some variables,
|
||||
and then they could be used as subpatterns?
|
||||
|
||||
For now I already got tired with how much there is to learn,
|
||||
I've set up "live recording" from (next-upto-n (ppar (list :what-basic-percussion :what-predef-chord)))
|
||||
|
||||
and celebrate initial success, theres 9 second pause in the beginning, but that's my first composition with so much to learn
|
||||
|
||||
next-upto-n won't play any sounds on its own, it's just used to get the resulting event objects from the patterns. You'd still need to call play on whatever pattern you define. So something like this could work:
|
||||
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
(pdef :foo (ppar (list (pdef :what-predef-chord)
|
||||
(pdef :what-basic-percussion))))
|
||||
|
||||
(play (pdef :foo))
|
||||
Oh, I see what you meant. Yeah, it looks like ppar doesn't accept just the pattern names, so you would have to do this instead:
|
||||
|
||||
1
|
||||
(next-upto-n (ppar (list (pdef :what-basic-percussion) (pdef :what-predef-chord))))
|
||||
It probably should accept the pattern names directly though, so I will see about fixing that soon.
|
||||
When you define a pattern like (pb :foo ...) it's basically the same as doing (pdef :foo (pbind ...)). So if you define a pattern with pb you can refer back to it with pdef later on.
|
||||
Today
|
||||
modula
|
||||
efim
|
||||
foo.aiff (4.74 MB)
|
||||
very nice! definite good first steps, glad to hear you're making progress :)
|
||||
it does take some learning but hopefully it will make more sense as you gain familiarity with it
|
||||
I'm trying to make cl-patterns as intuitive as possible, but there are definitely some rough edges i don't notice until they're pointed out.
|
||||
Oh, also, if you want to record a pattern, you might be interested in the render function. Basically you can do something like (render (pdef :your-pattern) "/path/to/output.wav" :dur 4) and it will save 4 beats of :your-pattern to /path/to/output.wav.
|
||||
I'm not sure if that's what you were using for that recording, but it may be more convenient if you were using something else.
|
||||
** ok, so let's search github for synthdef ?
|
||||
** now I want to do what?
|
||||
1. try out parallel
|
||||
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
|
||||
** and I think I understand Env(elope) better now, yay?
|
||||
* [2022-09-01 Thu]
|
||||
** DONE so, I do have some percussion rhythm, let's try something more interesting?
|
||||
** DONE and try to write with the adviced better function
|
||||
** and maybe try to get other instruments
|
||||
** new thing! if I keep pattern playing and reeval it's definition - new definition would start playing, cool
|
||||
** message
|
||||
Over the weekends I've learned quite a bit!
|
||||
|
||||
Previous questions were definitely more pointed to me figuring out how to do synthdefs that could be used as :instrument in patterns
|
||||
|
||||
Now I kind of understand part of EnvGen (Envelope) - it takes two lists, and emits values of first list by timeperiods from the second list
|
||||
and that can be fed into any part of other generator - as frequency for SIN-OSC, or amptitue
|
||||
|
||||
past sunday with your help I've figured out how to make percussion instruments from SuperCollider example and done simplest regular beat
|
||||
|
||||
Today I tried to figure out more complicated beats, and how to join different lines with pauses
|
||||
|
||||
Still lots to do, but will share what I've accomplished in hopes that it returns you a little bit of excitement your project brings
|
||||
|
|
Loading…
Reference in New Issue