attempting to get chord arpegios
This commit is contained in:
parent
6a9b9a88c4
commit
12f0c80af7
|
@ -252,7 +252,7 @@
|
||||||
|
|
||||||
(defun nchord (symbol &optional (base 0))
|
(defun nchord (symbol &optional (base 0))
|
||||||
"Return list of notes for chord names by SYMBOL over the BASE."
|
"Return list of notes for chord names by SYMBOL over the BASE."
|
||||||
(mapcar (lambda (note) (+ base note)) (chord-notes symbol)))
|
(mapcar (lambda (note) (+ base note)) (chord-notes (chord symbol))))
|
||||||
|
|
||||||
(nchord :major 3)
|
(nchord :major 3)
|
||||||
|
|
||||||
|
|
|
@ -113,9 +113,10 @@
|
||||||
;; even though that is not yet satisfactory, let's try it
|
;; even though that is not yet satisfactory, let's try it
|
||||||
|
|
||||||
(pb :at-with-outside-pseq-repeating-pattern
|
(pb :at-with-outside-pseq-repeating-pattern
|
||||||
:degree (pseq (list 0 1 2 3))
|
;; :degree (pseq (list 0 1 2 3))
|
||||||
|
:degree (pseq (list 0 1 2 (list 0 7)))
|
||||||
:octave (pr (pseq (list 3 4 5 4 3)) 4)
|
:octave (pr (pseq (list 3 4 5 4 3)) 4)
|
||||||
)
|
:amp (pseq (list 0.7 0.5 0.5 0.5)))
|
||||||
;; (play :at-with-outside-pseq-repeating-pattern)
|
;; (play :at-with-outside-pseq-repeating-pattern)
|
||||||
;; (end :at-with-outside-pseq-repeating-pattern)
|
;; (end :at-with-outside-pseq-repeating-pattern)
|
||||||
;; (stop :at-with-outside-pseq-repeating-pattern)
|
;; (stop :at-with-outside-pseq-repeating-pattern)
|
||||||
|
@ -125,3 +126,5 @@
|
||||||
;; also - can I save the seeds? in case I'd like to record a random sequence that I liked on the walkthough?
|
;; also - can I save the seeds? in case I'd like to record a random sequence that I liked on the walkthough?
|
||||||
|
|
||||||
;; also - how would I specify "a multiplier" for durations? if the notes are not of the same duration
|
;; also - how would I specify "a multiplier" for durations? if the notes are not of the same duration
|
||||||
|
|
||||||
|
;; (render (pdef :at-with-outside-pseq-repeating-pattern) "/tmp/repeating-4.wav" :dur 16)
|
||||||
|
|
|
@ -0,0 +1,101 @@
|
||||||
|
|
||||||
|
(in-package :cl-patterns)
|
||||||
|
(all-instruments)
|
||||||
|
(all-chords)
|
||||||
|
|
||||||
|
(nchord :major 3) ; so, i could then inject / what's the verb
|
||||||
|
; splice list as notes
|
||||||
|
(nchord "Dominant 7th" 2)
|
||||||
|
(chord :major)
|
||||||
|
(chord "Major Triad")
|
||||||
|
|
||||||
|
(chord-indexes :major) ; (0 2 4) this goes into :degree
|
||||||
|
(chord-notes :major) ; (0 4 7) and this goes into :notes?
|
||||||
|
(chord-midinotes :major)
|
||||||
|
|
||||||
|
;; (pb :first-try-sequencing
|
||||||
|
;; )
|
||||||
|
|
||||||
|
;; i want something like
|
||||||
|
;; (pb
|
||||||
|
;; :degree chorded-arpeggio '(0 1 3 2 3 0)
|
||||||
|
|
||||||
|
;; ok, let's settle situation with notes vs degrees
|
||||||
|
(pb :with-notes
|
||||||
|
:instrument :fmrhodes1
|
||||||
|
;; :note (pseq (list 0 1 2 3 4 5 6 7) 1))
|
||||||
|
;; :note (pseq (list 0 2 4 5 7 9 11 12) 1)
|
||||||
|
:note (pseq (list 0 2 4 5 7 9 11 12) 1))
|
||||||
|
;; (play :with-notes)
|
||||||
|
;; (end :with-notes)
|
||||||
|
;; (stop :with-notes)
|
||||||
|
;; not whole octave from 0 to 7, so every key one after anothe
|
||||||
|
;; and that would be just tuning steps, not taking into account the "lad"
|
||||||
|
;; 0 2 4 5 7 9 11 12 is the major. ok
|
||||||
|
|
||||||
|
(pb :with-degrees
|
||||||
|
:instrument :fmrhodes1
|
||||||
|
:degree (pseq (list 0 1 2 3 4 5 6 7) 1))
|
||||||
|
;; (play :with-degrees)
|
||||||
|
;; (end :with-degrees)
|
||||||
|
;; (stop :with-degrees)
|
||||||
|
|
||||||
|
;; so if I take 'chord-notes' in nchord, i need to use :note
|
||||||
|
;; in the pattern
|
||||||
|
|
||||||
|
;; yay, and the patterns from 09-04 sound much better now
|
||||||
|
|
||||||
|
;;; so, back to arpeggio things
|
||||||
|
;; i'd want something like
|
||||||
|
;; (pb :hopes-for-arpegio
|
||||||
|
;; :note (arpegio-thingy (list 0 2 3 1 3 0))
|
||||||
|
;; :dur (pseq (list 1 1 2 1 1 2))
|
||||||
|
;; :chords (pseq (list :maj :min :maj7 :maj6 :maj)))
|
||||||
|
|
||||||
|
;;; and then maybe have only :note and :dur as one names pattern
|
||||||
|
;; which somehow later combines with the :chords pseq
|
||||||
|
|
||||||
|
;; (defpattern pfunc (pattern)
|
||||||
|
;; ((func :type function-designator)
|
||||||
|
;; (length :initform :inf)
|
||||||
|
;; (current-repeats-remaining :state t))
|
||||||
|
;; :documentation "Yield the result of evaluating FUNC. Note that the current event of the parent pattern is still accessible via the `*event*' special variable.
|
||||||
|
|
||||||
|
;; Example:
|
||||||
|
|
||||||
|
(next-upto-n (pfunc (lambda () (random 10)) 4))
|
||||||
|
;=> ((5 2 8 9))
|
||||||
|
|
||||||
|
;; (next-upto-n (pbind :foo (pwhite 0 10 4)
|
||||||
|
;; :bar (pfunc (lambda ()
|
||||||
|
;; (if (> (event-value *event* :foo) 5) :greater :lesser)))))
|
||||||
|
;; ;=> ((EVENT :FOO 0 :BAR :LESSER) (EVENT :FOO 6 :BAR :GREATER)
|
||||||
|
;; (EVENT :FOO 7 :BAR :GREATER) (EVENT :FOO 8 :BAR :GREATER))
|
||||||
|
|
||||||
|
;; See also: `pf', `pnary', `plazy', `pif'")
|
||||||
|
|
||||||
|
;;; so, maybe that's the way?
|
||||||
|
;; I really could have :chord attribute, and could possibly have :arpeggio-steps attribute
|
||||||
|
;; and those would combine to create :note attribute
|
||||||
|
|
||||||
|
;; i was recommended PARP
|
||||||
|
;; but I don't understand how it could be used in conjunction with chords?
|
||||||
|
;; well, no, I see - I could change :octave, and in first pattern return :notes, right?
|
||||||
|
|
||||||
|
(chord-notes :major)
|
||||||
|
|
||||||
|
;;; full on gift of help:
|
||||||
|
(pdef :foo
|
||||||
|
(parp (pbind :note (pnary #'chord-notes (pseq (list :major :minor :maj7 :maj6 :major) 1))
|
||||||
|
:dur (pseq (list 1 1 2 1 1 2)))
|
||||||
|
(pbind :note (p+ (pk :note)
|
||||||
|
(pseq (list 0 2 3 1 3 0) 1)))))
|
||||||
|
(next-upto-n (pdef :foo) 4)
|
||||||
|
;; (play :foo)
|
||||||
|
;; (end :foo)
|
||||||
|
;; (stop :foo)
|
||||||
|
|
||||||
|
(next-upto-n (pbind :note (p+ 1 (pseq (list 0 2 3) 1))) 4)
|
||||||
|
|
||||||
|
;; let's try to get sequence of steps when we give as input notes of a chord
|
||||||
|
;; tomorrow
|
|
@ -0,0 +1,89 @@
|
||||||
|
|
||||||
|
;; let's try the pfunc to create arpegio from the chord
|
||||||
|
(in-package :cl-patterns)
|
||||||
|
(next-upto-n (pbind :chord (pseq (list :major :minor :minor-triad :major))
|
||||||
|
:note (pfunc (lambda ()
|
||||||
|
(let* ((chord (event-value *event* :chord))
|
||||||
|
(notes (nchord chord)))
|
||||||
|
;; let's keep it simple for a moment
|
||||||
|
notes))
|
||||||
|
)) 10)
|
||||||
|
;; ((EVENT :CHORD :MAJOR :NOTE (0 4 7)) (EVENT :CHORD :MINOR :NOTE (0 3 7))
|
||||||
|
;; (EVENT :CHORD :MINOR-TRIAD :NOTE (0 3 7)) (EVENT :CHORD :MAJOR :NOTE (0 4 7))
|
||||||
|
;; (EVENT :CHORD :MAJOR :NOTE (0 4 7)) (EVENT :CHORD :MINOR :NOTE (0 3 7))
|
||||||
|
;; (EVENT :CHORD :MINOR-TRIAD :NOTE (0 3 7)) (EVENT :CHORD :MAJOR :NOTE (0 4 7))
|
||||||
|
;; (EVENT :CHORD :MAJOR :NOTE (0 4 7)) (EVENT :CHORD :MINOR :NOTE (0 3 7)))
|
||||||
|
|
||||||
|
;; And I'd still in parp generator
|
||||||
|
(next-upto-n (parp (pbind :chord (pseq (list :minor-triad :major)))
|
||||||
|
(pbind :note (pfunc (lambda ()
|
||||||
|
(let* ((chord (event-value *event* :chord))
|
||||||
|
(notes (nchord chord)))
|
||||||
|
;; let's keep it simple for a moment
|
||||||
|
(pseq notes 1)))
|
||||||
|
))) 10)
|
||||||
|
;; for some reason this stays on first chord forever, but does arpegio
|
||||||
|
;; bit of something I don't understand
|
||||||
|
|
||||||
|
(next-upto-n (parp (pbind :ocatave (pseq (list 3 4 3 5)))
|
||||||
|
(pbind :note (pseq (list 0 1 2) 1))) 12) ; needed 1 repeat limit here
|
||||||
|
|
||||||
|
;; let's try with #'PK
|
||||||
|
(next-upto-n (parp (pbind :chord (pseq (list :minor-triad :major)))
|
||||||
|
(pbind :note (let* ((chord (pk :chord))
|
||||||
|
(notes (nchord chord)))
|
||||||
|
;; let's keep it simple for a moment
|
||||||
|
(pseq notes 1)))) 10)
|
||||||
|
;; error, no applicable method
|
||||||
|
;; how does that work then?
|
||||||
|
|
||||||
|
(pdef :foo
|
||||||
|
(parp (pbind :note (pnary #'chord-notes (pseq (list :major :minor :maj7 :maj6 :major) 1))
|
||||||
|
:dur (pseq (list 1 1 2 1 1 2)))
|
||||||
|
(pbind :note (p+ (pk :note)
|
||||||
|
(pseq (list 0 2 3 1 3 0) 1)))))
|
||||||
|
(next-upto-n (pdef :foo) 10)
|
||||||
|
;; and what if I change :note to :chord here?
|
||||||
|
|
||||||
|
(next-upto-n (pdef :foo
|
||||||
|
(parp (pbind :chord (pnary #'chord-notes (pseq (list :major :minor :maj7 :maj6 :major) 1))
|
||||||
|
:dur (pseq (list 1 1 2 1 1 2)))
|
||||||
|
(pbind :note (p+ (pk :chord)
|
||||||
|
(pseq (list 0 2 3 1 3 0) 1))))) 10)
|
||||||
|
|
||||||
|
;; maybe difference is that #'LET* can't be directly in the place that defined :note?
|
||||||
|
;; and I should use #'PSEQ and move #'LET* into list definiton?
|
||||||
|
(next-upto-n (parp (pbind :chord (pseq (list :minor-triad :major)))
|
||||||
|
(pbind :note (pseq (let* ((chord (pk :chord))
|
||||||
|
(notes (nchord chord)))
|
||||||
|
notes)
|
||||||
|
1)))
|
||||||
|
10)
|
||||||
|
;; or maybe (pk :chord) is a pattern and can't be used as "just function to get value"
|
||||||
|
;; seems true
|
||||||
|
(next-upto-n (parp (pbind :chord (pseq (list :minor-triad :major)))
|
||||||
|
(pbind :note (pk :chord)))
|
||||||
|
10)
|
||||||
|
;; here pk :chord is object so, endless pattern and we never switch to :major
|
||||||
|
;; but that's ok,
|
||||||
|
;; main lesson I guess that I need to use pattern transformation functions,
|
||||||
|
;; and lisp transformations mainly on arguments
|
||||||
|
|
||||||
|
(next-upto-n (parp (pbind :chord (pseq (list :minor-triad :major)))
|
||||||
|
(pbind :note (pfunc (lambda ()
|
||||||
|
(pseq (nchord (event-value *event* :chord)) 1)))))
|
||||||
|
10)
|
||||||
|
;; endless stream, inner :note doesn't end?
|
||||||
|
(next-upto-n (parp (pbind :chord (pseq (list :minor-triad :major)))
|
||||||
|
(pbind :note (pseq (pnary #'nchord (pk :chord)) 2)))
|
||||||
|
20)
|
||||||
|
;; not that seems to work?
|
||||||
|
(pdef :maybe-arpegio
|
||||||
|
(parp (pbind :chord (pseq (list :minor-triad :major) 2))
|
||||||
|
(pbind :note (pseq (pnary #'nchord (pk :chord)) 2))))
|
||||||
|
;; (play :maybe-arpegio)
|
||||||
|
;; (end :maybe-arpegio)
|
||||||
|
;; (stop :maybe-arpegio)
|
||||||
|
|
||||||
|
;; could I maybe now insert this into a pb
|
||||||
|
;; so that I could change speed and root for whole thing?
|
Loading…
Reference in New Issue