From be0020e38e347a385c15393fe0ca764342dba3cc Mon Sep 17 00:00:00 2001 From: efim Date: Fri, 19 Aug 2022 12:09:47 +0000 Subject: [PATCH] renames, and frustration at inconsistent work --- ... => 2022-08-12-setting-up-cl-collider.lisp | 26 ++++ ...p => 2022-08-12-supercollider-example.lisp | 6 +- ... => 2022-08-12-trying-includine-sound.lisp | 0 2022-08-19-patterns-guide.lisp | 116 ++++++++++++++++++ programming-music-journal.org | 37 ++++++ 5 files changed, 183 insertions(+), 2 deletions(-) rename setting-up-cl-collider.lisp => 2022-08-12-setting-up-cl-collider.lisp (53%) rename supercollider-example.lisp => 2022-08-12-supercollider-example.lisp (96%) rename trying-includine-sound.lisp => 2022-08-12-trying-includine-sound.lisp (100%) create mode 100644 2022-08-19-patterns-guide.lisp diff --git a/setting-up-cl-collider.lisp b/2022-08-12-setting-up-cl-collider.lisp similarity index 53% rename from setting-up-cl-collider.lisp rename to 2022-08-12-setting-up-cl-collider.lisp index cd4e78a..3cd82d4 100644 --- a/setting-up-cl-collider.lisp +++ b/2022-08-12-setting-up-cl-collider.lisp @@ -20,9 +20,35 @@ (proxy :foo ()) +;; lets go to 4th +;; https://defaultxr.github.io/cl-collider-tutorial/04-further-soundmaking.html +;; (defsynth drum ((freq 3000)) (let* ((env (env-gen.ar (perc 0.001 0.1) :act :free)) (sig (lpf.ar (white-noise.ar) (* freq env)))) (out.ar 0 (pan2.ar sig 0 0.2)))) (synth 'drum :freq 3000) +(synth 'drum :freq 400) + +;; 5th is about using .wav files as samples for synthesizers + +;; 6th is about doing sequenses +(defsynth simple ((gate 1) (freq 440) (pan 0) (amp 0.5)) + (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 0 (pan2.ar sig pan (* env amp))))) + + +(defun testing () + (let ((syn (synth 'simple :freq (midicps (+ 30 (random 40)))))) + (callback (+ (now) 0.7) #'release syn)) + (callback (+ (now) 1) #'testing)) + +(testing) +(defun testing () + nil) + +;;; and here's link to cl-patterns +;; well, let's go do guide for pl-patterns then? +;; since they'd need setup or something as well diff --git a/supercollider-example.lisp b/2022-08-12-supercollider-example.lisp similarity index 96% rename from supercollider-example.lisp rename to 2022-08-12-supercollider-example.lisp index 72a8d28..2c0f937 100644 --- a/supercollider-example.lisp +++ b/2022-08-12-supercollider-example.lisp @@ -34,12 +34,14 @@ ;; the clock keeps tempo in beats per second; thus 110/60 = 110 beats per minute (start-clock-loop :tempo 110/60) +*clock* + ;; ...and then go ahead and write some patterns! -(pb :foo ;; define a new pattern named :foo +(pb :foo ;; define a new pattern named :foo :instrument :kik ;; 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 + :dur 1 ;; give each event a duration of 1 beat :pfin 4 ;; limit the length of the pattern to 4 events (the default is infinite events) ) diff --git a/trying-includine-sound.lisp b/2022-08-12-trying-includine-sound.lisp similarity index 100% rename from trying-includine-sound.lisp rename to 2022-08-12-trying-includine-sound.lisp diff --git a/2022-08-19-patterns-guide.lisp b/2022-08-19-patterns-guide.lisp new file mode 100644 index 0000000..5ccea21 --- /dev/null +++ b/2022-08-19-patterns-guide.lisp @@ -0,0 +1,116 @@ +;; https://github.com/defaultxr/cl-patterns/blob/master/doc/tutorial.org +;; https://github.com/defaultxr/cl-patterns/blob/master/doc/cookbook.org - other examples +(ql:quickload :cl-patterns/supercollider) +(cl-patterns:backend-start 'supercollider) + +;; also launch QjackCTL and connect SuperCollider outputs 1 & 2 to headphones +;; to force restart, use killall scsynth + + + +(in-package #:cl-patterns) + +(start-clock-loop :tempo 136/60) + + +(pb :automatic-jazz + :note (pshuf (scale-notes :minor) 4) + :octave (pr (pwhite 2 7)) + :root (pr (pwhite 0 12)) + :dur (pshuf (list 1/3 1/4))) + +(play :automatic-jazz) + +(end :automatic-jazz) + +;; (tempo 136/60) ; this raises error + +(pb :hat + :instrument :hat + :dur 1/2 ;; play the hihat every 1/2 beat + :pfindur 4 ;; limit the pattern to 4 beats in length (it loops automatically) + :quant 4 ;; ensure that the pattern starts on a beat that is divisible by 4 + ) + +(pb :snare + :embed (pcycles "----o--o-o--o--o") ;; using the snare tab from the page linked above + :instrument :snare + :dur 1/4 + :quant 4) +(play :snare) +(end :snare) + +(pb :kick + :embed (pcycles "o-o-------oo----") + :instrument :kick + :dur 1/4 + :quant 4) + +;; play the patterns we've defined: +(play :hat) ; for some reason just NIL +(end :hat) +(play (list :hat :snare :kick)) ; hm + + +(pb :12-bar-blues + :scale :chromatic + :root 4 ;; E for all guitar lovers out there + :octave 4 + :dur (pseq (list 2/3 1/3)) + :amp (pseq (list 0.5 0.4)) + :legato (pseq (list 0.7 0.2)) + :degree (pr (pseq (list (pseq '((0 7) (0 9)) 8) + (pseq '((5 12) (5 14)) 4) + (pseq '((0 7) (0 9)) 4) + + (pseq '((7 14) (7 16)) 2) + (pseq '((5 12) (5 14)) 2) + (pseq '((0 7) (0 9)) 2) + (pseq '((7 14) (7 16)) 2)) + 1) + 2)) + +(play :12-bar-blues) +(end :12-bar-blues) + +;; what do I want to learn though? +(pb :foo ;; define a new pattern named :foo + :instrument :kik ;; 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 4 ;; limit the length of the pattern to 4 events (the default is infinite events) + ) + +(pb :bar + :instrument :default + :play-quant 4 + :dur 1/2 + :scale :major ;; select the major scale + :degree (pwhite 0 7) ;; pick a random note from the first 7 notes in the selected scale + :pfindur 4 ;; limit the length of the pattern to 4 beats. pfindur causes the pattern to be limited based on its duration in beats, rather than the number of events. + ) + +(play :foo) +(end :foo) + +;; let's try to modify most basic ones? copy them again + +(in-package #:cl-collider) + +(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)))) + +(in-package #:cl-patterns) + +(pb :foo ;; define a new pattern named :foo + :instrument :kik ;; 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 4 ;; limit the length of the pattern to 4 events (the default is infinite events) + ) + +(play :foo) +(end :foo) diff --git a/programming-music-journal.org b/programming-music-journal.org index 1a376a6..e64ab97 100644 --- a/programming-music-journal.org +++ b/programming-music-journal.org @@ -8,3 +8,40 @@ nope, continue with the file that had some promise the one about cl-collider turorial ** also, let's make this a separate repo? +oh, no, the 'supercollider-example' which is about cl-patterns started to work? + +how and why? maybe reinit of some shit, or what + +so, new file to hopefully learn something about cl-patterns +*** what is it that I want o learn ideally? +setting up drum sequences? + +doing chord things with synth? +** what's this thing about "FAILURE IN SERVER /n_set Node 1539 not found " +? +** this seems to be startup +#+begin_src common-lisp +(ql:quickload :cl-patterns/supercollider) +(cl-patterns:backend-start 'supercollider) + +;; also launch QjackCTL and connect SuperCollider outputs 1 & 2 to headphones +;; to force restart, use killall scsynth + + + +(in-package #:cl-patterns) + +(start-clock-loop :tempo 136/60) +#+end_src + +but what's most basic pattern that would play then? + +ones in [[file:2022-08-12-supercollider-example.lisp::end :bar][supercollider example seem to work]] + +and example seem to require me to define synth, right? +to set it into the :instrument key + +wtf am I to do. +** maybe let's try to do stuff inside of org file? +** how do I clear things, it seems that cl-patterns seems to send things to server? +** should I try a different backend?