Help for creating clips in Arranger
-
Frac-Capitaine Frac-Capitaine https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=476585
- KVRist
- 37 posts since 15 Oct, 2020
Hi.
To create a clip in a Scene view I use this code :
"trackBank.getItemAt(0).getClipLauncherSlots().createEmptyClip(0,2);"
with "trackBank = trackBank = host.createTrackBank(1 , 0, 1);"
But how to access to the Arranger ?
I tryied to create an Arranger object : "tArranger = host.createArranger();" but then ?
To create a clip in a Scene view I use this code :
"trackBank.getItemAt(0).getClipLauncherSlots().createEmptyClip(0,2);"
with "trackBank = trackBank = host.createTrackBank(1 , 0, 1);"
But how to access to the Arranger ?
I tryied to create an Arranger object : "tArranger = host.createArranger();" but then ?
-
Frac-Capitaine Frac-Capitaine https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=476585
- KVRist
- Topic Starter
- 37 posts since 15 Oct, 2020
Here is the whole code :
The code is adaptable (and must be adapted to your controller).
The code assume that Pot1 and Pot2 are set as CC relative mode, "1" mean "increase" else "decrease". So, it can be changed.
It work in the Arranger view. You have first to create a clip and then move with the pot1 the position 'bar' (the code didn't catch the position set with the mouse or an other device). By default the position is "0". It will not move if you didn't use the 'pot1'.
The aim of my post is still to wait some guy or girl that can help me to find the function to create a clip in the Arranger view. It is the only thing that this script need to be really finish (and convenient).
Code: Select all
loadAPI(6);
host.defineController("Nektar-1", "StepSequencer", "0.1", "fee11226-666f-4c2f-aabd-7a5ea1a710fa", "ArnoldK");
host.defineMidiPorts(1, 0);
var actualPosition = 0.0;
var actualResolution = 1/16;
//***************************************************************************************************
//***************************************************************************************************
//***************************************************************************************************
function UpdateTransportPosition(beatJump, sens) {
if ( sens == 1 ) { // forward
actualPosition = actualPosition + beatJump;
} else {
actualPosition = actualPosition - beatJump;
}
if (actualPosition < 0) actualPosition = 0;
transport.setPosition(actualPosition);
println("\nPosition : "+actualPosition);
}
//***************************************************************************************************
//***************************************************************************************************
//***************************************************************************************************
function init() {
transport = host.createTransport();
host.getMidiInPort(0).setMidiCallback(onMidi0);
host.getMidiInPort(0).setSysexCallback(onSysex0);
trackBank = host.createTrackBank(1,1,1);
//cursorTrack = host.createArrangerCursorTrack(0,1);
cursorClip = host.createArrangerCursorClip( 64, 127);
// TODO: Perform further initialization here.
println("AuraStepSeq initialized!");
}
// Called when a short MIDI message is received on MIDI input port 0.
function onMidi0(status, data1, data2) {
// TODO: Implement your MIDI input handling code here.
println("\nStatus : "+ status +"\nData 1 : "+ data1 +"\nData 2 : "+data2); // For debug
if ( (status == 176) && (data1 == 81) ) { // Pot 1 : Transport position
if (data2 == 1)
{
UpdateTransportPosition(actualResolution, 1);
} else {
UpdateTransportPosition(actualResolution, 0);
}
}
if ( (status == 176) && (data1 == 82) ) { // Pot 2 : Track selection
if (data2 == 1)
{
trackBank.scrollTracksDown();
trackBank.getItemAt(0).select();
} else {
trackBank.scrollTracksUp();
trackBank.getItemAt(0).select();
}
}
if ( (status == 144) && (data2 > 0) )
{
//trackBank.getItemAt(0).getClipLauncherSlots().createEmptyClip(0,2);
var stepPosition = actualPosition * 4;
var StepPage = Math.trunc(stepPosition/64);
if (stepPosition > 63) {
stepPosition = stepPosition - (StepPage*64);
}
cursorClip.setStep(stepPosition, data1, 127, 1);
}
if ( (status == 191) && (data1 == 102) && (data2 == 127) )
{
}
}
// Called when a MIDI sysex message is received on MIDI input port 0.
function onSysex0(data) {
// MMC Transport Controls:
}
function flush() {
// TODO: Flush any output to your controller here.
}
function exit() {
}The code assume that Pot1 and Pot2 are set as CC relative mode, "1" mean "increase" else "decrease". So, it can be changed.
It work in the Arranger view. You have first to create a clip and then move with the pot1 the position 'bar' (the code didn't catch the position set with the mouse or an other device). By default the position is "0". It will not move if you didn't use the 'pot1'.
The aim of my post is still to wait some guy or girl that can help me to find the function to create a clip in the Arranger view. It is the only thing that this script need to be really finish (and convenient).
-
Frac-Capitaine Frac-Capitaine https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=476585
- KVRist
- Topic Starter
- 37 posts since 15 Oct, 2020
I forgot to say that the clip in the Arranger view must have to be selected (focused) to be edited.
- KVRAF
- 4898 posts since 13 May, 2004
Sadly, there is currently no access to the Arranger from the API. Send a wish to Bitwig...
-
Frac-Capitaine Frac-Capitaine https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=476585
- KVRist
- Topic Starter
- 37 posts since 15 Oct, 2020
Yes, it is sad that is function didn't exist...
Probably did you know Moss a way to show something like a "state" bar like this : https://i.imgur.com/kSYAMVv.png in the Note Editor ?
My problematic is that I can't get a feedback in the Nektar Aura of the step position (the Nektar compagny didn't want to provide the SysEx code to do it, but I know that it is possible...). In the Arranger View in Bitwig, I can move the position bar and then set the step where I want. If I can move or show something like a position bar in the Note Editor, I will be happy !
Probably did you know Moss a way to show something like a "state" bar like this : https://i.imgur.com/kSYAMVv.png in the Note Editor ?
My problematic is that I can't get a feedback in the Nektar Aura of the step position (the Nektar compagny didn't want to provide the SysEx code to do it, but I know that it is possible...). In the Arranger View in Bitwig, I can move the position bar and then set the step where I want. If I can move or show something like a position bar in the Note Editor, I will be happy !
- KVRAF
- 4898 posts since 13 May, 2004
You can get the position from the Transport object and display it with the showPopupNotification of ControllerHost.Frac-Capitaine wrote: Mon Jan 18, 2021 6:19 pm Yes, it is sad that is function didn't exist...
Probably did you know Moss a way to show something like a "state" bar like this : https://i.imgur.com/kSYAMVv.png in the Note Editor ?
My problematic is that I can't get a feedback in the Nektar Aura of the step position (the Nektar compagny didn't want to provide the SysEx code to do it, but I know that it is possible...). In the Arranger View in Bitwig, I can move the position bar and then set the step where I want. If I can move or show something like a position bar in the Note Editor, I will be happy !
-
Frac-Capitaine Frac-Capitaine https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=476585
- KVRist
- Topic Starter
- 37 posts since 15 Oct, 2020
It can be useful, thanks !
