renames, and frustration at inconsistent work

This commit is contained in:
efim 2022-08-19 12:09:47 +00:00
parent aee2e57677
commit be0020e38e
5 changed files with 183 additions and 2 deletions

View File

@ -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

View File

@ -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)
)

View File

@ -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)

View File

@ -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?