From e6270ea43586e7d87a2a8eeaba9fdef735a9fd20 Mon Sep 17 00:00:00 2001 From: efim Date: Sun, 11 Sep 2022 15:32:15 +0000 Subject: [PATCH] first experiment written down --- .../2022-09-08-more-on-chord-melodies.lisp | 3 +- ...-09-09-maybe-cleanup-bass-from-chords.lisp | 8 +- ...2-09-11-attempting-more-with-arpegios.lisp | 232 ++++++++++++++++++ dirty-journal/programming-music-journal.org | 18 ++ stabler-things/functions.lisp | 1 + stabler-things/synthesizers.lisp | 10 +- 6 files changed, 262 insertions(+), 10 deletions(-) create mode 100644 dirty-journal/2022-09-11-attempting-more-with-arpegios.lisp diff --git a/dirty-journal/2022-09-08-more-on-chord-melodies.lisp b/dirty-journal/2022-09-08-more-on-chord-melodies.lisp index df2a853..f176658 100644 --- a/dirty-journal/2022-09-08-more-on-chord-melodies.lisp +++ b/dirty-journal/2022-09-08-more-on-chord-melodies.lisp @@ -235,8 +235,7 @@ ;; (stop :maybe-arpegio-padded) (next-upto-n (pdef :maybe-arpegio-padded) 30) -(next-upto-n (psync (pseq (list 1 2 3) 6) 8) 30) -;; maybe that doesn't work because #'PSYNC need to be in context of bound stream, with :dur present? +;; (next-upto-n (psync (pseq (list 1 2 3) 6) 8) 30) ;; maybe that doesn't work because #'PSYNC need to be in context of bound stream, with :dur present? ;; that's possible (next-upto-n (psync (pbind diff --git a/dirty-journal/2022-09-09-maybe-cleanup-bass-from-chords.lisp b/dirty-journal/2022-09-09-maybe-cleanup-bass-from-chords.lisp index d025253..bffbe6f 100644 --- a/dirty-journal/2022-09-09-maybe-cleanup-bass-from-chords.lisp +++ b/dirty-journal/2022-09-09-maybe-cleanup-bass-from-chords.lisp @@ -76,14 +76,14 @@ ;;; ok! now let's do 4 bars of same, then 4 bars with 1/3 duration in arpeggios ;; IV V iii vi - -(setq *my-chords* (list :major :major :minor :minor) - *my-roots* (list 3 4 2 5)) +;; (setq *my-chords* (list :major :major :minor :minor) +;; *my-roots* (list 3 4 2 5)) +;; for now will set in 09-11.lisp (pb :lets-arpegio-before-duration :embed (not-perfect-but-arpeggio *my-chords*) ; each chord plays arpeggio for whole phrase (two bars) :embed (attr-per-phrase :root *my-roots*) - :embed (attr-per-phrase :legato (list 1 0.7 0.5 0.8)) ; each phrase takes single value for legato + :embed (attr-per-phrase :legato (list 1 0.8 0.6 0.9)) ; each phrase takes single value for legato ; even if amount of events in phrase change with change of :dur ) ;; (next-upto-n (pdef :lets-arpegio-iv-v-iii-vi) 30) diff --git a/dirty-journal/2022-09-11-attempting-more-with-arpegios.lisp b/dirty-journal/2022-09-11-attempting-more-with-arpegios.lisp new file mode 100644 index 0000000..5e35aab --- /dev/null +++ b/dirty-journal/2022-09-11-attempting-more-with-arpegios.lisp @@ -0,0 +1,232 @@ +;;; today I'd like to do bass arpegios, with high chords +;; and maybe drums for both parts (from 09-09) +;; and join them? + +;; IV V iii vi +;; (setq *my-chords* (list :major :major :minor :minor) +;; *my-roots* (list 3 4 2 5)) +;; (setq *my-chords* (list :major) +;; *my-roots* (list 3)) + +;; Am – F – C – G (i – VI – III – VII) +;; (setq *my-chords* (list :minor :major :major :major) +;; *my-roots* (list 0 3 2 6)) + +;; i - III - iv - VI +(setq *my-chords* (list :minor :major :minor :major) + *my-roots* (list 0 2 3 5)) + +(in-package :cl-patterns) + +(start-clock-loop :tempo 90/60 :force t) + +(pb :lets-slow-bass-arpegio + :dur 2 + :octave 3 + ;; :instrument :fmbass + :embed (not-perfect-but-arpeggio *my-chords*) + :embed (attr-per-phrase :root *my-roots*) + ) +;; (play :lets-slow-bass-arpegio) +;; (stop :lets-slow-bass-arpegio) + +;; well, what if I rather take my simple-bass thing +;; and give it some kind of slow pattern +;; nope, that simple-bass plays whole chords +;; +;; at this point I'm just tempted to not use chords, +;; and have a PARP +(pdef :chord-defs + (pbind :chord (pseq *my-chords* 1) + :chord-base (pseq *my-roots* 1))) + +(pb :lets-slow-bass-melody + (parp + (pdef :chord-defs) + (pbind :step (pseq (list 0 1 0 1 2 0 1 2) 1) + :dur (pseq (list 1/4 1/4 1 1 1 1 1 5/2) 1) + ;; :note (pfunc (lambda () + ;; (event-value *event* :step))) + :note (pfunc (lambda () + (+ (event-value *event* :chord-base) + (nth (event-value *event* :step) + (chord-notes (event-value *event* :chord)))))) + ))) +;; (next-upto-n (pdef :lets-slow-bass-melody) 10) +;; (play :lets-slow-bass-melody) +;; (end :lets-slow-bass-melody) +;; (stop :lets-slow-bass-melody) + +(pb :embedding-bass-melogy-into-pattern + (pseq (list (pbind + :quant 4 + :dur (pseq (list (prest 7/2)) 1)) + (pbind + :octave 2 ; let's add these later? when join both? + :instrument :fmbass + :embed :lets-slow-bass-melody)) + 1)) +(next-upto-n (pdef :embedding-bass-melogy-into-pattern) 20) +;; (play :embedding-bass-melogy-into-pattern) +;; (stop :embedding-bass-melogy-into-pattern) +;; (end :embedding-bass-melogy-into-pattern) + +;; now. let's brainstorm the pattern on a single chord? + +;; and well, my guess is that pattern should start from 1/2 before tha bar start? + +;; so is there a "timer shift" for pattern? +;; if I can only align by quant +;; ( upbeat ? ) +;; well 3 6 9 - and we have -1 +2 and +1 over the quant :4 + +;; ok, let's for not simulate that stuff by writing continuous bass melody +;; and adding 3 1/2 rest in the beginning + +;; I'd like to add bottom note repeating at 1/2 ? + +;;; let's just do same? quant 4, wait for the upbeat of next bar +;;; and start playing 1/2 8 times? +(pb :lets-slow-bass-melody-root-repeating + (pseq (list (pbind :dur (pseq (list (prest 4)) 1) + :quant 4) + (parp + (pdef :chord-defs) + (pbind + :octave 1 + :instrument :fmbass + :dur (pseq (list (prest 5/2) (pfindur 1/2 7/2) (prest 2)) 1) + :legato 0.5 + :note (pk :chord-base))) + (pbind :dur (pseq (list (prest 1)) 1))) + 1)) +(next-upto-n (pdef :lets-slow-bass-melody-root-repeating) 20) +;; (play :lets-slow-bass-melody-root-repeating) +;; (end :lets-slow-bass-melody-root-repeating) +;; (stop :lets-slow-bass-melody-root-repeating) + +(pdef :full-bass-melody + (ppar (list :embedding-bass-melogy-into-pattern :lets-slow-bass-melody-root-repeating))) +;; (play :full-bass-melody) +;; (stop :full-bass-melody) + +;; yay, not sure whether I want :octave 1 or 2, but overall, cool, +;; even though - so much still to learn to not have to do manual calculaitons of prest and such + +;; let's have some kind of light chord holding. not sure what I want, maybe default +;; maybe strings? or pluck + +(pb :high-chords-hold + :embed :chord-defs + :instrument :tone-buzz + :dur 8 + :quant 4 + :amp 0.05 + :note (p+ (pk :chord-base) (pnary #'chord-notes (pk :chord)))) +(next-upto-n (pdef :high-chords-hold) 30) +;; (play :high-chords-hold) +;; (end :high-chords-hold) +;; (stop :high-chords-hold) + +(pb :high-chords-with-pre-bar + (pseq (list + (pbind :dur (pseq (list (prest 4)) 1)) ; most awkward thing + (pdef :high-chords-hold)) + 1)) + +(pdef :total-base-section + (ppar (list :full-bass-melody :high-chords-with-pre-bar))) +;; (play :total-base-section) +;; (stop :total-base-section) + +;; well, it seems that with restarts defsynts of fmbass start playing worse? +;; responding less and less to short notes and legato? +;; is that due to not restarting sbcl? +;; let's try full restart + +;;; I've done full restart, didn't totally help. +;; and I've set slower clock speed + +;;; now, let's add intro, connection and ending? + +(pb :intro + :embed :chord-defs + :dur (pseq (list 2 2 4) 1) + :instrument :strings + :amp 0.1 + :note (p+ (first *my-roots*) (pnary #'chord-notes (first *my-chords*)))) +;; (play :intro) +;; (stop :intro) +;; (end :intro) +;; idea for not now - third chord make in two octaves? + +;;; maybe add a scratch inbetween? +(pb :phrase-connection + :instrument :fmbass + :dur (pseq (list (prest 2) 12 (prest 4)) 1) + :embed :chord-defs + :octave 2 + :note (p+ (first *my-roots*) (pnary #'chord-notes (first *my-chords*))) + ) +;; (play :phrase-connection) +;; (stop :phrase-connection) + +;;; for this to work, also evaluate ~/Documents/personal/common-lisp-study/music/dirty-journal/2022-09-09-maybe-cleanup-bass-from-chords.lisp +;; maybe later on cleanup I'd put everything into same file + +(pdef :is-that-first-experiment + (pseq (list (pdef :intro) + (pdef :total-base-section) + (pdef :phrase-connection) + (pdef :arpegios-and-bass)) + 1)) +;; (play :is-that-first-experiment) +;; (stop :is-that-first-experiment) +;; (end :is-that-first-experiment) + +;; welp, when notes are too quick, they are not produced +;; and I also kind of wanted a percussion line, but oh well + +;; ;;; ok, let's record that, + +;; ;; 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 +;; ;; ;; IV V iii vi +;; ;; Am – F – C – G (i – VI – III – VII) +;; ;; i - III - iv - VI +;; (buffer-write mybuffer "/tmp/first-experiment-i-III-iv-VI.aiff" :leave-open-p t) + +;; ;; now play whatever sounds you like + +;; ;; e.g. +;; (in-package :cl-patterns) +;; (play :is-that-first-experiment) +;; (stop :is-that-first-experiment) +;; (end :is-that-first-experiment) + +;; ;; 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 diff --git a/dirty-journal/programming-music-journal.org b/dirty-journal/programming-music-journal.org index 893171c..6596c98 100644 --- a/dirty-journal/programming-music-journal.org +++ b/dirty-journal/programming-music-journal.org @@ -410,3 +410,21 @@ maybe put everything under "dirty-journal" directory and start a "clean" journal * [2022-09-09 Fri] ** let's move everything into "dirty-journal" +* [2022-09-11 Sun] +** so, today I've been writing bass arpeggios +** biggest questin - upbeat before first bar, +how to effectively write that? + +so that it would be easy to sync things on :quant +** thing I found out - +it would be nice to specify chords and chord-bases as a pattern +to be embedded + +that way I'd be able to switch it up on the go and all patterns extending it would pick it up? +well, maybe not all at the same time, if they are not synched =C +** would be nice to put everything of 09-09 and 09-11 into single file +to make it easier to restart whole first experiment with different chords + +also, have I saved a link to the side where I saw the chord progressions I used? + +also-also having a keyboard could be a nice help diff --git a/stabler-things/functions.lisp b/stabler-things/functions.lisp index e5271d4..5089e54 100644 --- a/stabler-things/functions.lisp +++ b/stabler-things/functions.lisp @@ -1,3 +1,4 @@ +(in-package :cl-patterns) (defun nchord (symbol &optional (base 0)) "Return list of notes for chord names by SYMBOL over the BASE." (mapcar (lambda (note) (+ base note)) (chord-notes (chord symbol)))) diff --git a/stabler-things/synthesizers.lisp b/stabler-things/synthesizers.lisp index 8630eda..b966dd2 100644 --- a/stabler-things/synthesizers.lisp +++ b/stabler-things/synthesizers.lisp @@ -150,10 +150,12 @@ (sig (sin-osc.ar freq 0 0.2))) (out.ar out (pan2.ar sig 0 env)))) -(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)))) +(defsynth tone-buzz ((freq 440) (amp 0.2) (gate 1)) + (out.ar 0 (* + (saw.ar (let ((detune (* freq 0.01))) + (list (- freq detune) (+ freq detune))) + (/ amp 2)) + (env-gen.kr (asr 0 1 0.1) :gate gate :act :free)))) (defsynth tone-pluck ((freq 440) (amp 0.2)) (out.ar 0 (* (saw.ar (let ((detune (* freq 0.01)))