Cockos Incorporated Forums reducing velocity "Dynamic range"
 Register Track Bugs/Feature Requests Search Today's Posts Mark Forums Read

 05-29-2013, 08:10 PM #1 Sound asleep Human being with feelings     Join Date: Nov 2009 Location: Montreal, Canada Posts: 7,537 reducing velocity "Dynamic range" Is there a way with reaper, or maybe some other clever way, where you can select a set of midi notes, and then you average the velocities, and bring them down evenly towards the median? Sort of like a pan width but for velocity? I find this could be a cool feature. __________________ Miles in your Shoes Original tune
 05-29-2013, 08:29 PM #2 James HE Human being with feelings     Join Date: Mar 2007 Location: I'm in a barn Posts: 4,416 you can open the midi note properties, (ctrl + F2 is default i think) and you can divide the selected note velocities by a number. Usually after I do that add add some number back to the group. (instead of divide, I multiply by a number less than one - it just makes it easier on my brain to calculate a percentage. (*.5) cuts the values in half, or 50%. (*.33) makes the values be 33% of what they were. example. note a=120 note b=60 *.5, then note a=60 note b=30 add 40 back in, then note a=100 note b=70 so this, effectively, is what you are wanting to do. it compresses the value range of the velocities. I guess you could figure out some mathematical expression to work out the median after you divide and raise the values back to that. I just usually end up dragging the velocity handle back up till it "looks" right.
05-29-2013, 08:51 PM   #3
Sound asleep
Human being with feelings

Join Date: Nov 2009
Posts: 7,537

Quote:
 Originally Posted by James HE you can open the midi note properties, (ctrl + F2 is default i think) and you can divide the selected note velocities by a number. Usually after I do that add add some number back to the group. (instead of divide, I multiply by a number less than one - it just makes it easier on my brain to calculate a percentage. (*.5) cuts the values in half, or 50%. (*.33) makes the values be 33% of what they were. example. note a=120 note b=60 *.5, then note a=60 note b=30 add 40 back in, then note a=100 note b=70 so this, effectively, is what you are wanting to do. it compresses the value range of the velocities. I guess you could figure out some mathematical expression to work out the median after you divide and raise the values back to that. I just usually end up dragging the velocity handle back up till it "looks" right.
This is genius, and looks like proof to me, that you could relatively easily build an action that could do this.

I'm not sure how to name the increments really though. But easily you could have a smaller one, and just have an action up and down.

And i know, that programming is often more complex than it seems, but this, i think could literally take like 15 minutes to make.

thank you. clever. submitting this to sws thread now.
__________________
Miles in your Shoes Original tune

 05-29-2013, 08:52 PM #4 karbomusic Human being with feelings     Join Date: May 2009 Posts: 26,544 There is a built in JS midi plugin for this IIRC. It doesn't compress all notes but it will bring all velocities above or below certain hi/low thresholds to within those thresholds. Search for velocity it should do real close to what you need.
05-29-2013, 08:57 PM   #5
Sound asleep
Human being with feelings

Join Date: Nov 2009
Posts: 7,537

Quote:
 Originally Posted by karbomusic There is a built in JS midi plugin for this IIRC. It doesn't compress all notes but it will bring all velocities above or below certain hi/low thresholds to within those thresholds. Search for velocity it should do real close to what you need.
also sweet. thank you. One question. does this require me to keep the plugin in my fx chain, or will it actually modify the velocity values, if that is even something plugins can even hypothetically do.
__________________
Miles in your Shoes Original tune

05-29-2013, 08:58 PM   #6
karbomusic
Human being with feelings

Join Date: May 2009
Posts: 26,544

Quote:
 Originally Posted by Sound asleep also sweet. thank you. One question. does this require me to keep the plugin in my fx chain, or will it actually modify the velocity values, if that is even something plugins can even hypothetically do.
It does it on the fly so yea you have to keep it in the chain. However, I eventually render my midi tracks to audio so it doesn't affect me that much.

 05-29-2013, 09:31 PM #7 James HE Human being with feelings     Join Date: Mar 2007 Location: I'm in a barn Posts: 4,416 I think you can do it with MIDI tool II, but you'd need two instances, one modifying the lower range, and one modifying the higher range. I might be misunderstanding how it works, though so don't quote me on that. midi_velocitycontrol looks like it could do the math exactly as I did in my earlier post. Multiply by .5 and add 40. those numbers I gave were pretty arbitrary, and generally that's fine, it's music not math. a plugin effects all notes, mostly when I do this I want just selected notes. The idea of having up and down keys to compress and expand the velocity values sounds really neat... Compress: find the median between the lowest and highest velocity values. *.1 to all the notes above the median line, *1.1 to all the notes below the line. expand: do the opposite... to make that work in REAPER you would, I think, have to use the filter, and save / recall the note selection, all that. It's probably doable *Does Fruity or Cubase have this already?
05-29-2013, 09:55 PM   #8
medicine tactic
Human being with feelings

Join Date: Aug 2012
Location: central Texas
Posts: 962

Quote:
 Originally Posted by James HE *Does Fruity or Cubase have this already?
FL has a level scaling tool, which is really great. It does pretty much what you describe (scaling and offsetting), but also includes the centering control Sound asleep was asking about, and a tension control, and updates the selection in real-time.

And iirc from many years ago, Cubase has a MIDI dynamics plug, as well as its excellent logical editor. It's all probably changed a lot since then, though.

 05-29-2013, 11:31 PM #9 FnA Human being with feelings     Join Date: Jun 2012 Posts: 2,173 I hope we can get some more actions/functions like that for the MIDI editor when they get the framework settled on. That properties trick works alright for velocity, unfortunately decimals are not working for CCs. Also pitch needs to have 0 as center to make the math doable. You can sometimes apply FX to selected events using takes. The macros I made are a little on the obscene side, and I ran into some trouble in the prereleases with them and don't know how that's all going to work out. ReaScript on selected notes looks pretty tough too. Even some of the ones in the stash don't always work out quite right. This thread has lots of nifty stuff including, I believe, what is desired here FX wise. There's more scattered about the place. Thanks to DarkStar and others. Piz is good for this stuff too. http://forum.cockos.com/showthread.php?t=33795
05-29-2013, 11:41 PM   #10
karbomusic
Human being with feelings

Join Date: May 2009
Posts: 26,544

Quote:
 Originally Posted by James HE I think you can do it with MIDI tool II, but you'd need two instances, one modifying the lower range, and one modifying the higher range.
JS: Midi/midi_velocitycontrol is the one I was thinking of.

 05-30-2013, 12:38 AM #11 heda Human being with feelings     Join Date: Jun 2012 Location: Spain Posts: 5,938 I work a lot on velocities. I wouldn't mind some UI drag controls of selected velocities to stretch, compress, or even fade in and out maintaining proportions.
05-30-2013, 09:49 AM   #12
spk77
Human being with feelings

Join Date: Aug 2012
Location: Finland
Posts: 2,668

Quote:
 Originally Posted by James HE Compress: find the median between the lowest and highest velocity values. *.1 to all the notes above the median line, *1.1 to all the notes below the line.
Looks like it's possible with ReaScript:

I'll post the script in "Js/ReaScript discussion" later.

05-30-2013, 10:02 AM   #13
Sound asleep
Human being with feelings

Join Date: Nov 2009
Posts: 7,537

Quote:
 Originally Posted by spk77 Looks like it's possible with ReaScript: I'll post the script in "Js/ReaScript discussion" later.
Sweet. does this work with any set of selected notes only?
__________________
Miles in your Shoes Original tune

05-30-2013, 10:07 AM   #14
James HE
Human being with feelings

Join Date: Mar 2007
Location: I'm in a barn
Posts: 4,416

Quote:
 Originally Posted by spk77 Looks like it's possible with ReaScript: I'll post the script in "Js/ReaScript discussion" later.

Nice! looks like you caught my mistake, i meant *.9 instead of *.1 on the upper range. oops.

or... perhaps this is doing something a bit different? Looks like it, as it's not going in 10% steps. Looking forward to see what you've done here.

Last edited by James HE; 05-30-2013 at 10:14 AM.

05-30-2013, 10:15 AM   #15
spk77
Human being with feelings

Join Date: Aug 2012
Location: Finland
Posts: 2,668

Quote:
 Originally Posted by Sound asleep Sweet. does this work with any set of selected notes only?
Yes. Also, SWS pre-release version should be installed (I'm using v2.3.0 #17).

05-30-2013, 10:39 AM   #16
spk77
Human being with feelings

Join Date: Aug 2012
Location: Finland
Posts: 2,668

Quote:
 Originally Posted by James HE Nice! looks like you caught my mistake, i meant *.9 instead of *.1 on the upper range. oops. or... perhaps this is doing something a bit different? Looks like it, as it's not going in 10% steps. Looking forward to see what you've done here.
Very hard to explain, but here's the "compress" part of the code (noteVelL[j] is "current" note's velocity):
Code:
```        if noteVelL[j] > median:
diff = noteVelL[j] - median
newVel = noteVelL[j] - round(diff * 0.5)
if round(diff * 0.5) < 1:
newVel = noteVelL[j] - 1
FNG_SetMidiNoteIntProperty(note, "VELOCITY", newVel)

elif noteVelL[j] < median:
diff = median - noteVelL[j]
newVel = noteVelL[j] + round(diff * 0.5)
if round(diff * 0.5) < 1:
newVel = noteVelL[j] + 1
FNG_SetMidiNoteIntProperty(note, "VELOCITY", newVel)```
I posted it in the "Js/ReaScript discussion":

Last edited by spk77; 05-30-2013 at 10:51 AM.

05-30-2013, 11:10 AM   #17
MidiDreamer
Human being with feelings

Join Date: Mar 2012
Location: Finally HOME in OREGON!
Posts: 562

Quote:
 Originally Posted by medicine tactic its excellent logical editor
This! I was just thinking the other day, how I miss the logical editor from my (ancient) Steinberg Pro24.

Anybody here remember? Strange how sometimes our progression is regressive.

Anyways, as I always say, I Love Reaper.

Peace

05-30-2013, 11:28 AM   #18
James HE
Human being with feelings

Join Date: Mar 2007
Location: I'm in a barn
Posts: 4,416

Quote:
 Originally Posted by spk77 Very hard to explain, but here's the "compress" part of the code (noteVelL[j] is "current" note's velocity): Code: ``` if noteVelL[j] > median: diff = noteVelL[j] - median newVel = noteVelL[j] - round(diff * 0.5) if round(diff * 0.5) < 1: newVel = noteVelL[j] - 1 FNG_SetMidiNoteIntProperty(note, "VELOCITY", newVel) elif noteVelL[j] < median: diff = median - noteVelL[j] newVel = noteVelL[j] + round(diff * 0.5) if round(diff * 0.5) < 1: newVel = noteVelL[j] + 1 FNG_SetMidiNoteIntProperty(note, "VELOCITY", newVel)``` I posted it in the "Js/ReaScript discussion": http://forum.cockos.com/showthread.php?t=123802
Looks like they are scaled by half of the value between the median and the current velocity. Very cool.

 05-30-2013, 12:16 PM #19 FnA Human being with feelings     Join Date: Jun 2012 Posts: 2,173 It is pretty cool. Your code looks (to a script noob) to be pretty compact. A good study aid. Any tips on getting a fast track learning method? I'm just reading through the python documentation tutorial, and digging through everybody's scripts. Thanks for your offerings so far anyway.
05-30-2013, 12:44 PM   #20
spk77
Human being with feelings

Join Date: Aug 2012
Location: Finland
Posts: 2,668

Quote:
 Originally Posted by FnA I'm just reading through the python documentation tutorial, and digging through everybody's scripts.
That's what I'm doing too as I still consider myself a beginner. I guess the best way to learn is to write code. (And of course a lot of copy/paste from internet )

Stack Overflow seems to be a good place to find information:
http://stackoverflow.com/questions/1...to-find-median

05-30-2013, 01:11 PM   #21
Sound asleep
Human being with feelings

Join Date: Nov 2009
Posts: 7,537

Quote:
 Originally Posted by spk77 That's what I'm doing too as I still consider myself a beginner. I guess the best way to learn is to write code. (And of course a lot of copy/paste from internet ) Stack Overflow seems to be a good place to find information: http://stackoverflow.com/questions/1...to-find-median
lol, god bless the internet for that. You still have to understand what it is you are copy pasting, and you might often want to make some modifications, but being able to do that is so great. I love you internet.
__________________
Miles in your Shoes Original tune

 05-30-2013, 05:03 PM #22 chriscomfort Human being with feelings     Join Date: Aug 2009 Location: NYC Posts: 1,738 I personally need to look into the ReaScripts and python stuff more, but here is a really powerful JS plug for doing all kinds of velocity work: http://forum.cockos.com/attachment.p...2&d=1212723993 Keep in mind that like any plug, you can automate the Wet Knob in the upper right corner to apply the compression/etc on a section of a MIDI item. The first and last sliders are actually Meters which show the incoming and outgoing velocities. __________________ http://chriscomfortmusic.com
 05-31-2013, 09:22 AM #23 spk77 Human being with feelings   Join Date: Aug 2012 Location: Finland Posts: 2,668 Another MIDI velocity related script: Select notes by velocity (add to selection) http://forum.cockos.com/showthread.php?t=123855 Last edited by spk77; 05-31-2013 at 09:29 AM.
 05-31-2013, 09:32 AM #24 Lawrence Human being with feelings   Join Date: Mar 2007 Posts: 21,554 I'm sure it's obvious to everyone involved but compressing velocities manually is pretty easy, by using the upper limit as the threshold, for those times when you just need a quick adjustment for a certain range of notes, not necessarily as a replacement for more complex edits.

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home REAPER Forums     REAPER General Discussion Forum     newbieland     REAPER Q&A, Tips, Tricks and Howto     Recording Technologies and Techniques     REAPER Compatibility     REAPER Color Themes and Icon Sets     MIDI Hardware, Control Surfaces, and OSC     REAPER Non-English Speaking User Forums         Forum de REAPER en français         Foro de REAPER en Español         Fórum do REAPER em português         Forum di REAPER in italiano         Deutschsprachiges REAPER Userforum         Pyccкоязычный фopyм REAPER     REAPER Bug Reports     REAPER Feature Requests     Dstruct's Casa De Nitpicks     REAPER for Live Use     REAPER for Video Editing/Mangling     REAPER for Ambisonic and 3D positional audio uses     ReaScript, JSFX, REAPER Plug-in Extensions, Developer Forum     REAPER for macOS X     REAPER for Linux     REAPER Pre-Release Discussion     REAPER Music/Collaboration Discussion NINJAM Discussion     NINJAM User Discussion     NINJAM Developer Discussion Other Software Discussion     WDL users forum     LICEcap Discussion     OSCII-bot forum     Old Cockos Products Forum

All times are GMT -7. The time now is 06:33 PM.

 -- Cockos ---- REAPER 5 ---- Reaper 3 ---- Reaper 2 ---- Reaper 1 Contact Us - Çockos Incorporated - Archive - Top