Jump to content
Sign in to follow this  
torstenanders

Translating MIDI velocities into OMN velocities

Recommended Posts

I want to translate individual MIDI velocity integers into Opusmodus velocities (i.e. dynamics symbols like p and f). I am aware that I can do this with vector-to-velocity, but I am surprised that this transformation is seemingly so difficult. Below is a function that can do that, but perhaps Opusmodus itself should make this more simple.

 

(defun MIDI-velocity->OMN-velocity (velocity)
  "Translates individual MIDI velocity integers into Opusmodus velocity symbols.

Example:
(MIDI-velocity->OMN-velocity 100)
=> fff"
  (let ((scaled-velo (/ velocity 127.0))) ; scale into range 0-1
    (second (vector-to-velocity 0.0 1.0 `(1.0 ,scaled-velo 0)))))

 

Best,

Torsten

 

Share this post


Link to post
Share on other sites

Ah, great!

 

The documentation does not mention that the input can also be MIDI velocity integers, so I missed that. 

 

Best,

Torsten

added 2 minutes later

BTW: I needed that to translate values from OpenMusic data objects into Opusmodus. I am currently working on a library that will bring OpenMusic functions/methods to Opusmodus...

 

Best,

Torsten

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Similar Topics

×
×
  • Create New...