Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Q&A, Tips, Tricks and Howto

Reply
 
Thread Tools Display Modes
Old 03-03-2019, 05:02 AM   #1
Winfield
Human being with feelings
 
Winfield's Avatar
 
Join Date: Jan 2007
Location: The Underground Bunker
Posts: 705
Default How do I adjust track volume via modifier on mousewheel?

Hi
I would like to use a mouse modifier (say, ctrl) and then use the mousewheel to control the volume of the selected track(s) - is that possible?

I'm not able to use the general setting of using mousewheel to adjust track volume - it always end up in a situation where volumes inadvertently get adjusted when scrolling the tcp. So I have checked 'ignore mouse wheel on all faders'.

Thank you.
-W
__________________
"if DAWs are religions, REAPER is atheism" - The big J
__________________
Windows 10x64 | Asus Z170-a i7, 32GB ram | RME-Digiface USB
Winfield is offline   Reply With Quote
Old 03-18-2019, 01:14 AM   #2
Winfield
Human being with feelings
 
Winfield's Avatar
 
Join Date: Jan 2007
Location: The Underground Bunker
Posts: 705
Default

Just in case anyone else was wondering - I don't think it can be done.
I ended up using the 'track inspector' (effectively the mixer) as explained here:
https://www.youtube.com/watch?v=iVBZrHktClQ

-W
__________________
"if DAWs are religions, REAPER is atheism" - The big J
__________________
Windows 10x64 | Asus Z170-a i7, 32GB ram | RME-Digiface USB
Winfield is offline   Reply With Quote
Old 03-18-2019, 02:41 AM   #3
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,960
Default

Assign this lua script to mousewheel (this also require SWS Extension installed):

Code:
--------------------------------------------------------------------
  function main()
    local is_new_value,filename,sectionID,cmdID,mode,resolution,val = reaper.get_action_context()
    if val == 0 or not is_new_value then return end
    if val > 0 then val = 1 else val = -1 end
    
    local incr = 0.1 -- dB
    
    local window, segment, details = reaper.BR_GetMouseCursorContext()
     tr = reaper.BR_GetMouseCursorContext_Track()
    if not tr then return end
    
    local tr_vol = reaper.GetMediaTrackInfo_Value( tr, 'D_VOL' )
    local tr_vol_db = WDL_VAL2DB(tr_vol)
    local tr_vol_out = math.max(WDL_DB2VAL(tr_vol_db + val*incr),0)
    reaper.SetMediaTrackInfo_Value( tr, 'D_VOL' ,tr_vol_out )
  end
  --------------------------------------------------------------------
  function WDL_DB2VAL(x) return math.exp((x)*0.11512925464970228420089957273422) end  --https://github.com/majek/wdl/blob/master/WDL/db2val.h
  --------------------------------------------------------------------
  function WDL_VAL2DB(x, reduce)   --https://github.com/majek/wdl/blob/master/WDL/db2val.h
    if not x or x < 0.0000000298023223876953125 then return -150.0 end
    local v=math.log(x)*8.6858896380650365530225783783321
    if v<-150.0 then return -150.0 else 
      if reduce then 
        return string.format('%.2f', v)
       else 
        return v 
      end
    end
  end
  --------------------------------------------------------------------
  main()
mpl is offline   Reply With Quote
Old 03-21-2019, 08:17 AM   #4
Winfield
Human being with feelings
 
Winfield's Avatar
 
Join Date: Jan 2007
Location: The Underground Bunker
Posts: 705
Default

Great - thanks!

-W
__________________
"if DAWs are religions, REAPER is atheism" - The big J
__________________
Windows 10x64 | Asus Z170-a i7, 32GB ram | RME-Digiface USB
Winfield is offline   Reply With Quote
Old 03-21-2019, 10:21 AM   #5
Winfield
Human being with feelings
 
Winfield's Avatar
 
Join Date: Jan 2007
Location: The Underground Bunker
Posts: 705
Default

So, I've been trying to use this script as a mouse modifier (set up via the mouse-mod menu in reaper). I got the script set as a mouse modifier (via 'alt') but it's not working - any help on how to use this would be welcome Thanks again.

-W
__________________
"if DAWs are religions, REAPER is atheism" - The big J
__________________
Windows 10x64 | Asus Z170-a i7, 32GB ram | RME-Digiface USB
Winfield is offline   Reply With Quote
Old 03-21-2019, 10:41 AM   #6
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,769
Default

I got it working. I copied all the code above into a file "control faders with mousewheel.lua" and then opened Reaper actions and clicked Load for reascript and then assigned in my case Ctrl+Shift+Mousewheel to the action. Now when I over over my TCP track faders and do Ctrl+Shift+Mousewheel the fader moves. The increment that it moves is silky smooth too !

I hope it helps.

__________________
Track Freezing Scripts

Coachz Repo
Coachz is offline   Reply With Quote
Old 03-21-2019, 10:58 AM   #7
J Reverb
Human being with feelings
 
Join Date: Jul 2009
Posts: 1,071
Default

Thanks MPL for script and Winfield for request.

This is so useful for moving the fader (holding modifier) and having it snap back to it's original value on release.
Great for Automation.
Awesome stuff.

Last edited by J Reverb; 03-21-2019 at 11:04 AM.
J Reverb is offline   Reply With Quote
Old 03-21-2019, 11:05 AM   #8
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,769
Default

mine doesn't snap back but I don't want it to anyways
__________________
Track Freezing Scripts

Coachz Repo
Coachz is offline   Reply With Quote
Old 03-21-2019, 11:18 AM   #9
J Reverb
Human being with feelings
 
Join Date: Jul 2009
Posts: 1,071
Default

Quote:
Originally Posted by Coachz View Post
mine doesn't snap back but I don't want it to anyways
Sorry I meant when using in write mode, handy
J Reverb is offline   Reply With Quote
Old 03-21-2019, 11:21 AM   #10
Winfield
Human being with feelings
 
Winfield's Avatar
 
Join Date: Jan 2007
Location: The Underground Bunker
Posts: 705
Default

Thanks for the how-to-guide i will try it out later.

Could the same script also be made to work on the track pans?

-W
__________________
"if DAWs are religions, REAPER is atheism" - The big J
__________________
Windows 10x64 | Asus Z170-a i7, 32GB ram | RME-Digiface USB
Winfield is offline   Reply With Quote
Old 03-21-2019, 11:38 AM   #11
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,769
Default

Quote:
Originally Posted by J Reverb View Post
Sorry I meant when using in write mode, handy
Do you mean touch mode which does snap back ?
__________________
Track Freezing Scripts

Coachz Repo
Coachz is offline   Reply With Quote
Old 03-21-2019, 11:45 AM   #12
J Reverb
Human being with feelings
 
Join Date: Jul 2009
Posts: 1,071
Default

Yes like touch but one better as you can adjust the volume before it snaps back on the fly.
Kind of a touch/write

Go into write
Adjust volume
hold modifier and adjust
Release
J Reverb is offline   Reply With Quote
Old 03-21-2019, 11:51 AM   #13
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,769
Default

not sure. When in write mode here on volume automation my mousewheel modifier doesn't do anything. In read mode it adjusts the fader fine.
__________________
Track Freezing Scripts

Coachz Repo
Coachz is offline   Reply With Quote
Old 03-21-2019, 12:14 PM   #14
J Reverb
Human being with feelings
 
Join Date: Jul 2009
Posts: 1,071
Default

Hold modifier then mouse click and move the fader, release.
Sorry should have explained a bit better.
This obviously isn't what the script is for.. just stumbled upon
J Reverb is offline   Reply With Quote
Old 03-21-2019, 01:29 PM   #15
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,769
Default

oh yeah that feature has been around for a long time.
__________________
Track Freezing Scripts

Coachz Repo
Coachz is offline   Reply With Quote
Old 03-21-2019, 02:21 PM   #16
J Reverb
Human being with feelings
 
Join Date: Jul 2009
Posts: 1,071
Default

ah ok where is that then ? must have overlooked it, ta.
J Reverb is offline   Reply With Quote
Old 03-21-2019, 02:57 PM   #17
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,769
Default

Quote:
Originally Posted by J Reverb View Post
ah ok where is that then ? must have overlooked it, ta.
where is touch automation ?

https://www.youtube.com/watch?v=4csw2GIT76Q
__________________
Track Freezing Scripts

Coachz Repo
Coachz is offline   Reply With Quote
Old 03-21-2019, 03:11 PM   #18
J Reverb
Human being with feelings
 
Join Date: Jul 2009
Posts: 1,071
Default

Yeah I know touch ?
Touch will always chase/snap to the current envelope value when releasing the fader.

This way you can adjust the initial value on the fly staying in write mode. It's a different behaviour.
Anyway try the two methods side by side and you should see what I'm on about.
J Reverb is offline   Reply With Quote
Old 03-21-2019, 03:25 PM   #19
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,769
Default

when I used this mousewheel script in write mode nothing happened. Are we talking about the same thing ?
__________________
Track Freezing Scripts

Coachz Repo
Coachz is offline   Reply With Quote
Old 03-21-2019, 04:23 PM   #20
J Reverb
Human being with feelings
 
Join Date: Jul 2009
Posts: 1,071
Default

I'm not sure either hehe

The script is replacing the normal volume control therefore we can use as an extra control layer when in write mode.

If you hold the modifier key and move the volume with the mouse pointer instead of the mouse wheel you will notice it snaps back to the current volume level.

So .. adjusting the volume level with the script (mousewheel) lets you set a level, then using the mouse pointer to drag the volume with the modifier held down while writing automation and it snaps back on release.

Hope that's clear, not sure if we were on the same page there..
J Reverb is offline   Reply With Quote
Old 03-21-2019, 05:59 PM   #21
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,769
Default

When you are in the read mode, during playback it is reading the automation and any move you make with the fader will snap back to the value that is currently set. I'm not sure what you're trying to do in write mode, but write mode is for writing automation data. Of course latch mode latches the value until the fader is then moved again whereas is touch mode only holds the value until the fader is released. I'm not sure what you're trying to do or demonstrate but that's how automation works regardless of whether you use the mouse pointer on the fader or the mouse wheel over the fader.
__________________
Track Freezing Scripts

Coachz Repo
Coachz is offline   Reply With Quote
Old 03-21-2019, 06:22 PM   #22
J Reverb
Human being with feelings
 
Join Date: Jul 2009
Posts: 1,071
Default

I have used Automation systems for 20 years + .
I don't think you get what I'm saying. I might do a video to explain the difference as it's quite a cool thing to be able to do when in write or latch but NOT touch because that snaps on release to the armed envelopes current values, hence 'touch' or update.

Quote:
I'm not sure what you're trying to do or demonstrate but that's how automation works regardless of whether you use the mouse pointer on the fader or the mouse wheel over the fader.
Not if you hold the modifier in write mode and move the fader with the mouse at the same time then release, do that and see what happens
J Reverb is offline   Reply With Quote
Old 03-22-2019, 02:17 AM   #23
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,769
Default

the fader doesn't move here in write mode using my mousewheel setup
__________________
Track Freezing Scripts

Coachz Repo
Coachz is offline   Reply With Quote
Old 03-24-2019, 04:39 AM   #24
Winfield
Human being with feelings
 
Winfield's Avatar
 
Join Date: Jan 2007
Location: The Underground Bunker
Posts: 705
Default

Quote:
Originally Posted by Coachz View Post
I got it working. I copied all the code above into a file "control faders with mousewheel.lua" and then opened Reaper actions and clicked Load for reascript and then assigned in my case Ctrl+Shift+Mousewheel to the action. Now when I over over my TCP track faders and do Ctrl+Shift+Mousewheel the fader moves.
So I asigned 'ctrl+,mousewheel' for the script, but when using it on volumen on the tcp i get zooming of the tcp -not volume adjustment. Any tips on what I might do to get it working - thanks!

-W
__________________
"if DAWs are religions, REAPER is atheism" - The big J
__________________
Windows 10x64 | Asus Z170-a i7, 32GB ram | RME-Digiface USB

Last edited by Winfield; 03-24-2019 at 10:31 AM.
Winfield is offline   Reply With Quote
Old 03-24-2019, 06:51 AM   #25
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,769
Default

should be default imo

Prefs / Editing Behavior / Mouse
Ignore mousewheel on all faders
Ignore mousewheel on track panel faders
__________________
Track Freezing Scripts

Coachz Repo
Coachz is offline   Reply With Quote
Old 03-24-2019, 10:35 AM   #26
Winfield
Human being with feelings
 
Winfield's Avatar
 
Join Date: Jan 2007
Location: The Underground Bunker
Posts: 705
Default

Quote:
Originally Posted by Coachz View Post
should be default imo

Prefs / Editing Behavior / Mouse
Ignore mousewheel on all faders
Ignore mousewheel on track panel faders
Sorry I don't get it - I have set my prefs a suggested above - please someone spell it out.
Thanks
-W
__________________
"if DAWs are religions, REAPER is atheism" - The big J
__________________
Windows 10x64 | Asus Z170-a i7, 32GB ram | RME-Digiface USB
Winfield is offline   Reply With Quote
Old 03-24-2019, 12:10 PM   #27
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,769
Default

open actions and click find shortcut, then do Ctrl+Mousewheel. That should be assigned to the script that you should have imported.

control faders with mousewheel.lua

If not, import it and make the assignment.
__________________
Track Freezing Scripts

Coachz Repo
Coachz is offline   Reply With Quote
Old 04-28-2019, 11:52 PM   #28
Winfield
Human being with feelings
 
Winfield's Avatar
 
Join Date: Jan 2007
Location: The Underground Bunker
Posts: 705
Default

So, I'm still not getting this to work - when using the assignment 'ctrl+mousewheel' on the tcp I get resize on all tracks (something I would like to get totally rid of).

Any (more) help appreciated, thanks!
__________________
"if DAWs are religions, REAPER is atheism" - The big J
__________________
Windows 10x64 | Asus Z170-a i7, 32GB ram | RME-Digiface USB
Winfield is offline   Reply With Quote
Old 04-23-2021, 06:44 AM   #29
Kaxaze music
Human being with feelings
 
Kaxaze music's Avatar
 
Join Date: Sep 2020
Location: India
Posts: 283
Default

Quote:
Originally Posted by mpl View Post
Assign this lua script to mousewheel (this also require SWS Extension installed):

Code:
--------------------------------------------------------------------
  function main()
    local is_new_value,filename,sectionID,cmdID,mode,resolution,val = reaper.get_action_context()
    if val == 0 or not is_new_value then return end
    if val > 0 then val = 1 else val = -1 end
    
    local incr = 0.1 -- dB
    
    local window, segment, details = reaper.BR_GetMouseCursorContext()
     tr = reaper.BR_GetMouseCursorContext_Track()
    if not tr then return end
    
    local tr_vol = reaper.GetMediaTrackInfo_Value( tr, 'D_VOL' )
    local tr_vol_db = WDL_VAL2DB(tr_vol)
    local tr_vol_out = math.max(WDL_DB2VAL(tr_vol_db + val*incr),0)
    reaper.SetMediaTrackInfo_Value( tr, 'D_VOL' ,tr_vol_out )
  end
  --------------------------------------------------------------------
  function WDL_DB2VAL(x) return math.exp((x)*0.11512925464970228420089957273422) end  --https://github.com/majek/wdl/blob/master/WDL/db2val.h
  --------------------------------------------------------------------
  function WDL_VAL2DB(x, reduce)   --https://github.com/majek/wdl/blob/master/WDL/db2val.h
    if not x or x < 0.0000000298023223876953125 then return -150.0 end
    local v=math.log(x)*8.6858896380650365530225783783321
    if v<-150.0 then return -150.0 else 
      if reduce then 
        return string.format('%.2f', v)
       else 
        return v 
      end
    end
  end
  --------------------------------------------------------------------
  main()
it didnt worked on my system.
Let me tell you what i did:-

I first copied the code from start to end then opened reaper and action list and new action and new reascript. Then i Saved it as "Adjust the volume of selected track (Mousewheel).lua". Then i restarted Reaper and assigned it to "Ctrl + Alt + Shift + Mousewheel". Then selected the track and Hover over tcp volume knob.
And nothin Happens

Editted : It Worked when i Unchecked Prefs / Editing Behavior / Mouse
Ignore mousewheel on all faders
Ignore mousewheel on track panel faders

but i didnt wanted to check the boxes as now it will randomly adjst the volume when i wanted to scroll through tracks either in tcp or mixer

Last edited by Kaxaze music; 04-23-2021 at 06:54 AM. Reason: I got it Just right
Kaxaze music is offline   Reply With Quote
Old 09-20-2023, 01:54 AM   #30
CLVMTT
Human being with feelings
 
Join Date: Oct 2021
Location: Milan, Italy
Posts: 12
Default

Quote:
Originally Posted by mpl View Post
Assign this lua script to mousewheel (this also require SWS Extension installed):

Code:
--------------------------------------------------------------------
  function main()
    local is_new_value,filename,sectionID,cmdID,mode,resolution,val = reaper.get_action_context()
    if val == 0 or not is_new_value then return end
    if val > 0 then val = 1 else val = -1 end
    
    local incr = 0.1 -- dB
    
    local window, segment, details = reaper.BR_GetMouseCursorContext()
     tr = reaper.BR_GetMouseCursorContext_Track()
    if not tr then return end
    
    local tr_vol = reaper.GetMediaTrackInfo_Value( tr, 'D_VOL' )
    local tr_vol_db = WDL_VAL2DB(tr_vol)
    local tr_vol_out = math.max(WDL_DB2VAL(tr_vol_db + val*incr),0)
    reaper.SetMediaTrackInfo_Value( tr, 'D_VOL' ,tr_vol_out )
  end
  --------------------------------------------------------------------
  function WDL_DB2VAL(x) return math.exp((x)*0.11512925464970228420089957273422) end  --https://github.com/majek/wdl/blob/master/WDL/db2val.h
  --------------------------------------------------------------------
  function WDL_VAL2DB(x, reduce)   --https://github.com/majek/wdl/blob/master/WDL/db2val.h
    if not x or x < 0.0000000298023223876953125 then return -150.0 end
    local v=math.log(x)*8.6858896380650365530225783783321
    if v<-150.0 then return -150.0 else 
      if reduce then 
        return string.format('%.2f', v)
       else 
        return v 
      end
    end
  end
  --------------------------------------------------------------------
  main()
This works perfectly, but is there a way to have it working ONLY when cursor is on the Fader, instead of the track?
Thanks!

EDIT: Or even better, is there a way to have it working with EVERY parameter under the cursor? (Fader, knobs, plugin parameters, ecc)

Last edited by CLVMTT; 09-20-2023 at 02:20 AM. Reason: More specific request
CLVMTT is offline   Reply With Quote
Old 10-18-2023, 06:47 AM   #31
fourdogslong
Human being with feelings
 
Join Date: Sep 2023
Posts: 428
Default

I managed to create a lua file and import it inside the action list, but how do I assign it to a mousewheel modifier? I looked at the mouse modifiers preferences but couldn't find it...
Any help?
fourdogslong is online now   Reply With Quote
Old 10-18-2023, 07:56 AM   #32
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,769
Default

Quote:
Originally Posted by fourdogslong View Post
I managed to create a lua file and import it inside the action list, but how do I assign it to a mousewheel modifier? I looked at the mouse modifiers preferences but couldn't find it...
Any help?
Go in the actions window in go to the section to assign a shortcut and when the shortcut window opens up for you to do the assignment simply hold down the control key and move your mouse wheel. Or whatever key combination you want with the mouse wheel
Coachz is offline   Reply With Quote
Old 10-18-2023, 08:20 AM   #33
fourdogslong
Human being with feelings
 
Join Date: Sep 2023
Posts: 428
Default

Quote:
Originally Posted by Coachz View Post
Go in the actions window in go to the section to assign a shortcut and when the shortcut window opens up for you to do the assignment simply hold down the control key and move your mouse wheel. Or whatever key combination you want with the mouse wheel
Wow I was looking way too far in the preferences haha! So simple, thank you, it works perfectly!

That is gonna be one very useful feature for me, nice
fourdogslong is online now   Reply With Quote
Old 10-18-2023, 08:32 AM   #34
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,769
Default

Quote:
Originally Posted by fourdogslong View Post
Wow I was looking way too far in the preferences haha! So simple, thank you, it works perfectly!

That is gonna be one very useful feature for me, nice
That's great news. Yeah that type of shortcut is a must-have and a no-brainer to assign so Reaper yay
Coachz is offline   Reply With Quote
Old 10-18-2023, 04:31 PM   #35
fourdogslong
Human being with feelings
 
Join Date: Sep 2023
Posts: 428
Default

Quote:
Originally Posted by Coachz View Post
That's great news. Yeah that type of shortcut is a must-have and a no-brainer to assign so Reaper yay
It's very clever!

I assigned control/window/alt + mouse wheel to track volume and control/alt + mouse wheel to item volume, works amazingly.

I wonder though if there's a way to make this contextual, so that I could use the same control/window/alt + mouse wheel command to control either track OR item volume depending on where my mouse pointer is(TCP or over item)?
fourdogslong is online now   Reply With Quote
Reply

Thread Tools
Display Modes

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 Jump


All times are GMT -7. The time now is 05:10 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.