Cakewalk A-300 Pro Controller Script
- KVRAF
- 6533 posts since 9 Dec, 2008 from Berlin
Bitwig Studio currently has no takeover modes directly integrated.
I think the Push4Bitwig script has it, I so far didn't code one since I hope we will get some kind of integrated takeover modes at one point.
You basically would need to observe the values in Bitwig and compare them to what your controller sends - if the difference is over a certain threshold, you don't jump to it but wait until it's below the threshold and only then start to follow the movement. That's the classic takeover mode where you need to "catch" the value at it's current value. Optimally this has some visual aid so you know which direction to go.
Then there is the scale mode, but that is a bit unreliable and only works in certain situations, not in others.
Cheers,
Tom
I think the Push4Bitwig script has it, I so far didn't code one since I hope we will get some kind of integrated takeover modes at one point.
You basically would need to observe the values in Bitwig and compare them to what your controller sends - if the difference is over a certain threshold, you don't jump to it but wait until it's below the threshold and only then start to follow the movement. That's the classic takeover mode where you need to "catch" the value at it's current value. Optimally this has some visual aid so you know which direction to go.
Then there is the scale mode, but that is a bit unreliable and only works in certain situations, not in others.
Cheers,
Tom
"Out beyond the ideas of wrongdoing and rightdoing, there is a field. I’ll meet you there." · Rumi
UrbanFlow.art · Instagram · YouTube
UrbanFlow.art · Instagram · YouTube
- KVRAF
- Topic Starter
- 4803 posts since 21 Jan, 2008 from oO
Ok, so for now this wouldn`t work, but there will probaply a native takeover mode right?
Shall i send in a feature request as well?
Shall i send in a feature request as well?
JamWide - a cross-platform Ninjam client for DAWs
- KVRAF
- 6533 posts since 9 Dec, 2008 from Berlin
At one point yes, no date set though, so if you want it now, you would need to code it yourself.
You can send a feature request if you want, I think it's on the list though.
Cheers,
Tom
You can send a feature request if you want, I think it's on the list though.
Cheers,
Tom
"Out beyond the ideas of wrongdoing and rightdoing, there is a field. I’ll meet you there." · Rumi
UrbanFlow.art · Instagram · YouTube
UrbanFlow.art · Instagram · YouTube
- KVRAF
- Topic Starter
- 4803 posts since 21 Jan, 2008 from oO
well yes, i`ll try to get the grips with javascript and maybe try it then.
thx
thx
JamWide - a cross-platform Ninjam client for DAWs
- KVRAF
- 6533 posts since 9 Dec, 2008 from Berlin
hehehe - 
"Out beyond the ideas of wrongdoing and rightdoing, there is a field. I’ll meet you there." · Rumi
UrbanFlow.art · Instagram · YouTube
UrbanFlow.art · Instagram · YouTube
- KVRAF
- Topic Starter
- 4803 posts since 21 Jan, 2008 from oO
But you think this method above would also work without relative knobs?
JamWide - a cross-platform Ninjam client for DAWs
- KVRAF
- 6533 posts since 9 Dec, 2008 from Berlin
That is why I brought it up. With real relative knobs you don't need takeover, since you always add to or substract from the actual value, so you get no jumps. But absolute knobs send absolute values that you can basically only set absolutely, which creates jumps if the internal value and the value of your knob are different.
And therefore the takeover modes were invented so that you can manually move the knob to the internal value of the parameter before it "takes over".
It's a bit of a pain though and you need to catch your values each time you switch devices or pages, so it can get pretty annoying fast.
The only real solution are endless encoders (with or without LED rings) and motorfaders - or touch devices, where the control can either react to the value in the DAW or can be set relatively.
Cheers,
Tom
And therefore the takeover modes were invented so that you can manually move the knob to the internal value of the parameter before it "takes over".
It's a bit of a pain though and you need to catch your values each time you switch devices or pages, so it can get pretty annoying fast.
The only real solution are endless encoders (with or without LED rings) and motorfaders - or touch devices, where the control can either react to the value in the DAW or can be set relatively.
Cheers,
Tom
"Out beyond the ideas of wrongdoing and rightdoing, there is a field. I’ll meet you there." · Rumi
UrbanFlow.art · Instagram · YouTube
UrbanFlow.art · Instagram · YouTube
-
- KVRist
- 211 posts since 8 Mar, 2004
are there any news about soft-take over for controllers?
or is anyone able to post a script (class) for manually including into a controller script?
can maybe something like
work?
or is anyone able to post a script (class) for manually including into a controller script?
can maybe something like
Code: Select all
current = cursorTrack.getVolume();
highval = data2 + 1;
lowval = data2 - 1;
if ( current == highval || current == lowval || current == data2)
{ cursorTrack.getVolume().set(data2, 128);
}- KVRAF
- Topic Starter
- 4803 posts since 21 Jan, 2008 from oO
sorry, i don`t know yet actualy, will try to look into this soon..
JamWide - a cross-platform Ninjam client for DAWs
- KVRAF
- Topic Starter
- 4803 posts since 21 Jan, 2008 from oO
could this work Thomas?xanthos wrote:are there any news about soft-take over for controllers?
or is anyone able to post a script (class) for manually including into a controller script?
can maybe something like
work?Code: Select all
current = cursorTrack.getVolume(); highval = data2 + 1; lowval = data2 - 1; if ( current == highval || current == lowval || current == data2) { cursorTrack.getVolume().set(data2, 128); }
btw, updated the script:
Features:
1: Transport Control
2: Loops cycle on/off
3: Track selection with fwd/rwd buttons
4: Slider 9 linked to master volume
5: Rotary knobs linked to primary device macros
6: Change the editor panels with B1-B4.
7: Return to Arrangement from Clip with Fast Forward button.
JamWide - a cross-platform Ninjam client for DAWs
- KVRAF
- 6533 posts since 9 Dec, 2008 from Berlin
good stuff Suloo!
As for takeover:
Not exactly the way xanthos wrote it, but similar.
[Edit: cleaned out some problems in the example]
You need an observer for each parameter you want to takeover since you can't directly request a volume in the API.
So for instance some excerpts from my TouchOSC script in init():
This saves all track volumes in an array tOSC.trackVolume whenever the volume changes in the application, so you can assume that these values are current and valid at all times and use them as the real thing.
Then in further on you would have something like the following (and I'm simplifying here):
This isn't proper code yet you can simply copy and paste, more a mixture of pseudocode and parts of my other scripts which I wrote from the top of my head, so be sure you understand what happens and adapt it to your usecase.
The threshold has to be tested for your controller. If it's too small, you may never actually hit it since controllers often leave out values, especially if you move faster. If it's too large, you may hear jumps.
There are other more clever methods to test this that take direction in account but this is the most simple form, where you just test the value to be in a certain range from your internal value.
[Edit: You need to reset the lockOnVolume[] values to false each time you switch to another device or if the value is changed from inside the application.]
Good luck
Cheers,
Tom
As for takeover:
Not exactly the way xanthos wrote it, but similar.
[Edit: cleaned out some problems in the example]
You need an observer for each parameter you want to takeover since you can't directly request a volume in the API.
So for instance some excerpts from my TouchOSC script in init():
Code: Select all
for (var i=0; i<8; i++) {
// Volume
tOSC.tracks.getTrack(i).getVolume().addValueObserver(127, getTrackValueFunc(i, tOSC.trackVolume, tOSC.trackVolumeHasChanged));
}
// A function to create an indexed function for the Observers with an added state variable:
function getTrackValueFunc(index, varToStore, varToSet)
{
return function(value)
{
varToStore[index] = value;
varToSet[index] = true;
}
}Then in further on you would have something like the following (and I'm simplifying here):
Code: Select all
// In global
-----------------------------
var lockOnVolume[];
for(var i = 0; i < 8; i++) {
lockOnVolume[i] = false;
}
const threshold = 5; // you need to experiment what works here.
-----------------------------
// In onMidi
-------------------------
if (data1 === tOSC.Faders[0]) {
if (lockOnVolume[0] === true) {
tOSC.tracks.getTrack(0).getVolume().set(data2, 128);
}
else if (data2 >= (tOSC.trackVolume[0] - threshold) && data2 <= (tOSC.trackVolume[0] + threshold) ) {
lockOnVolume[0] = true;
tOSC.tracks.getTrack(0).getVolume().set(data2, 128);
}
else {
// show an overlay with the difference between controller value and internal value so you know which direction to go...
}
}
The threshold has to be tested for your controller. If it's too small, you may never actually hit it since controllers often leave out values, especially if you move faster. If it's too large, you may hear jumps.
There are other more clever methods to test this that take direction in account but this is the most simple form, where you just test the value to be in a certain range from your internal value.
[Edit: You need to reset the lockOnVolume[] values to false each time you switch to another device or if the value is changed from inside the application.]
Good luck
Cheers,
Tom
Last edited by ThomasHelzle on Mon Nov 03, 2014 12:26 pm, edited 1 time in total.
"Out beyond the ideas of wrongdoing and rightdoing, there is a field. I’ll meet you there." · Rumi
UrbanFlow.art · Instagram · YouTube
UrbanFlow.art · Instagram · YouTube
- KVRAF
- Topic Starter
- 4803 posts since 21 Jan, 2008 from oO
cool!
yea, i would also need it for the macros, but now i can experiment with that.
thank you
yea, i would also need it for the macros, but now i can experiment with that.
thank you
JamWide - a cross-platform Ninjam client for DAWs
- KVRAF
- Topic Starter
- 4803 posts since 21 Jan, 2008 from oO
Hey Thomas,
ok, i tried to adapt this for a single primaryDevice macro right now.
Will show what i`ve done step by step.
1: I added three variables in global:
Now i already get an error in Bitwig console wich says:
missing ; before statement (A-300-Pro.control.js#49)
wich is the var lockOnMacro[0] = false;
I tried to add a ; but didn`t succeed. Not sure where he wants that actualy.
2: I added that function also in global:
3: in function init(), i got the primaryDevice:
This allows me to acces the primaryDevice on the selected track.
4: I added the observer, wich should always give me the current amount value:
5: In function onMidi i added:
_knob1 is my knob variable wich i defined in global and also set in funtion onMidi as a case for the primaryDevice.
I`m not quite sure if i need to put that var threshold inside the:
or just inside of:
Would be great if you could point me in the right direction.
here is the full script: http://pastebin.com/qXur4aeD
thx Mark
ok, i tried to adapt this for a single primaryDevice macro right now.
Will show what i`ve done step by step.
1: I added three variables in global:
Code: Select all
// Macros with brackets to save an array of values
deviceMacro = [];
deviceMacroHasChanged = [];
var lockOnMacro[0] = false;missing ; before statement (A-300-Pro.control.js#49)
wich is the var lockOnMacro[0] = false;
I tried to add a ; but didn`t succeed. Not sure where he wants that actualy.
2: I added that function also in global:
Code: Select all
// A function to create an indexed function for the Observers with an added state variable:
function getTrackValueFunc(index, varToStore, varToSet)
{
return function(value)
{
varToStore[index] = value;
varToSet[index] = true;
}
}Code: Select all
primaryDevice = cursorTrack.getPrimaryDevice();
cursorTrack = host.createCursorTrack(0,0);4: I added the observer, wich should always give me the current amount value:
Code: Select all
for (var i=0; i<8; i++) {
// macros
primaryDevice.getMacro(i).getAmount().addValueObserver(127, getTrackValueFunc(i, deviceMacro, deviceMacroHasChanged));
}Code: Select all
var threshold = 5; // you need to experiment what works here.
if (data1 === _knob1[0]) {
if (lockOnMacro[0] === true) {
primaryDevice.getMacro(0).getAmount().set(data2, 128);
}
else if (data2 >= (deviceMacro[0] - threshold) && data2 <= (deviceMacro[0] + threshold) ) {
lockOnMacro[0] = true;
primaryDevice.getMacro(0).getAmount().set(data2, 128);
}
}I`m not quite sure if i need to put that var threshold inside the:
Code: Select all
function onMidi(status, data1, data2)
{
printMidi(status, data1, data2);
if (isChannelController(status))
{
switch (data1)
{Code: Select all
function onMidi(status, data1, data2)
{here is the full script: http://pastebin.com/qXur4aeD
thx Mark
JamWide - a cross-platform Ninjam client for DAWs
- KVRAF
- 6533 posts since 9 Dec, 2008 from Berlin
1.)
Yeah, sorry for my sloppy pseudocode.
First declare the array with
var lockOnMacro[];
Then set it to false for all 8 in a loop.
Do that for all three of these arrays.
My examples - as I wrote - were not ready to copy paste, they need you to understand what you do
I'll change this one above.
5.)
var (or const) threshold can be in global scope. You define it once and see what works. It's just a "shortcut" so you don't have to change it in many places while experimenting.
6.)
I left out one crucial thing: Each time you switch what's controlled you need to reset all 8 lockOnMacro[] variables to false, so that the takeover is activated again. So in the case of Macros, you would reset this each time you:
a.) Switch to another device.
b.) A value changes from the app.
Good luck
Cheers,
Tom
Yeah, sorry for my sloppy pseudocode.
First declare the array with
var lockOnMacro[];
Then set it to false for all 8 in a loop.
Do that for all three of these arrays.
My examples - as I wrote - were not ready to copy paste, they need you to understand what you do
I'll change this one above.
5.)
var (or const) threshold can be in global scope. You define it once and see what works. It's just a "shortcut" so you don't have to change it in many places while experimenting.
6.)
I left out one crucial thing: Each time you switch what's controlled you need to reset all 8 lockOnMacro[] variables to false, so that the takeover is activated again. So in the case of Macros, you would reset this each time you:
a.) Switch to another device.
b.) A value changes from the app.
Good luck
Cheers,
Tom
"Out beyond the ideas of wrongdoing and rightdoing, there is a field. I’ll meet you there." · Rumi
UrbanFlow.art · Instagram · YouTube
UrbanFlow.art · Instagram · YouTube
- KVRAF
- Topic Starter
- 4803 posts since 21 Jan, 2008 from oO
Just updated my script and controler map to support the panel changes with B1-B4 buttons correctly.
https://github.com/Suloo/Cakewalk-A-300-PRO
cheers
https://github.com/Suloo/Cakewalk-A-300-PRO
cheers
JamWide - a cross-platform Ninjam client for DAWs
