Initialize a plugins Volume (CC7)

I think I should employe a script to initialize a plugin’s volume or can this be set through a parameter. Also, I want to be able to scale my CC7s from 40-60 to 80-100. Any help would be appreciated?

That should be very easy.
Just create a widget and map it to the plugin parameter which controls the volume.
Or even better: Place a gain control after the output of your plugin and map this gain control to your widget.
When you save your gig and reload it, the widget value is restored and the gain is set perfectly.
There are some possibilities in recalling widget values and you can decide if the widget value is global in the rackspace or in each variation it should get different values.

For the CC7 scale:
Yes you can Midi learn cc7 to a widget, set the min/max values of the widget and map the widbget to the MIDI in plugin which is connected to ylour plugin and send CC7 (list of parameters of the MIDI In plugin).
This way you can scale incoming CC7 messages.

Hope my explanation is easy to understand :wink:

When not, feel free to ask.

By the way: I never change the volume in the plugin itself, I always use and Audio Mixer or gain control.

What shoul be done with incoming CC7 messages outside of the range 40-60?

I think I just wanted to illustrate the ratio with 40-60:80-100. So, I would guess that anything over the 60 should be mapped from 100-127. Dopes this make sense in the real world?

OK, can you draw a diagram to show how incoming values should be transformed to outgoing?
Thx

@pianopaul I am going to look more closely at this in my studio this evening and do some testing.

I talked today with @oove over a similar problem… he needed to scale CC11 values in a way, that all the source values (0-127) should be “translated” over to a destination range of 80-127.
Doing it via widget scaling, didn’t work for him (i don’t know why - on my machine it worked well, so this detail has still to be clarified).
So i wrote a little script that should do the job - at least it worked the way i wanted as far as i could see on the MIDI-Monitor.
For him the CC come from the Accordion - i had to do it with an expression pedal, but this shouldn’t matter. With scaling 0-127 to 80-127 i have the full movement range of the pedal but it only sends CC values from 80-127. Is this what you want to do? (Your 40-60 to 80-100 ratio example is somehow unclear for me too).

@pianopaul My Bad! I don’t want to scale CC7s. I want to scale note velocity. My MIDI accordion generally sends velocity in the range of 40-60 instead of 1-127 like other controllers. So, the resulting velocity is very weak. I need a script that will scale incoming note velocity that is in the range of 40-60 and convert it to 80-100.

@schamass I am working with @oove on this problem. As I just mentioned to @pianopaul , I think the problem is also related to note velocity. The MIDI accordion seems to be producing note velocity in the range of 40-60 which is too low for normal use. So, it has to be scaled with a script into a nominal range like you suggested 80-`127.

Ah OK, let me think :wink:

Velocity.gig (4.3 KB)

Here is the used script - all incoming velocities lower than 40 are set to 40 and higher than 60 are set to 60.
Then a scale from the range 40-60 to 80-100 is done and sent.

Var
   MIN : MidiInBlock
   vel : Integer

On NoteOnEvent(m : NoteMessage) from MIN
 vel = GetVelocity(m)
 if vel < 40 then 
  vel = 40
 elsif vel > 60 then 
  vel = 60
 end
 
 vel = ScaleInt(vel, 40, 60, 80, 100) 
 
 SendNow(MIN, WithVelocity(m, vel))
End


On NoteOffEvent(m : NoteMessage) from MIN
 SendNow(MIN, m)
end
1 Like

Your solution looks great! I was just trying to code a script but I was having trouble learning how to use “makemidimessage”.

Let me try it and get back to you. Thanks so much @pianopaul

1 Like

For some situations you can use this also:

edit: It can scale AND Constrain

2 Likes

@keyman I tried this for a test and it doesn’t change all my velocity to something between 20 and 40!

Try this -assuming incoming velocity is between 40 and 60.

1 Like

@pianopaul
I coded this script. It works but the “SendNow” seems to be sending on all channels? Do I have to specify a channel?Uwe Steger Script.gig (77.9 KB)

Var
Rhodes : MidiInBlock
Omni : MidiInBlock
vel : Integer

On NoteOnEvent(m : NoteMessage) from Omni
vel = GetVelocity(m)

if vel <= 30 then
vel = 30
end

vel = ScaleInt(vel, 30, 70, 40, 90)

SendNow(Omni, WithVelocity(m, vel))

End

On NoteOffEvent(m : NoteMessage) from Omni
SendNow(Omni, m)
end

On NoteOnEvent(m : NoteMessage) from Rhodes
vel = GetVelocity(m)

if vel <= 30 then
vel = 30
end

vel = ScaleInt(vel, 30, 70, 40, 90)

SendNow(Rhodes, WithVelocity(m, vel))

End

On NoteOffEvent(m : NoteMessage) from Rhodes
SendNow(Rhodes, m)
end

When you connect the Plugin MIDI Monitor to the MIDI In Pluging “Omni” and “Rhodes”:
What content is shown?

It looks like midi is coming in from all channels. I would think I should be seeing only the channel I specified on the MIDI block, but that is not the case.

Can you post a screenshot of the Midi Monitor window?

Try this script:

Var
   Rhodes : MidiInBlock
   Omni : MidiInBlock
   vel : Integer

On NoteOnEvent(m : NoteMessage) from Omni
  vel = GetVelocity(m)
  
 if vel <= 30 then 
  vel = 30
 end

  vel = ScaleInt(vel, 30, 70, 40, 90) 
  
  SendNowRespectingParameters
  (Omni, WithVelocity(m, vel))

End


On NoteOffEvent(m : NoteMessage) from Omni
 SendNowRespectingParameters(Omni, m)
end


On NoteOnEvent(m : NoteMessage) from Rhodes
  vel = GetVelocity(m)
  
 if vel <= 30 then 
  vel = 30
 end

  vel = ScaleInt(vel, 30, 70, 40, 90) 
  
  SendNowRespectingParameters(Rhodes, WithVelocity(m, vel))

End


On NoteOffEvent(m : NoteMessage) from Rhodes
 SendNowRespectingParameters(Rhodes, m)
end