Jump to content

torstenanders

Members
  • Posts

    496
  • Joined

  • Last visited

Reputation Activity

  1. Thanks
    torstenanders got a reaction from loopyc in sorting algorithms   
    Simply slightly edit the algorithms below by inserting some additional output. Below I simply took one of the algorithms you linked and added a single print statement. If instead you want to collect all the results, then just accumulate them in some variable with a scope surrounding your algorithm function.
    (defun bubble-sort/naive (sequence)   (let ((end (length sequence)))     (labels ((compare-and-swap (index modified)                ;; print intermediate results                (print sequence)                (if (= index (1- end))                    (if modified (compare-and-swap 0 nil) (values))                    (let ((index+1 (1+ index)))                      (if (> (elt sequence index) (elt sequence index+1))                          (let ((x (elt sequence index)))                            (setf (elt sequence index) (elt sequence index+1)                                  (elt sequence index+1) x)                            (compare-and-swap index+1 t))                          (compare-and-swap index+1 modified))))))       (unless (< end 2)         (compare-and-swap 0 nil))       sequence))) (bubble-sort/naive '(3 1 9 5 3 6 4 2 3 7))
    Best,
    Torsten
  2. Like
    torstenanders got a reaction from Stephane Boussuge in tonality-map: controlling in which octave tones occur   
    I like how the function tonality-map allows specifying some input harmony (called tonality) and raw music, where the "raw" music is then quasi-quantised into the given harmony. 
     
    However, I would like to control in which octaves specific tones are allowed to occur. tonality-map allows specifying an underlying harmony that ranges over multiple octaves, but it seems that internally only octave-less pitch classes are used, and any tone in the harmony can occur in any octave in the result. By contrast, in the spectral tradition of music thinking, you change the underlying spectrum if you scramble in which octaves pitches occur. For example, if you have a spectrum or chord that approximates the overtone series, then that spectrum sounds rather consonant, regardless how far up in the overtone series you allow tones to be included. However, if you then randomly octave-transpose the pitches of this spectrum/chord, then it can become much more dissonant, without changing any pitch classes.
     
    To be more specific here is a dummy example with simple traditional chords where tones are distributed across octaves in a certain way. 
     
    (tonality-map   ;; underlying harmony or spectra  '((c4g4e5b5d6) (g3d4b5f5a4))  ;; input music  '((h c4f5 cs4fs5) (d4g5 cs4gs5) (eb4as5 f4a5) (e4gs5 c4gs5))  ;; harmonic rhythm  :time '(w w w_w)) => ((h c4e5 c4g5) (h a3d5 g3d5) (h e4b5 e4b5) (h e4g5 c4g5))  
    As you can see, the tone G in the first tonality occurs only in octave 4, but in the result, in the second chord of the first bar (still following the first tonality) we have a g5 instead. Now, you might feel that the g5 does not musically do any harm, but in the second tonality, there is an A only in octave 6, while in the function output in the related third chord the A occurs three octaves lower in octave 3, where it greatly increases the dissonance degree of this chord/scale. 
     
    So, is there a way to restrict the octaves of tones in the result to be restricted to the octaves of these tones in the respective tonalities? Alternatively, is there another function that complements tonality-map, where I can force some "raw" music to follow some underlying harmony with a given harmonic rhythm, and where the octaves of the resulting pitches can be restricted?
     
    Thank you! 
     
    Best,
    Torsten
  3. Like
    torstenanders reacted to opmo in Posting seed value   
    I think it will help us to work even more freely and this is what we expect from Opusmodus :-) Thank you for the suggestion.
  4. Like
    torstenanders got a reaction from lviklund in Posting seed value   
    Citing the documentation: "INIT-SEED can be used at the start of algorithmic compositions employing high degrees of randomness in order to create consisted results, without having to worry about supplying seed N values to all the other functions which may also use random generation."
     
    The function init-seed does not give you any new value actually (it just returns its argument), but in the background as a side-effect initialises the random generation of all Opusmodus random functions, so that their results are consistent on re-evaluation. 
     
    Just try removing it in your function :)
     
    Besides, programs that reduce any changes to global states and side effects to the absolute minimum (which is most often using no stateful programming at all) are more easy to maintain and expand. Your little function introduces two stateful operations that are not needed here: setf (better use a local let) and init-seed. (This is even more important when writing concurrent code, which can be necessary when doing real-time stuff, e.g., when you have multiple processes running in parallel changing the same global variables without further precaution.)   
     
    Best,
    Torsten
  5. Like
    torstenanders reacted to opmo in Posting seed value   
    I found a way to display an internal seed if seed is nil (random process).
     
    Example without a seed (each time different result):
    (rnd-number 12 1 10) ? rnd-number :seed 678732 => (10 6 10 6 1 9 5 6 10 2 4 2)  
    Now the same function with a manually "lock" using the :seed
    (rnd-number 12 1 10 :seed 678732) ? rnd-number :seed 678732 => (10 6 10 6 1 9 5 6 10 2 4 2)  
    (rnd-pick '((q c4 p d4 ff s a4 stacc) (s e4 app q c5 d5 pp))) ? rnd-pick :seed 598336 => (q c4 p d4 ff s a4 stacc)  

     
    I hope everybody will be happy with the solution  :-)
    To add this functionality to all the functions using random seed will take some time to do.
    Hopefully tomorrow :-)
     
    Best,
    Janusz
  6. Like
    torstenanders got a reaction from Jorgalad in Easiest way to add click track / Metronome in OM   
    Wow, that is fancy :)
     
    Here is one that is even slightly more fancy, where the resulting softer velocity values also react to the velocity input, and also the pitch of easy beats is slightly different.   
     
    (defun metronome (sequence &key (pitch 'c4) (velocity 90))
      (let* ((ts (get-time-signature sequence))
             (len (loop for i in ts
                    collect (gen-repeat (car i) (list (/ 1 (second i))))))
             (vel (loop for i in ts
                    collect (append (get-velocity (list velocity) :type :symbol)
                                    (gen-repeat (1- (car i)) 
                                                (get-velocity (list (- velocity 25))
                                                              :type :symbol)))))
             (pitch (loop for i in ts
                      collect (cons pitch
                                    (pitch-transpose 
                                     -2 (gen-repeat (1- (car i)) pitch))))))
        (make-omn :length len
                  :pitch pitch
                  :velocity vel)))
     
    TA
  7. Like
    torstenanders got a reaction from AM in Easiest way to add click track / Metronome in OM   
    Wow, that is fancy :)
     
    Here is one that is even slightly more fancy, where the resulting softer velocity values also react to the velocity input, and also the pitch of easy beats is slightly different.   
     
    (defun metronome (sequence &key (pitch 'c4) (velocity 90))
      (let* ((ts (get-time-signature sequence))
             (len (loop for i in ts
                    collect (gen-repeat (car i) (list (/ 1 (second i))))))
             (vel (loop for i in ts
                    collect (append (get-velocity (list velocity) :type :symbol)
                                    (gen-repeat (1- (car i)) 
                                                (get-velocity (list (- velocity 25))
                                                              :type :symbol)))))
             (pitch (loop for i in ts
                      collect (cons pitch
                                    (pitch-transpose 
                                     -2 (gen-repeat (1- (car i)) pitch))))))
        (make-omn :length len
                  :pitch pitch
                  :velocity vel)))
     
    TA
  8. Thanks
    torstenanders reacted to opmo in Changing MIDI channels with articulations   
    In 1.2.23106 I made few correction to the accents relative duration.
    Only stacc and stacs is a bit shorter now, all other accents will not change the midi duration.
     
    Janusz
  9. Like
    torstenanders reacted to Yuichi Yamamoto in Quantization   
    Hi people,

    Though I've been using Opusmodus for about 2 years now, and in great love with it,
    I haven't really had a chance to share my work on the community.

    But here I have my piano piece vastly written with Opusmodus, and guess what, it's got a cool video, too!

    Yamaha corporation kindly offered me to use their automated piano for filming, and I think an algorithmic music like this goes very well with it!

    Yuichi
  10. Like
    torstenanders reacted to opmo in Quantization   
    Thank you Yuichi for sharing, great piece, I am very happy to see Opusmodus is able to help you realise your ideas.
  11. Like
    torstenanders got a reaction from lviklund in Playback of articulations   
    It would be useful for playback, if certain articulations would affect the sounding note durations and velocity values. With some articulations this already seems to be the case (e.g., stacc seems to reduce note durations by 50%), while other articulations are ignored during playback in that regard (e.g., leg is notated, but makes seemingly no difference in playback -- notes played legato are not overlapping, as would be expected, nor are non-legato notes very slightly separated). Other articulations are seemingly even wrongly set (e.g., marc is an accent, but it instead shortens the note).
     
    Here is a little example demonstrating the problem, which results in the attached MIDI file.
    EDIT: The upload failed, but you can easily listening to this or export it to MIDI yourself.
     
    '((e c4 leg d4 e4 leg f4) (q g4 marc -q -h))
     
    Can users somewhere set/correct these playback settings?
     
    BTW: Ideally settings would allow for code (functions) evaluationed on the fly. That would allow, e.g., to add custom humanisation, e.g., to slightly vary the length of staccato articuations, or the velocity values set by non-legato notes.... 
     
    Thanks!
     
    Best,
    Torsten
  12. Like
    torstenanders reacted to Stephane Boussuge in Playback of articulations   
    i agree totally :-)
     
    Actually, i always finish my scores in a DAW for such reason but with this new possibilities into Opusmodus, it would be no more necessary and i love the idea to stay in Opusmodus from start to end of the music process.
     
    SB.
  13. Like
    torstenanders got a reaction from Stephane Boussuge in Playback of articulations   
    It would be useful for playback, if certain articulations would affect the sounding note durations and velocity values. With some articulations this already seems to be the case (e.g., stacc seems to reduce note durations by 50%), while other articulations are ignored during playback in that regard (e.g., leg is notated, but makes seemingly no difference in playback -- notes played legato are not overlapping, as would be expected, nor are non-legato notes very slightly separated). Other articulations are seemingly even wrongly set (e.g., marc is an accent, but it instead shortens the note).
     
    Here is a little example demonstrating the problem, which results in the attached MIDI file.
    EDIT: The upload failed, but you can easily listening to this or export it to MIDI yourself.
     
    '((e c4 leg d4 e4 leg f4) (q g4 marc -q -h))
     
    Can users somewhere set/correct these playback settings?
     
    BTW: Ideally settings would allow for code (functions) evaluationed on the fly. That would allow, e.g., to add custom humanisation, e.g., to slightly vary the length of staccato articuations, or the velocity values set by non-legato notes.... 
     
    Thanks!
     
    Best,
    Torsten
  14. Like
    torstenanders got a reaction from JulioHerrlein in Changing MIDI channels with articulations   
    It would also be useful, e.g., for combining sample instruments by different brands etc. where certain articulations are available in one plugin, and others in another.
     
    Best,
    Torsten
  15. Like
    torstenanders reacted to opmo in Changing MIDI channels with articulations   
    We will add this, I love it too :-)
  16. Thanks
    torstenanders got a reaction from JulioHerrlein in Changing MIDI channels with articulations   
    How is it possible to change the MIDI output channel of an instrument? For example, when writing for organ, you have two staffs for the right and left hand, but hands can change manuals, and this is best represented by different MIDI channels. Is there a way to define articulations that result in changing the MIDI channel?
     
    Thanks!
     
    Best,
    Torsten
  17. Thanks
    torstenanders got a reaction from lviklund in Modelling Tonality (1) Diatonic Transposition (some intuitions)   
    You already know how to translate a MIDI pitch number into a representation consisting of two pieces of information, a pitch class integer and an octave integer. The conversion can be applied in both directions.
     
    Now, you can apply a similar conversion to a pitch class integers, converting them into a scale degree (integer) and an accidental (another integer), depending on a scale (a set of pitch classes). Again, this conversion can be done in both ways (there are multiple solutions if you allow for enharmonic equivalence).
     
    Once you have such a representation, you can then do diatonic transpositions (depending on whatever scale) within the scale degree domain, and finally translate your  results back into pitch classes, or MIDI pitch numbers.
     
    I have a draft of a paper discussing this formally. A preliminary version of this paper has been published at SMC, http://uobrep.openrepository.com/uobrep/handle/10547/622264 Don't get scared away by the constraint programming aspect. Such conversions can also be implemented as plain deterministic functions.
     
    This can be seen as a kind of mapping, if you want, if you also see the relation between MIDI pitch numbers and pitch classes as a mapping :)
     
    Best,
    Torsten
     
  18. Like
  19. Thanks
    torstenanders got a reaction from JulioHerrlein in Modulo 12 Function ?   
    You can roll such a function easily yourself. The modulus function is part of Common Lisp.
     
    ;; modulus 12 of 60
    (mod 60 12)
    ; => 0
     
    (defun mod12 (xs)
      (loop for x in xs
        collect (mod x 12)))
     
    (mod12 '(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 24 48))
    ; => (0 1 2 3 4 5 6 7 8 9 10 11 0 1 2 3 4 5 6 7 0 0)
     
    To empower yourself, once you know how to program a simple function, you simply need to google for the modulus function
     
      http://lmgtfy.com/?q=common lisp modulo
     
    :)
     
    Best,
    Torsten
  20. Thanks
    torstenanders got a reaction from JulioHerrlein in Modelling Tonality (1) Diatonic Transposition (some intuitions)   
    You already know how to translate a MIDI pitch number into a representation consisting of two pieces of information, a pitch class integer and an octave integer. The conversion can be applied in both directions.
     
    Now, you can apply a similar conversion to a pitch class integers, converting them into a scale degree (integer) and an accidental (another integer), depending on a scale (a set of pitch classes). Again, this conversion can be done in both ways (there are multiple solutions if you allow for enharmonic equivalence).
     
    Once you have such a representation, you can then do diatonic transpositions (depending on whatever scale) within the scale degree domain, and finally translate your  results back into pitch classes, or MIDI pitch numbers.
     
    I have a draft of a paper discussing this formally. A preliminary version of this paper has been published at SMC, http://uobrep.openrepository.com/uobrep/handle/10547/622264 Don't get scared away by the constraint programming aspect. Such conversions can also be implemented as plain deterministic functions.
     
    This can be seen as a kind of mapping, if you want, if you also see the relation between MIDI pitch numbers and pitch classes as a mapping :)
     
    Best,
    Torsten
     
  21. Like
    torstenanders reacted to opmo in euclidean to interval   
    PATTERN-MAP
     
    (pattern-map '((1 0) 2) (gen-binary-euclidean 1 14 8 8)) => (2 1 2 2 2 1 2 2)  
  22. Like
    torstenanders reacted to Stephane Boussuge in Requiem for Nigel   
    I consider Nigel was my most important music comp. teacher even if we had mainly only mails exchange and few meetings and i will be always thankful to him for his always very constructives advices.
     
    S.
  23. Like
    torstenanders reacted to opmo in Quantisation?   
    Few QUANTIZE examples:
     
    (setf val1 (gen-white-noise 19 :seed 56)) => (0.42731586 0.21048035 0.14944322 0.05199222 0.33933866 0.8851649 0.93565786 0.93476516 0.3839242 0.03127964 0.39819628 0.18478736 0.9568939 0.6663358 0.26542348 0.4052874 0.68264747 0.95090246 0.12790146) (quantize val1 '(3 5 7)) => (7h. 7q 7q 7q 7q_3q 3h_t e. t_e.. t_s t s. t t_5w 5q_e s s_5q 5h. 5q_e. s)
     
    (setf val2 (gen-white-noise 19 :scale 2.2 :seed 875)) => (0.5896695 1.3854954 1.7601246 0.15660097 1.0577743 2.005573 0.8151905 0.83697665 0.17089269 1.5035293 0.97181803 0.54288834 1.810276 1.551678 2.1626956 0.7790575 1.5867842 1.6030518 1.3905888) (quantize val2 '(3 5 7)) => (e e_e.. t_q_7wq 7q 7q_e.. t_q_e.. t_3h 3q_e s s_q_e e_s e s_q_e e_q_s e._q_e e_5q 5w_e e_q_e e_q)
     
    (setf val3 (vector-range -1.0 1.0 (gen-white-noise 19 :seed 154))) => (-0.24158841 -0.9634026 -0.99552864 -0.4178778 0.9713292 -0.58351946 -0.77635634 0.532539 0.4349326 -0.85446167 -0.9610649 -0.9799211 1.000001 -0.4322123 0.3123653 -1.0 0.74611676 0.66992795 -0.034718752) (quantize val3 '(3 5 7)) => (-3q -3h -3q -3h -3q -3q 3q_e -e -7q -7wq 7q_3q 3q -3q -3h -3q -e -e -e e_e -e -s s -e -e e_e e)
     
    Best wishes, J
  24. Thanks
    torstenanders reacted to opmo in Quantisation?   
    Achim Bornhoeft and I we had a brain storming session on quantisation here in Venice for two days.
    The code will be ready for testing in few days.
    The holidays might delay the release a bit.
    The test are already very promising :-)
  25. Like
    torstenanders got a reaction from AM in Quantisation?   
    Does Opusmodus perhaps already have some quantisation function that expects a list of floats and that basically rounds these floats into a metric rhythm, including using tuplets? 
     
    I am aware of vector-to-length – that implements a simple form of what I am looking for, but it does not support tuplets. Other algorithmic composition systems have more sophisticated quantisation facilities. For example, OpenMusic provides the box omquantify (among other functions in the Kant library). 
     
      http://support.ircam.fr/docs/om/om6-manual/co/Quantification.html
     
    I am aware that quantification is a complex process, but perhaps that is already there in Opusmodus.
     
    Best,
    Torsten
     
     
×
×
  • Create New...

Important Information

Terms of Use Privacy Policy