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