Tagged: velocities Toggle Comment Threads | Keyboard Shortcuts

  • Michael Edwards 10:15 on June 14, 2016 Permalink | Reply
    Tags: hairpins, midi-play, velocities   

    The first functionality update that arose out of the Goldsmiths symposium last weekend was a fix to the way MIDI velocities are handled. As of the latest svn-latest check-in (2 mins ago) when you call midi-play, event velocities will reflect the last dynamic seen in any given part (rather than retaining their default velocity). Also, if you have hairpins (crescendo/diminuendo marks), then the notes that are under these will have correspondingly increasing/decreasing amplitudes.

  • Michael Edwards 11:33 on June 8, 2016 Permalink | Reply
    Tags: , velocities   

    Dan’s advice is to keep Disklavier velocities to within the 30 to 90 range. I’ve just implemented the rescale function to help with this (see below) so if you have events with amplitudes between 0.0 and 1.0 then the following would map those to velocities of 30 to 90:

    (midi-play +jitterbug+ :force-velocity
    	   #'(lambda (event) 
    	       (round (rescale (amplitude event) 0 1 30 90))))

    ;;; ****f* utilities/rescale
    ;;; DATE
    ;;; June 8th 2016, Edinburgh
    ;;; Given a value within an original range, return its value withing a new range
    ;;; - the value we want to rescale
    ;;; - the original minimum
    ;;; - the original maximum
    ;;; - the new minimum
    ;;; - the new maximum
    ;;; The value within the new range (a number)
    ;;; EXAMPLE
    (rescale .5 0 1 0 100)
    ==> 50.0
    ;;; SYNOPSIS
    (defun rescale (val min max new-min new-max)
    ;;; ****
      (when (or (>= min max)
                (>= new-min new-max))
        (error "utilities::rescale: argument 2 (~a) must be < argument 3 (~a) ~
                ~%and sim. for argument 4 (~a) and 5 (~a)" min max new-min new-max))
      (unless (and (>= val min)
                   (<= val max))
        (error "utilities::rescale: first argument (~a) must be within original ~
                range (~a to ~a)" val min max))
      (let* ((range1 (float (- max min)))
             (range2 (float (- new-max new-min)))
             (prop (float (/ (- val min) range1))))
        (+ new-min (* prop range2))))
    • Daniel Ross 12:54 on June 9, 2016 Permalink | Reply

      Misspelling in your code, mate. There is a space between ‘<' and '=' in your unless clause.

      • Michael Edwards 12:56 on June 9, 2016 Permalink | Reply

        there isn’t, it just looks like it :/ saw that yesterday but it’s wordpress screwing display up–if I edit the post there’s no space. anyway, (update-app-src) and you should get all the new glory

        • Daniel Ross 13:13 on June 9, 2016 Permalink | Reply

          Ah cool. It is there if you copy and paste direct from above, but no probs if it’s on the svn anyway.

compose new post
next post/next comment
previous post/previous comment
show/hide comments
go to top
go to login
show/hide help
shift + esc