Go Back   Cockos Incorporated Forums > REAPER Forums > ReaScript, JSFX, REAPER Plug-in Extensions, Developer Forum

Reply
 
Thread Tools Display Modes
Old 01-24-2021, 06:48 AM   #1
Westrabua
Human being with feelings
 
Join Date: Aug 2008
Location: Germany
Posts: 76
Default LUA: Is it possible to manipulate track volume while recording automation?

TL;DR:
Via LUA, is it possible to manipulate a selected track's volume while recording automation (e.g. via latch mode), so it's being recorded to the volume envelope?

_SetMediaTrackInfo_Value(tr, "D_VOL", vol_new)_ seems to have no effect once the volume envelope has been armed.


Background info:
My aim is to make those simple MIDI sliders on my MIDI keyboard (MAudio Axiom 49) usable for recording volume automation.

Mapping one of those sliders directly to action _'Track: Set volume for selected tracks (MIDI CC/OSC only)'_ isn't really usable, because in e.g. "absolute" MIDI CC mode, it just applies the 0-127 MIDI value range to the full volume fader range, which is:
a) way too low a resolution (I want to make fine adjustments in something like a +/- 3dB range using the full MIDI slider range)
b) discards whatever volume fader position I'm currently at (because of the absolute relation)

So my idea was to basically:
- create a script that runs in the background via defer
- once it's "enabled" (via toolbar button), it tracks a mapped MIDI slider's value; this let's me move the slider into a starting position so to speak (e.g. middle of range)
- then once "write mode" is enable, I detect the relative slider change and convert it to a respective volume change while accounting for scaling (I basically decided on a MIDI value change of 1 equals to 0.05dB) and apply the desired volume value to the selected tracks volume.


I'm almost there. Well, at least until I arm the volume envelope for recording (i.e. latch mode; but the mode doesn't really make a difference it looks).

The problem then is that using _SetMediaTrackInfo_Value(tr, "D_VOL", vol_new)_, which I thought of using to manipulate the tracks' volume, no longer registers.

I assume once a track's volume envelope is armed, it's volume knob/slider is no longer the regular volume control, but the "envelope control".


Any way that could be manipulated via LUA?
Or is there some other way I could tackle this problem with, but am just not realizing?
__________________
Graphical manager application for LinVst: https://github.com/Goli4thus/linvstmanager

A.k.a Goli4thus (on github). Donate
Westrabua is offline   Reply With Quote
Old 01-24-2021, 09:17 AM   #2
Westrabua
Human being with feelings
 
Join Date: Aug 2008
Location: Germany
Posts: 76
Default

Another idea I had was to manually insert envelope points with the desired values.

I gave it a try and got the inserting working. Values by themselves look fine.

But it simply isn't the same as actual recording of automation.
Compared to the actual latch mode, it:
- creates needless points
- (more importantly) it's not holding the currently held volume

And I guess achieving that is not really within the capability of a lue script
(and probably a rabbit hole not worth getting into).

So the initial question prevails:
Can the envelope volume, which is the input during automation recording, be controlled via lua in some way, or is it simply not possible?
__________________
Graphical manager application for LinVst: https://github.com/Goli4thus/linvstmanager

A.k.a Goli4thus (on github). Donate
Westrabua is offline   Reply With Quote
Old 01-24-2021, 09:23 AM   #3
Fergler
Human being with feelings
 
Fergler's Avatar
 
Join Date: Jan 2014
Posts: 5,207
Default

There are three different volumes to automate. Volume, pre-fx volume, and trim volume. Trim is probably better here
Fergler is offline   Reply With Quote
Old 01-24-2021, 10:11 AM   #4
Westrabua
Human being with feelings
 
Join Date: Aug 2008
Location: Germany
Posts: 76
Default

Quote:
Originally Posted by Fergler View Post
There are three different volumes to automate. Volume, pre-fx volume, and trim volume. Trim is probably better here
Thanks for idea!
I had quick look, because I've never used the trim volume so far.

Looked into the manual and it says:
"It is not a track parameter control envelope: it does not correspond to any track control and hence cannot
be armed or written in write, touch or latch mode."

Well, that's strictly speaking not necessary if you enter points manually.
But it's basically the same thing as the "normal" volume envelope in this case.
__________________
Graphical manager application for LinVst: https://github.com/Goli4thus/linvstmanager

A.k.a Goli4thus (on github). Donate
Westrabua is offline   Reply With Quote
Old 01-24-2021, 05:49 PM   #5
J Reverb
Human being with feelings
 
Join Date: Jul 2009
Posts: 1,071
Default

nofish has written a sample accurate volume utility jsfx which may do what you need ?
I am not sure if it is available in Reapack so have attached it below.
J.
J Reverb is offline   Reply With Quote
Old 01-25-2021, 03:07 PM   #6
Westrabua
Human being with feelings
 
Join Date: Aug 2008
Location: Germany
Posts: 76
Default

Quote:
Originally Posted by J Reverb View Post
nofish has written a sample accurate volume utility jsfx which may do what you need ?
I am not sure if it is available in Reapack so have attached it below.
J.
Thanks for this!
Actually a good idea to reuse that standard volume utility and adapt it's range for higher resolution.
Tested it for a bit and sure enough, this actually makes automation recording via mouse quite a bit more comfortable compared to using the standard volume envelope.
And if you insert as the last FX on a track, it's basically the same thing as the track's volume envelope.

So not an answer to the original lua related question, but actually an answer to the "is there some other way" one.
__________________
Graphical manager application for LinVst: https://github.com/Goli4thus/linvstmanager

A.k.a Goli4thus (on github). Donate
Westrabua is offline   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 02:09 AM.


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