June 4Jun 4 Background:OM version 4.0.31432, introduced the new alternative pipeline syntax (https://opusmodus.com/forums/topic/4014-using-arrows-package-in-om-threading-macros-pipeline-syntax/).Benefits:Depending on personal taste (tolerance for nesting) the new alternative pipeline syntax maysimplify coding during iterative development andmake longer code pipelines easier to read and comprehend.Example:Here is a first OM canonical example (taken from OM docs), contrasting standard LISP vs pipeline syntax.See code for bass and section below.Standard LISP Syntax:;;;; START === Standard LISP Syntax ================ ;;;; ;;;; Source: OM - Score Examples - Jazz - Blue Mount.opmo ;;;; ;;--------------------------------------------------------- ;; Blue mount ;; Jazz style generator ;;--------------------------------------------------------- ;; Library definition for Bassline motives (def-library JBass1 (:section jb8tps jb0 (length-span '2/1 '(q. c2 mf q. c3 f q g2 mf e eb2 p f2 fs2 mp g2 eb2 f2 mf g2)) jb1 (length-span '2/1 '(e c2 f - - q c2 e g1 mp a1 mf bb1 f)) jb2 (length-span '2/1 '(q. c2 f g2 mf q c3 q. c2 f g2 mf q d3)))) ;; Library definition for left hand piano motives (def-library JPianoMg4th (:section jp8tps jp0 (length-span '2/1 '(-e q c3f3b3 - s d3g3c4 e3a3d4 -e g3c4f4 -q f3b3e4 - -)) jp1 (length-span '2/1 '(e d3g3c4 q g3c4f4 -e e3a3d4 f3b3e4 -h)) jp2 (length-span '2/1 '(-e q b3e4a4 a3d4g4 -q s e3a3d4 f3b3e4 -e f3b3e4 -q)))) ;; Library definition for drums patterns ;; (from midi to score Opusmodus option) (def-library StudioTightKitPttn (:section stkp8tps stkp1 '(s c2fs2 -s fs2 - e2fs2 - fs2 f3 c2fs2gs2 - s fs2 - e2fs2 - c2fs2 -s) stkp2 '(s c2fs2 -s fs2 - e2fs2 - fs2 f3 c2fs2 a3 e2fs2 -s e2fs2 -s g3 d2) stkp3 '(s c2fs2cs3gs3 -e s d2 fs2 e2 f3gs3e3 -e -s fs2 -s fs2 - d2fs2 e2) stkp4 '(s c2fs2cs3gs3 -e s d2 fs2 - fs2f3gs3 -e s a3 e2 - e2 - g3 d2))) ;; Modal harmonic path (setf path (tonality-series '(dorian dorian lydian dorian mixolydian aeolian) ;'(bebop-dominant) :root '(d4 d4 f4 d4 g3 a3) :map '(octave))) ;:root '(a3))) ;; Generation of bass line (setf bass1 (library 'JBass1 'Jb8tps nil :random 8)) ;; Transposition of bassline (setf bass1.transp (pitch-transpose 12 bass1)) ;; Map to harmonic path (setf bass1.omn (tonality-map path bass1.transp)) ;; Motivic choice in library for lef hand and tonality mapping (setf pianomg1.omn (tonality-map path (library 'JPianoMg4th 'jp8tps nil :random 8))) ;; Pitches for right hand melody improvisation ;; Vector for melodic contour for Right hand (setf vector (vector-smooth 0.12 (gen-noise 1024))) ;; Map vector to pitch (setf pianomd1.p (vector-to-pitch '(d3 d6) vector)) ;; Length based on binary-change (setf pianomd1.l (length-span (get-span bass1.omn) (binary-to-length (gen-binary-change pianomd1.p)))) ;; OMN assembly for right hand and tonality mapping (setf pianomd1.omn (tonality-map path (make-omn :pitch pianomd1.p :length pianomd1.l :velocity (pitch-to-velocity 'mp 'f pianomd1.p)))) ;; Processing of the right hand, tie repeated pitches. (setf pianomd1.omn.p (filter-tie pianomd1.omn)) (setf drums1.omn (gen-repeat 4 (append (library 'StudioTightKitPttn 'stkp8tps 'stkp1 :repeat 3) (library 'StudioTightKitPttn 'stkp8tps 'stkp4)))) (def-score BlueMount (:key-signature '(c maj) :time-signature '(4 4) :title "Blue mount" :tempo 132 :composer "S.Boussuge" :copyright "Copyright © 2013 S.Boussuge" :layout (list (piano-layout 'pianomd 'pianomg) (bass-layout 'bass) (bass-layout 'drums) )) (pianomd :omn pianomd1.omn.p :channel 1 :sound 'gm :program 'Acoustic-Grand-Piano :pan 82) (pianomg :omn pianomg1.omn ) (bass :omn bass1.omn :channel 2 :sound 'gm :program 'Acoustic-Bass :pan 42) (drums :omn drums1.omn :channel 10 :pan 64)) ;;;; END === Standard LISP Syntax ================Pipeline Syntax:;;;; START === Pipeline Syntax ================ ;;--------------------------------------------------------- ;; Blue mount ;; Jazz style generator ;;--------------------------------------------------------- ;; Library definition for Bassline motives (def-library JBass1 (:section jb8tps jb0 (length-span '2/1 '(q. c2 mf q. c3 f q g2 mf e eb2 p f2 fs2 mp g2 eb2 f2 mf g2)) jb1 (length-span '2/1 '(e c2 f - - q c2 e g1 mp a1 mf bb1 f)) jb2 (length-span '2/1 '(q. c2 f g2 mf q c3 q. c2 f g2 mf q d3)))) ;; Library definition for left hand piano motives (def-library JPianoMg4th (:section jp8tps jp0 (length-span '2/1 '(-e q c3f3b3 - s d3g3c4 e3a3d4 -e g3c4f4 -q f3b3e4 - -)) jp1 (length-span '2/1 '(e d3g3c4 q g3c4f4 -e e3a3d4 f3b3e4 -h)) jp2 (length-span '2/1 '(-e q b3e4a4 a3d4g4 -q s e3a3d4 f3b3e4 -e f3b3e4 -q)))) ;; Library definition for drums patterns ;; (from midi to score Opusmodus option) (def-library StudioTightKitPttn (:section stkp8tps stkp1 '(s c2fs2 -s fs2 - e2fs2 - fs2 f3 c2fs2gs2 - s fs2 - e2fs2 - c2fs2 -s) stkp2 '(s c2fs2 -s fs2 - e2fs2 - fs2 f3 c2fs2 a3 e2fs2 -s e2fs2 -s g3 d2) stkp3 '(s c2fs2cs3gs3 -e s d2 fs2 e2 f3gs3e3 -e -s fs2 -s fs2 - d2fs2 e2) stkp4 '(s c2fs2cs3gs3 -e s d2 fs2 - fs2f3gs3 -e s a3 e2 - e2 - g3 d2))) ;; Modal harmonic path (setf path (tonality-series '(dorian dorian lydian dorian mixolydian aeolian) :root '(d4 d4 f4 d4 g3 a3) :map '(octave))) ;; Bass (setf bass (-<> (library 'JBass1 'Jb8tps nil :random 8) (pitch-transpose 12 <>) ;; Transposition of bassline (tonality-map path <>) ;; Map to harmonic path )) ;; Piano left hand (setf piano-left-hand (-<> (library 'JPianoMg4th 'jp8tps nil :random 8) (tonality-map path <>) )) ;; Piano right hand (setf piano-right-pitch (-<> (gen-noise 1024) ;; Vector for melodic contour (vector-smooth 0.12 <>) (vector-to-pitch '(d3 d6) <>) ;; Map vector to pitch )) (setf piano-right-length (-<> (gen-binary-change piano-right-pitch) ;; Length based on binary-change (binary-to-length <>) (length-span (get-span bass) <>) )) (setf piano-right-hand (-<> (make-omn :pitch piano-right-pitch ;; Assemble omn :length piano-right-length :velocity (pitch-to-velocity 'mp 'f piano-right-pitch)) (tonality-map path <>) (filter-tie <>) ;; tie repeated pitches )) ;; Drums (setf drums (-<> (library 'StudioTightKitPttn 'stkp8tps 'stkp1 :repeat 3) (append <> (library 'StudioTightKitPttn 'stkp8tps 'stkp4)) (gen-repeat 4 <>) )) ;; Score (def-score BlueMount (:key-signature '(c maj) :time-signature '(4 4) :title "Blue mount (modified pipeline syntax)" :tempo 132 :layout (list (piano-layout 'piano-right 'piano-left) (bass-layout 'bass) (bass-layout 'drums) )) (piano-right :omn piano-right-hand :channel 1 :sound 'gm :program 'Acoustic-Grand-Piano :pan 82) (piano-left :omn piano-left-hand ) (bass :omn bass :channel 2 :sound 'gm :program 'Acoustic-Bass :pan 42) (drums :omn drums :channel 10 :pan 64)) ;;;; END === Pipeline Syntax ================
Thursday at 04:24 AM1 day Author Meanwhile a much better pipeline syntax was introduced to OM by @opmo with ˋbind-indexˋ, see https://opusmodus.com/forums/topic/4133-opusmodus-4031506-update/#comment-14316.It offers the feature to be able to refer to intermediate results, which is a great thing in more involved pipelines.
Create an account or sign in to comment