Jump to content

Stephane Boussuge

Moderators
  • Posts

    1,066
  • Joined

  • Last visited

Reputation Activity

  1. Like
    Stephane Boussuge reacted to opmo in Opusmodus 2.2.26911 Update   
    New function:
    DICTUM  
    Please note that the functions APPLY-TO-DICTUM and OMN-DICTUM are merged to a new function DICTUM.
    If you used any of the two function before in your score please rename the function and make the changes to the dictum form and type.
     
    Here are the new types:
    :range a list (<low> <high>). Length, pitch or velocity values. :and a list of event elements (l p v a). :any an event element or list of event elements. :apply an event element, list of event elements or function. :remove an event element, list of elements, :velocity, :event or :attribute. :first an event element or list of event elements (first event in a sequence). :last an event element or list of event elements (last event in a sequence). :butlast an event element or list of event elements (butlast events in a sequence). :rest an event element or list of event elements (rest events in a sequence). :sub a sequence of events (a bar substitution). :bar an integer or list of integers (bar number). :event an integer or list of integers (event number).  
    Dictum Examples:
    Replaces an element with a new-element in all bars:
    (:any f :apply p) (:any q :apply e) (:any stacc :apply leg) (:any q :apply stacc) (:any e :apply (s stacc))  
    Replaces an element with a new-element in a given bar:
    (:any f :apply p :bar 1) (:any q :apply e :bar 1) (:any stacc :apply leg :bar 1) (:any q :apply stacc :bar 1) (:any e :apply (s stacc) :bar 1) (:any e :apply (s stacc) :bar (1 3 5)) (:any e (s stacc) :bar 2..6)  
    Replaces an element with a new-element in a given bar and a given event number:
    (:any f :apply p :bar 1 :event 1) (:any q :apply e :bar 1 :event 1) (:any q :apply stacc :bar 1 :event 1) (:any e :apply (s stacc) :bar 1 :event 1) (:any e :apply (s stacc) :bar (1 3 5) :event 1) (:any e :apply (s stacc) :bar 2..6 :event 1)  
    Replaces all elements in a sequence of its type with a new-element:
    (:apply stacc)  
    Replaces all elements of its type with a new-element in a given bar:
    (:apply stacc :bar 2) (:apply stacc :bar (2 4 6 8))  
    Rewrites accidentals with sharp map:
    (:apply :sharp)  
    Rewrites accidentals with flat map:
    (:apply :flat)  
    Replaces a list of elements with a new-element in all bars:
    (:any (f mf) :apply mp)  
    Replaces a list of elements with a new-element in a given bar:
    (:any (f mf) :apply mp :bar 1)  
    Removes an element from the sequence:
    (:remove leg)  
    Removes all velocity elements from the sequence:
    (:remove :velocity)  
    Removes all attribute (articulation) elements from the sequence:
    (:remove :attribute)  
    Converts an event number in a given bar into a pause:
    (:remove :event :bar 1 :event 2)  
    Replaces a first event in all bars in a sequence:
    (:first ord)  
    Replaces the first event in a given bar:
    (:first ord :bar 6)  
    Replaces the last event in a given bar:
    (:last fermata :bar 6)  
    Replaces all elements in a sequence excluding the last event:
    (:butlast leg)  
    Replaces all elements in a sequence excluding the first event:
    (:rest leg)  
    Replaces all elements in a given range with a new-element:
    (:range (t s) :apply marc) (:range (mp f) :apply p) (:range (c4 c5) :apply tasto)  
    Replaces all elements in a given range and in a given bar:
    (:range (t s) :apply marc :bar 2) (:range (mp f) :apply p :bar 2) (:range (c4 c5) :apply tasto :bar 2)  
    Replaces all elements in a sequence when equal the and series:
    (:and (q c4 f) :apply ff) (:and (q c4 f stacc) :apply (q c4cs5 f marc))  
    Substitutes a given bar number with a new sequence of events:
    (:sub (3q c4 eb4 gs4) :bar 8 )  
  2. Like
    Stephane Boussuge reacted to AM in mapping a 2d-field to chords   
    here is a function to MAP a 2d-field to chords (via intervals) // an idea i got from "Nierhaus - Algorithmic Composition" - Cellular Automata (p. 198). so you can "import/map" some GAME-OF-LIFE configurations or whatelse (a pixel photo?)  // the PITCH-MAPPING is like in Miranda's CAMUS.
     
     
    ;; FUNCTION ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun 2d-field-to-chord (matrix &key (start 'c4) (merge-chords nil)) (let* ((int-horizontal (x+b (loop for x in (loop for i in matrix collect (position-item 1 i)) when (not (null x)) collect x) 1)) (int-vertical (x+b (loop repeat (length matrix) for n = 0 then (incf n) when (not (null (position-item 1 (nth n matrix)))) collect n) 1)) (chords (loop for h in int-horizontal for v in int-vertical append (loop for z in h collect (chordize (interval-to-pitch (list z v) :start start)))))) (if (null merge-chords) chords (chord-pitch-unique (chordize (flatten chords)))))) ;; interval-matrix ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; numbers are intervals (inverted order then in the book) ;; (different sizes are possible) (setf matrix #|1 2 3 4 5 6 7 8 9 etc..|# #|1|# '((1 0 0 0 0 0 0 0 0 0 0 0) #|2|# (0 1 0 0 0 0 0 0 0 0 0 0) #|3|# (0 0 1 0 0 0 0 0 0 0 0 0) #|4|# (0 0 0 0 0 0 0 0 0 0 0 0) #|5|# (0 0 0 0 0 0 0 0 0 0 0 0) #|6|# (0 0 0 0 0 0 0 0 0 0 0 0) #|7|# (0 0 0 0 0 0 0 0 0 0 0 0) #|etc..|# (0 0 0 0 0 0 0 0 0 0 0 0) (0 0 0 0 0 0 0 0 1 0 0 0) (0 0 0 0 0 0 0 0 0 0 0 0) (0 0 0 0 0 1 0 0 0 0 0 0) (0 0 0 0 0 0 0 0 0 0 0 0))) (2d-field-to-chord matrix) (2d-field-to-chord matrix :start 'd4) (2d-field-to-chord matrix :merge-chords t) (2d-field-to-chord matrix :merge-chords t :start 'd4) ;; as a scale (sort-asc (melodize (2d-field-to-chord matrix :merge-chords t))) ;; with rnd-generated field (by probability) (progn (setf matrix (loop repeat 32 collect (loop repeat 32 collect (prob-pick '((0 0.97) (1 0.03)))))) (2d-field-to-chord matrix)) (progn (setf matrix (loop repeat 32 collect (loop repeat 32 collect (prob-pick '((0 0.99) (1 0.01)))))) (2d-field-to-chord matrix :merge-chords t))  

     
     
     
  3. Like
    Stephane Boussuge got a reaction from JulioHerrlein in trim-to-time-signature function ?   
    May be length-span ?
  4. Like
    Stephane Boussuge reacted to opmo in length-trim measures with rests   
    (loop for seq in '((q e3) (q. e3) (q g3) (q d3) (q. a3))   for span in '(3/8 1/4 3/8 1/2)   collect (fit-to-span span seq)) => ((q e3 -e) (q e3) (q g3 -e) (q d3 -))  
  5. Like
    Stephane Boussuge reacted to o_e in length-trim measures with rests   
    (loop for (a b) on '((q e3) (q. e3) (q g3) (q d3) (q. a3)) by #'cddr when a collect (fit-to-span 3/8 a) when b collect (fit-to-span 2/8 b)) => ((q e3 -e) (q e3) (q g3 -e) (q d3) (q. a3))  
     
     
  6. Like
    Stephane Boussuge reacted to AM in Number of beats per measure   
    violà... here's a solution...
    but: you have a wrong OMN-structure in your code (-e a3f4d5 q ... => a rest followed by a pitch, i corrected it
     
     
    (setf omnlist '((-e q f4d5a5) (q a3e4c5 q e4c5a5) (-e h g4e5a5))) (defun countbeats (omnlist &key (denom '1/8)) (loop for i in omnlist collect (/ (sum (abs! (flatten (omn :length i)))) denom))) (countbeats omnlist) => (3 4 5) (countbeats omnlist :denom 1/16) => (6 8 10)  
  7. Like
    Stephane Boussuge reacted to JulioHerrlein in Slonimsky Stuff HELP   
    After we figure out the pattern sequence, gen-sive or make-scale do the job.
    added 1 minute later PATT # 1
    (make-scale 'c4 12 :alt '(1 5)) This is why I love Opusmodus !
    Best !!
    Julio
  8. Like
    Stephane Boussuge reacted to Cliff in Just Feedback after 1 week learning OM language   
    While complaining about the state/progress on ARM M1 upgrade, Heres a honest Happy Customer statement on OM language:
     
    Everytime I learn a new function, I grow in understanding that OM is super powerful while still the language and syntax (once getting used to parathesis) is simple enough to not get distracted. More and more I feel to understand the intention why certain functions have been designed and how to apply them. A huge support is the good website and inline docu (probably the best I have ever seen).
     
    It dawns me that people who created the OM language and drive its evolution so long do really understand whats necessary for algorithmic composition.
     
    I feel privileged to participate to have daily insights while learning all these music-related concepts and enjoy it a lot.
     
    In my dayjob I am a Data-Scientist so maybe I will contribute some day with ideas not covered yet, not shure if they are musical as I am just hobbyist.
     
    Excellent, Thanks a lot.
    Keep the good work.
     
    Regards
    Cliff
  9. Like
    Stephane Boussuge reacted to born in merge lengths with same pitches   
    Thanks a lot Stephane, that helps. Achim
  10. Thanks
    Stephane Boussuge got a reaction from opmo in merge lengths with same pitches   
    (filter-tie '(e c4 c4 e. c4 q c4 s c4 e eb4 e. eb4 h eb4 e. eb4 q eb4)) => (h. c4 mf wq eb4)  
     
    also this could be useful as well but Janusz probably can program it much better:
     
    (defun filter-change (omn-lst) (make-omn :pitch (omn :pitch omn-lst) :length (binary-map (gen-binary-change (omn :pitch omn-lst)) (omn :length omn-lst)) :velocity (omn :velocity omn-lst) :articulation (omn :articulation omn-lst) :swallow t )) (filter-change '(e c4 c4 e. c4 q c4 s c4 e eb4 e. eb4 h eb4 e. eb4 q eb4)) => (e c4 - -e. -q -s e eb4 -e. -h -e. -q)  
  11. Like
    Stephane Boussuge got a reaction from NagyMusic in Visions Fugitives   
    Very nice, thank you for sharing.
     
    Best
     
    Stéphane
     
  12. Like
    Stephane Boussuge reacted to NagyMusic in Visions Fugitives   
    I'm working on a series of piano pieces. Here're two of the movements. Special thanks to Janusz and Stéphane for their invaluable feedback and ideas! Thanks for listening - comments welcome!
     
    1.mp3
    3.mp3
     
    - Zvony
  13. Like
    Stephane Boussuge reacted to opmo in Pairs of digits as sublists?   
    (mclist '(0 1 2 3) '(a b c d)) => ((0 a) (1 b) (2 c) (3 d))  
  14. Thanks
    Stephane Boussuge got a reaction from NagyMusic in Pairs of digits as sublists?   
    Hi Zvony,
    here's a possible solution:
     
    (setf list1 (rnd-number 100 1 2)) (setf list2 (gen-integer 1 100)) (setf interleaved-list (matrix-transpose (list list1 list2))) S.
  15. Like
    Stephane Boussuge reacted to AM in Vienna Variations   
    your code would be very interesting 🙂
  16. Like
    Stephane Boussuge reacted to opmo in Vienna Variations   
    Short variation for piano.
    Best wishes,
    Janusz
     
    Vienna Variations.mp3
  17. Thanks
    Stephane Boussuge reacted to opmo in Vienna Variations   
    Code possibly with next update.
  18. Like
    Stephane Boussuge got a reaction from JulioHerrlein in pitch-trajectory   
    It is also possible to map on pitch fields that way:
     
    ;;; Mapping on pitch-field (pitch-list-plot (tonality-map (append (chordize (make-scale 'c2 24 :alt '(2 1 6 5 4))) '(:map 'step )) (pitch-trajectory 128 '(0 23) '(0.1 1 0.1) :filter-repeat 1 :variance 0.8 )))  
    You can use different fields that way:
     
    (setf pfields (list (chordize (make-scale 'c2 24 :alt '(2 1 6 5 4))) (chordize (make-scale 'c2 24 :alt '(3 1 2 4))) (chordize (make-scale 'c2 24 :alt '(2 2 2 1))) )) (setf path (tonality-series pfields :map '(step))) (pitch-list-plot (tonality-map path (gen-eval 3 '(pitch-trajectory 128 '(0 23) '(0.1 1 0.1) :filter-repeat 1 :variance 0.2 )) ))  
    And also use the :time parameter from tonality-map system if you use OMN expression:
     
    ;;; Example with omn without :time parameter (pitch-list-plot (tonality-map path (gen-filter-euclidean 12 16 11 16 (pitch-trajectory 128 '(0 23) '(0.1 1 0.1) :filter-repeat 1 :variance 0.2 ) 's) )) ;;; Same with :time parameter (pitch-list-plot (tonality-map path (gen-filter-euclidean 12 16 11 16 (pitch-trajectory 128 '(0 23) '(0.1 1 0.1) :filter-repeat 1 :variance 0.2 ) 's) :time '(h w))) S.
  19. Haha
    Stephane Boussuge reacted to AM in pitch-trajectory   
    thanx, stephane! you are my OPMO-function-MASTER! 🙂
     
  20. Like
    Stephane Boussuge got a reaction from AM in pitch-trajectory   
    It is also possible to map on pitch fields that way:
     
    ;;; Mapping on pitch-field (pitch-list-plot (tonality-map (append (chordize (make-scale 'c2 24 :alt '(2 1 6 5 4))) '(:map 'step )) (pitch-trajectory 128 '(0 23) '(0.1 1 0.1) :filter-repeat 1 :variance 0.8 )))  
    You can use different fields that way:
     
    (setf pfields (list (chordize (make-scale 'c2 24 :alt '(2 1 6 5 4))) (chordize (make-scale 'c2 24 :alt '(3 1 2 4))) (chordize (make-scale 'c2 24 :alt '(2 2 2 1))) )) (setf path (tonality-series pfields :map '(step))) (pitch-list-plot (tonality-map path (gen-eval 3 '(pitch-trajectory 128 '(0 23) '(0.1 1 0.1) :filter-repeat 1 :variance 0.2 )) ))  
    And also use the :time parameter from tonality-map system if you use OMN expression:
     
    ;;; Example with omn without :time parameter (pitch-list-plot (tonality-map path (gen-filter-euclidean 12 16 11 16 (pitch-trajectory 128 '(0 23) '(0.1 1 0.1) :filter-repeat 1 :variance 0.2 ) 's) )) ;;; Same with :time parameter (pitch-list-plot (tonality-map path (gen-filter-euclidean 12 16 11 16 (pitch-trajectory 128 '(0 23) '(0.1 1 0.1) :filter-repeat 1 :variance 0.2 ) 's) :time '(h w))) S.
  21. Like
    Stephane Boussuge reacted to AM in pitch-trajectory   
    great function, stephane!!
    little extension/different mapping
     
    ;;; a slightly extended version of stephane's FUNCTION ;;; with integer-output so you could map it on pitchfields/chords (defun pitch-trajectory* (nbpitch range tendency &key (variance 0.5) (type :around) (quantize 1/2) (smooth 1) filter-repeat seed (output 'int) (int-range '(0 24)) ) (setf seed (rnd-seed seed)) (do-verbose ("pitch-trajectory :seed ~s" seed) (let* ((values (gen-tendency nbpitch tendency :variance variance :type type :seed (seed))) (smoothedval (vector-smooth smooth values)) (out (cond ((equal output 'pitch) (vector-to-pitch range smoothedval :quantize quantize)) ((equal output 'int) (vector-round (car int-range) (cadr int-range) smoothedval))))) (if filter-repeat (filter-repeat filter-repeat out) out)))) ;;; pitch-ouput like in stephane's version (pitch-list-plot (pitch-trajectory* 128 '(fs3 g5) '(0.1 1 0.1) :filter-repeat 1 :variance 0.8 :output 'pitch )) ;;; integer-output for MAPPING (list-plot (pitch-trajectory* 128 '(fs3 g5) '(0.1 1 0.1) :filter-repeat 1 :variance 0.8 :output 'int :int-range '(0 23) )) ;;; MAPPING the integers on a scale or pitchfield (loop for i in (pitch-trajectory* 128 '(fs3 g5) '(0.1 1 0.1) :filter-repeat 1 :variance 0.8 :output 'int :int-range '(0 23)) with scale = (make-scale 'c2 24 :alt '(1 2)) collect (nth i scale)) (loop for i in (pitch-trajectory* 128 '(fs3 g5) '(0.1 3 0.1) :filter-repeat 1 :variance 0.9 :output 'int :int-range '(0 23)) with scale = (make-scale 'c2 24 :alt '(2 1 6 5 4)) collect (nth i scale)) ;;; an example with MAPPING and SAMPLING (progn (setf seq (loop for i in (pitch-trajectory* 64 '(fs3 g5) '(0.1 3 0.1) :filter-repeat 1 :variance 0.4 :output 'int :int-range '(0 23)) with scale = (make-scale 'c2 24 :alt '(2 1 6 5 4)) collect (nth i scale))) (make-omn :pitch (loop repeat 20 collect (rnd-sample-seq (rnd-pick '(11 17 29)) seq)) :length (pick-norepeat 20 '(t t. s -t. -t)) :span :pitch))  
  22. Like
    Stephane Boussuge reacted to opmo in Opusmodus 2.2.26880 Update   
    2.2.26880
     
    – New function:
    GET-BEATS ATTRIBUTE-SERIES  
    – Changes:
    PITCH-EXPANSION-VARIANT now PITCH-SEGMENT-VARIANT GET-EVENTS - additional functionality  
    Downloads
     
     
    GET-BEATS
     
    The function GET-BEATS allows you to assemble a new sequence from a number of beats of a given bar and a given omn sequence. The beat value is taken from the bar time-signature. The variant - if defined - is applied to the entire bar before the beat collection.
     
    Examples:
    (setf omn '((q c4 eb4 g4 bb4) (h g3f4cs5 p c5))) (get-beats '(1 1) omn) => (q c4 mf eb4 g4 bb4) (get-beats '(1 1 1) omn) => (q c4 mf) (get-beats '(1 1 (1 4)) omn) => (q c4 mf bb4) (get-beats '((1 1 (1 3))              (1 2 1)) omn) => ((q c4 mf g4) (q g3f4cs5 p tie)) (get-beats '((1 1 (1 3) r)              (1 2 1 i)) omn) => ((q bb4 mf eb4) (q g3a2cs2 p tie))  
    Collecting beat values from two voices with variant set to '? (at random):
    (setf seq1 '((s g4 pp e s cs5 c4 -e s fs5 g4 mf q s gs5 mp e)         (s a3 f g4 pp e s gs5 gs5 -e s a3 gs4 mf q s a5 mp a5)) seq2  '((h e4f5 p c5a4) (h b3d3 gs4eb2fs3) (h bb2g5cs5 gs4d4eb2)          (w bb2 mp) (h g3f4cs5 p c5) (h fs5a5b3 e4b3) (h bb2)          (w e2eb4) (h c5cs6 a5) (h f4g3 gs4d3) (h fs5 bb2fs5g3)          (h d3e5eb4 gs4) (h a2c6 f2) (h b0 cs6c5) (h gs4d3))) (get-beats '((1 1 1 ?)              (2 3 2 ?)              (1 2 2..4 ?)              (2 5 2 ?)) (list seq1 seq2) :seed 42) => ((s gs5 pp e s fs5)     (q g5cs5bb2 p)     (s gs5 pp a5 -e s a5 gs5 mf e gs4 tie gs4 s g4 mp a3)     (q g3f4cs5 p))  
    Collecting beat values from four voices:
    (setf cello1 '((s g2 p d3 b3 a3 b3 d3 b3 d3)                (s g2 d3 b3 a3 b3 d3 b3 d3))       cello2 '((s g2 p e3 c4 b3 mf c4 e3 c4 e3)                (s g2 e3 c4 b3 c4 e3 c4 e3))       cello3 '((s g2 mf fs3 c4 b3 c4 fs3 c4 fs3)                (s g2 fs3 c4 b3 c4 fs3 c4 fs3))       cello4 '((s g2 mf g3 b3 a3 b3 g3 b3 g3)                (s g2 g3 b3 a3 b3 g3 b3 fs3))) (get-beats '((1 1 2 ?)              (2 1 2 ri)              (3 2 2 ?)              (4 2 1 ?)              (2 2 2 ?)              (3 2 2 ?))            (list cello1 cello2 cello3 cello4)            :seed 59) => ((s a3 p g2 b3 b3)     (s a2 mf gs2 e3 cs4)     (s c4 mf c4 fs3 fs3)     (s g2 mf g3 a3 b3)     (s c4 mf c4 e3 e3)     (s b3 mf c4 c4 c4))  
     
     
    ATTRIBUTE-SERIES
     
    The function ATTRIBUTE-SERIES inserts a series of attributes into an omn-form sequence. The series list consists of two values: attribute and its count.
     
    Examples:
    (attribute-series '(leg 8) '(s g2 d3 b3 a3 b3 d3 b3 d3 g2 d3 b3 a3 b3 d3 b3 d3))
     
    (attribute-series '((leg 4) (- 4)) '(s g2 d3 b3 a3 b3 d3 b3 d3 g2 d3 b3 a3 b3 d3 b3 d3))
     
    (setf omn       (make-omn        :length '(s)        :pitch (vector-to-pitch '(c2 c5) (gen-sine 64 5 .4))        :span :pitch))
     
    (attribute-series '((leg 4) (stacc 4)) omn)
     
     
    In this example we generate the attribute values and its count separately:
    (setf attr (rnd-sample 12 '(leg stacc -))) => (- - stacc stacc leg - leg - leg stacc leg stacc) (setf div (rnd-sample 12 '(2 3 4 5))) => (4 2 3 5 2 5 4 5 5 5 3 4)  
    The next step is to create lists with two values each containing attribute and its count. The MCLIST function helps us to create such lists:
    (setf series (mclist attr div)) => ((- 4) (- 2) (stacc 3) (stacc 5) (leg 2) (- 5)     (leg 4) (- 5) (leg 5) (stacc 5) (leg 3) (stacc 4)) (attribute-series series omn)  

     
     
     
    PITCH-SEGMENT-VARIANT
     
    This function returns a number of segments of a sequence from an existing list or lists with a defined variant. The segment is defined by the size value (percent) and the number of returned segments. The segment start position is defined by the position value.
     
    (pitch-segment-variant '(c4 d4 e4 f4 g4 a4 b4)                         :percent 50                         :segment 1                         :position 's                         :variant 'r) => (b4 a4 g4 f4)  
     
    Examples:
     
    In the following example the segment count is set to 2. The first segment is 50 percent in size with a retrograde variant, while the second segment is 30 percent in size with an inversion variant:
    (pitch-segment-variant '(c4 d4 e4 f4 g4 a4 b4)                         :percent '(50 30)                         :segment 2                         :position 'e                         :variant '(r i)) => ((f4 e4 d4 c4) (eb3 cs3))  
    To retain the initial sequence in the result we set the :initial option to T. The :lists option set to NIL will flatten the entire process:
    (pitch-segment-variant '(c4 d4 e4 f4 g4 a4 b4)                        :percent '(50 30)                        :segment 2                        :position 'e                        :variant '(r i)                        :initial t                        :lists nil) => (c4 d4 e4 f4 g4 a4 b4 f4 e4 d4 c4 eb3 cs3)  
    (setf omn       (omn-to-time-signature        (make-omn         :length '(s)         :pitch (vector-to-pitch '(c2 c5) (gen-sine 64 5 .4))         :span :pitch)        '(4 4)))
     
     
    The following expression will return 4 segments each 15 percent in size taken from every bar. Each segment is transposed by 13 semitones. The total of return bars is 16 (4 bars x 4 segments):
    (pitch-segment-variant omn :percent 15 :segment 4 :position '? :variant '? :transpose 13 :seed 32)
     
     
    (pitch-segment-variant omn :percent '((20) (30) (40) (100)) :segment '(1 2 3 4) :position '? :variant '? :transpose '((0) (13)) :seed 32)
     
     
    In this example every segment in each bar has its own size, start position, variant and transposition value:
    (setf percent '((30 50 20) (20 50 70) (40 60 70) (50 20 70))) (setf transp '((0 0 0) (13 0 0) (0 0 13) (0 0 13))) (pitch-segment-variant omn :percent percent :segment 3 :position '? :variant '? :transpose transp :seed 32)
     
     
    (pitch-segment-variant omn :percent (gen-eval 3 '(rnd-sample 3 '(40 50 60 80 20 70)) :seed 45) :segment 3 :position '? :variant '? :omit '(a d ad da p) :transpose (gen-eval 3 '(rnd-sample 3 '(0 13)) :seed 35) :seed 45)
     
     
    More examples:
     
    (progn   (init-seed 53)      (setf segments         (quantize          (pitch-segment-variant           (library 'maderna 'serenata-per-un-satellite nil :random 12)           :percent 20           :segment '(1 2 1 2 1 2)           :position '?           :variant '?           :transpose 6)          '(1 2 3 4 5 6 7 8)))      (ps 'gm :treble (list segments)       :tempo 72)      (init-seed nil)   )
     
     
    (progn   (init-seed 34)      (setf segments         (quantize          (pitch-segment-variant           (library 'maderna 'serenata-per-un-satellite nil :random 12)           :percent 20           :segment '(1 2 1 2 1 2)           :position '?           :variant '?           :transpose 6)          '(1 2 3 4 5 6 7 8)))      (ps 'gm :treble (list segments)       :tempo 72)      (init-seed nil)   )
     
     
     
    Best wishes,
    Janusz
  23. Thanks
    Stephane Boussuge got a reaction from AM in convert-to-binary   
    Very interesting, thanks !
  24. Like
    Stephane Boussuge reacted to AM in convert-to-binary   
    this little CONCEPTUAL project goes on:
     
    converting "something" (musical paramters in this case) into a binary form and reconvert it (binary back into musical parameters) => like kind of A/D-D/A-converters and have a look how "the reality is different/changing", experimenting with mapping/resolution etc... i don't think primarily musically with this work but more technically and see what results from that.
     
    ;;; SUB (defun fill-to-x-bit (listseq &key (bitlength 7)) (loop for i in listseq when (< (length i) bitlength) collect (append (gen-repeat (- bitlength (length i)) 0) i) else collect i)) (defun length/rest-to-binary (alist) (loop for i in alist when (length-restp i) collect 0 else collect 1)) ;;;; CONVERTING PITCH/LENGTH or VELOCITY TO BINARY INFORMATION (defun convert-to-binary (alist &key (parameter 'pitch) (lengthspan '(24 100)) (velocity-resolution 127) (pitch-resolution 127) (bitlength 7)) (let ( (alist (progn (setf alist (cond ((stringp alist) (flatten (midi-to-omn alist :instrument 1))) (t alist))) (if (omn-formp alist) (cond ((equal parameter 'pitch) (setf alist (omn :pitch alist))) ((equal parameter 'length) (setf alist (omn :length alist))) ((equal parameter 'velocity) (setf alist (omn :velocity alist)))) alist)))) (cond ((pitchp (car alist)) (progn (setf alist (pitch-to-midi (pitch-melodize alist))) (fill-to-x-bit (decimal-to-binary (vector-round 1 (if (null pitch-resolution) (- (find-max alist) (find-min alist)) pitch-resolution) alist)) :bitlength bitlength))) ((lengthp (car alist)) (fill-to-x-bit (decimal-to-binary (vector-round (car lengthspan) (cadr lengthspan) (mapcar 'float (omn :length alist)))) :bitlength bitlength)) ((velocityp (car alist)) (fill-to-x-bit (decimal-to-binary (vector-round 1 velocity-resolution (get-velocity alist))) :bitlength bitlength))))) ;;;; CONVERTING BINARY INFORMATION BACK TO OMN (defun convert-to-omn (binlist &key (parameter 'pitch) (lengthspan '4/4) (length/rest nil) (velocityspan '(pppp ffff)) (pitchspan '(c3 c5)) (bitlength 8)) (let ((binlist (gen-divide bitlength (flatten binlist)))) (cond ((equal parameter 'pitch) (midi-to-pitch (vector-round (car (pitch-to-midi pitchspan)) (cadr (pitch-to-midi pitchspan)) (binary-to-decimal binlist)))) ((equal parameter 'length) (if (null length/rest) (gen-length-constant (binary-to-decimal binlist) lengthspan) (loop for i in (gen-length-constant (binary-to-decimal binlist) lengthspan) for j in length/rest when (= j 0) collect (* i -1) else collect i))) ((equal parameter 'velocity) (vector-to-velocity (car (get-velocity (list (car velocityspan)))) (car (get-velocity (list (cadr velocityspan)))) (loop for i in (binary-to-decimal binlist) collect (* i (float (/ 1 (sum (binary-to-decimal binlist)))))))))))  
     
    evaluate here and you see the original and reconverted SAMPLE
     
    ;;; SOME EXAMPLES OF THE PROCESS SEQ to BINARY, THEN MAPPED BACK TO OMN ;;; IF THE BITLENGTHS ARE DIFFERENT YOU GET DIFFERENT RESulTS ;;; ALSO DIFFERENT RESULTS WITH VELOCITY / LENGTHS => it depends on RESOLUTION etc... ;; cmd-E or cmd-1 (pitch-list-plot (list (setf seq '(c4 cs5 fs3 c5 f5) );; original (convert-to-omn (convert-to-binary seq :bitlength 32) ;; reconverted :bitlength 32 :pitchspan (get-ambitus seq :type :pitch))) :join-points t) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (length-list-plot (list (setf seq '(-e e -q h e)) ;; original (convert-to-omn (convert-to-binary seq :bitlength 32) ;; reconverted :parameter 'length :length/rest (length/rest-to-binary seq) :bitlength 32 :lengthspan '4/4)) :join-points t) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (velocity-list-plot (list (setf seq '(p p ffff mp )) ;; original (convert-to-omn (convert-to-binary seq :bitlength 32) ;; reconverted :parameter 'velocity :bitlength 32 :velocityspan '(ppp mf))) :join-points t) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  
  25. Like
    Stephane Boussuge reacted to AM in convert-to-binary   
    here is another little function to COMBINE the binary-information i got from CONVERT-TO-BINARY  -> gen a new structure from it
     
    so, with CONVERT-FROM-BINARY and BINARY-LAYER-ADD you could do things like:
    compose music => convert to binary data => generate music by this data  .... ad infinitum 😄 conceptual ....
     
     
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ADDING 3 BINARY-LAYERS IN A WAY THAT INFORMATION COULD BE ENCODED ;;; first layer with 0/1 ;;; second layer with 0/2 ;;; third layer with 0/4 (defun binary-layer-add (lists) (loop for i in (first lists) for j in (second lists) for k in (if (null (third lists)) (gen-repeat (length (second lists)) 0) (third lists)) collect (+ i (* j 2) (* k 4)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (list-plot (binary-layer-add (list (flatten (convert-to-binary '(c4 cs5 fs3 c5 f5) :bitlength 8)) (flatten (convert-to-binary '(-e h -q h e) :bitlength 8)) (flatten (convert-to-binary '(p p ffff mp mf ) :bitlength 8)))) :join-points t :point-radius 0) (list-plot (binary-layer-add (list (flatten (convert-to-binary '(c4 cs5 fs3 c5 f5) :bitlength 32)) (flatten (convert-to-binary '(-e h -q h e) :bitlength 32)) (flatten (convert-to-binary '(p p ffff mp mf ) :bitlength 32)))) :join-points t :point-radius 0) (list-plot (binary-layer-add (list (flatten (convert-to-binary '(c4 cs5 fs3 c5 f5) :bitlength 16)) (flatten (convert-to-binary '(-e h -q h e) :bitlength 16 :length-resolution 64)) (flatten (convert-to-binary '(p p ffff mp mf ) :bitlength 16)))) :join-points t :point-radius 0)  
×
×
  • Create New...

Important Information

Terms of Use Privacy Policy