cl-patterns-study/2022-09-06-maybe-chord-melo...

102 lines
3.2 KiB
Common Lisp

(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