Hi. Maybe this could be helpful if 14-Bit is not available yet on CSS.
I'm new to CSS and Python, but I've been playing around to get an endless type of encoder to fine control the volume on a track. I was able to do it with the following Action block inside a Reaction.
My controller is actually an app that transforms the trackpad of a MacBook into 4 faders, and I can set them to send Absolute 7bit MIDI or Relative MIDI.
My MIDI fader follows the Signed Bit standard of relative MIDI: it goes from 1 to 8 turning right, and from 65 to 72 turning left. It goes 1 or 65 if you move the controller really slow, and up to 8 or 72 if its moved fast. Check what type of relative MIDI standard your knob follows and make the corresponding changes below.
First the controller: I created an endless encoder fader (or knob, it doesn't matter) in CSS with the following settings:
CC21
Relative Type
Left: 65
Right: 1
Steps: 127
Then I created a Reaction with one Listener when the fader is moved and just one Action block. Paste the code below to the Action block. Everything between """ is a comment. Just delete the comments from the code if you want.
"""
This part sets the value coming from fader CC21, sets the maximum and minimum of the volume, and sets the position number of the selected track.
"""
fader = self.midi_cc_ch_0_val_21.cur_val
max = self.song().view.selected_track.mixer_device.volume.max
min = self.song().view.selected_track.mixer_device.volume.min
track = self.get_selected_track_num()
"""
This function sets the new volume change, taking care of the maximum and minimum.
"""
def setVolume( num ):
volume = self.song().view.selected_track.mixer_device.volume.value + num
if volume >= max:
self.song().view.selected_track.mixer_device.volume.value = max
elif volume <= min:
self.song().view.selected_track.mixer_device.volume.value = min
else:
self.song().view.selected_track.mixer_device.volume.value = volume
return
"""
This function check the input from the fader and sends a corresponding value to the function setVolume above. I defined the values to my taste; you can change it to yours. I still need to tweak it, but it works so far. For example, if you move it slow to the right, the knob sends a 1, and then 0.001 is added to the current volume value. If it's moved fast to 8, it adds 0.10, so the jump is bigger. The same thing happens if the knob is moved to the left, but in this case it's a substraction.
"""
def checkFader( value ):
if value == 1:
setVolume( 0.001 )
elif value == 2:
setVolume( 0.005 )
elif value == 3:
setVolume( 0.010 )
elif value == 4:
setVolume( 0.020 )
elif value == 5:
setVolume( 0.030 )
elif value == 6:
setVolume( 0.040 )
elif value == 7:
setVolume( 0.080 )
elif value == 8:
setVolume( 0.10 )
elif value == 65:
setVolume( -0.001 )
elif value == 66:
setVolume( -0.005 )
elif value == 67:
setVolume( -0.010 )
elif value == 68:
setVolume( -0.020 )
elif value == 69:
setVolume( -0.030 )
elif value == 70:
setVolume( -0.040 )
elif value == 71:
setVolume( -0.080 )
elif value == 72:
setVolume( -0.10 )
return
"""
The main function is finally called in the Action Block
"""
checkFader( fader )
Comments
Any news on this?
Hi. Maybe this could be helpful if 14-Bit is not available yet on CSS.
I'm new to CSS and Python, but I've been playing around to get an endless type of encoder to fine control the volume on a track. I was able to do it with the following Action block inside a Reaction.
My controller is actually an app that transforms the trackpad of a MacBook into 4 faders, and I can set them to send Absolute 7bit MIDI or Relative MIDI.
My MIDI fader follows the Signed Bit standard of relative MIDI: it goes from 1 to 8 turning right, and from 65 to 72 turning left. It goes 1 or 65 if you move the controller really slow, and up to 8 or 72 if its moved fast. Check what type of relative MIDI standard your knob follows and make the corresponding changes below.
First the controller: I created an endless encoder fader (or knob, it doesn't matter) in CSS with the following settings:
CC21
Relative Type
Left: 65
Right: 1
Steps: 127
Then I created a Reaction with one Listener when the fader is moved and just one Action block. Paste the code below to the Action block. Everything between """ is a comment. Just delete the comments from the code if you want.
"""
This part sets the value coming from fader CC21, sets the maximum and minimum of the volume, and sets the position number of the selected track.
"""
fader = self.midi_cc_ch_0_val_21.cur_val
max = self.song().view.selected_track.mixer_device.volume.max
min = self.song().view.selected_track.mixer_device.volume.min
track = self.get_selected_track_num()
"""
This function sets the new volume change, taking care of the maximum and minimum.
"""
def setVolume( num ):
volume = self.song().view.selected_track.mixer_device.volume.value + num
if volume >= max:
self.song().view.selected_track.mixer_device.volume.value = max
elif volume <= min:
self.song().view.selected_track.mixer_device.volume.value = min
else:
self.song().view.selected_track.mixer_device.volume.value = volume
return
"""
This function check the input from the fader and sends a corresponding value to the function setVolume above. I defined the values to my taste; you can change it to yours. I still need to tweak it, but it works so far. For example, if you move it slow to the right, the knob sends a 1, and then 0.001 is added to the current volume value. If it's moved fast to 8, it adds 0.10, so the jump is bigger. The same thing happens if the knob is moved to the left, but in this case it's a substraction.
"""
def checkFader( value ):
if value == 1:
setVolume( 0.001 )
elif value == 2:
setVolume( 0.005 )
elif value == 3:
setVolume( 0.010 )
elif value == 4:
setVolume( 0.020 )
elif value == 5:
setVolume( 0.030 )
elif value == 6:
setVolume( 0.040 )
elif value == 7:
setVolume( 0.080 )
elif value == 8:
setVolume( 0.10 )
elif value == 65:
setVolume( -0.001 )
elif value == 66:
setVolume( -0.005 )
elif value == 67:
setVolume( -0.010 )
elif value == 68:
setVolume( -0.020 )
elif value == 69:
setVolume( -0.030 )
elif value == 70:
setVolume( -0.040 )
elif value == 71:
setVolume( -0.080 )
elif value == 72:
setVolume( -0.10 )
return
"""
The main function is finally called in the Action Block
"""
checkFader( fader )
I put the code in a text file because the one above deleted the proper indentation.
Thank you for your answer. Will try this later !