opmo Posted October 10, 2014 Share Posted October 10, 2014 An example of algorithmic composition in a few simple steps. Initialise random seed to all functions which may use random seed. (init-seed 8975) Six lists (bars) of note-length values. (setf len '((s s q s) (s q -s s) (s s s s) (s s -s s) (s e s) (s -s e))) The GEN-SINE function generates a sequence of vectors that describe and simulate the characteristics of a sine wave. (setf sine1 (gen-sine 12 2 0.3)) (setf sine2 (gen-sine 24 3 0.4)) (setf sine3 (gen-sine 30 4 0.5)) (setf sine4 (gen-sine 36 5 0.6)) Generate a graph from the data provided in these four sine sequences. (list-plot (list sine1 sine2 sine3 sine4) :zero-based t :point-radius 2 :join-points t) Conversion process from vector to pitch in a given ambitus. (setf pitch1 (vector-to-pitch '(g3 g6) sine1)) (setf pitch2 (vector-to-pitch '(gs3 g6) sine2)) (setf pitch3 (vector-to-pitch '(a3 g6) sine3)) (setf pitch4 (vector-to-pitch '(as3 g6) sine4)) Combining pitches to chords. (setf chords2 (chordize-list (gen-combine pitch1 pitch2))) (setf chords3 (chordize-list (gen-combine pitch1 pitch2 pitch3))) (setf chords4 (chordize-list (gen-combine pitch1 pitch2 pitch3 pitch4))) (setf chords (chord-pitch-unique (flatten (list chords2 chords3 chords4)))) Generating length lists with the help of RND-SAMPLE and RND-ORDER functions. (setf dur1 (rnd-order (rnd-sample 6 (rnd-sample 4 len)))) (setf dur2 (rnd-order (rnd-sample 4 (rnd-sample 4 len)))) (setf dur3 (rnd-order (rnd-sample 2 (rnd-sample 4 len)))) (setf dur4 (rnd-order (rnd-sample 4 (rnd-sample 4 len)))) (setf dur5 (rnd-order (rnd-sample 10 (rnd-sample 4 len)))) Generating velocity lists with the help of RND-SAMPLE function. (setf dyn1 '(p mp mf f ff)) (setf dyn2 (rnd-sample 6 dyn1)) (setf dyn3 (rnd-sample 12 dyn1)) (setf dyn4 (rnd-sample 24 dyn1)) (setf dyn5 (rnd-sample 36 dyn1)) Making OMN lists. (setf m1 (make-omn :length dur1 :pitch pitch1 :velocity dyn1)) (setf m2 (make-omn :length dur2 :pitch pitch2 :velocity dyn2)) (setf m3 (make-omn :length dur3 :pitch pitch3 :velocity dyn3)) (setf m4 (make-omn :length dur4 :pitch pitch4 :velocity dyn4)) (setf m5 (make-omn :length dur5 :pitch chords :velocity dyn5)) Random selection of variants. (setf part1 (pitch-variant m1 :variant '?)) (setf part2 (pitch-variant m2 :variant '?)) (setf part3 (pitch-variant m3 :variant '?)) (setf part4 (pitch-variant m4 :variant '?)) (setf part5 (pitch-variant m5 :variant '?)) A pause of 1 quarter. (setf pause '(-1/4)) Assembling a sequence. (setf result (assemble-seq part1 pause part2 pause part3 pause part4 pause part3 pause part2 part1 part5)) Finally, defining a score with GRAND-LAYOUT instrument - direct conversion to standard notation. (def-score wave-to-pitch (:composer "OPMO" :copyright "Opusmodus" :key-signature 'atonal :time-signature (get-time-signature result) :tempo 108 :layout (grand-layout 'piano)) (piano :omn result :sound 'gm :channel 1 :program 0)) Quote Link to comment Share on other sites More sharing options...
tonality systems Posted October 11, 2014 Share Posted October 11, 2014 A most effective short piano piece and a good example of coding. I hope it won't be too long before a composer can add cautionary accidentals to such a score, particularly the natural sign. Quote Link to comment Share on other sites More sharing options...
opmo Posted October 17, 2014 Author Share Posted October 17, 2014 (edited) The cautionary accidentals (composer intent) coming soon. Edited July 25, 2015 by opmo Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.