I’m trying to create a pedal-based looper for audio recording in Cubase 12. I’m getting all kinds of scripting suggestions from AI tools to be used in context of MIDI Remote, but none have yet to achieve success. I’m attaching the last one below. I’d be happy to hear of any experience in the matter.
I want to achieve a four stage sequence - press 1=record, press 2 = pause, press 3= cycle playback last recording, press 4 = pause and repeat.
================
// MIDI Remote Script for Dexibell Vivo - Key Commands Version
// Uses keyboard shortcuts instead of unreliable command IDs
// Setup required: Assign these key commands in Cubase first
var pedalState = 0;
function createDeviceDriver() {
var driver = {};
driver.createDetectionUnit = function() {
return host.MidiIO.createDetectionUnit();
};
driver.createDevice = function(deviceInfo, portInfo) {
var surface = host.UI.makeSurface();
var midiInput = surface.makeMidiInput();
// Basic transport commands (these should work reliably)
var commands = {
record: surface.makeCommandBinding(host.Sequencer.mCommands.mRecord),
stop: surface.makeCommandBinding(host.Sequencer.mCommands.mStop),
play: surface.makeCommandBinding(host.Sequencer.mCommands.mPlay),
cycleActive: surface.makeCommandBinding(host.Sequencer.mCommands.mCycleActive)
};
// Key command bindings - assign these shortcuts in Cubase Key Commands:
// Ctrl+Shift+L = Select Events in Range
// Ctrl+Shift+P = Locators to Selection
// Ctrl+Shift+R = Jump to Right Locator
// Ctrl+Shift+T = Set Left Locator
function sendKeyCommand(keyCode, ctrlKey, shiftKey, altKey) {
// This would require a different approach in MIDI Remote
// Consider using executeCommand with specific command strings instead
}
midiInput.mOnMidi = function(activeDevice, status, data1, data2) {
if ((status & 0xF0) === 0xB0 && data1 === 64 && data2 >= 64) {
pedalState = (pedalState + 1) % 4;
switch (pedalState) {
case 0: // Start recording
commands.record.trigger();
break;
case 1: // Stop, select, set locators, enable cycle
commands.stop.trigger();
host.Scheduler.scheduleCallback(function() {
// You'll need to trigger your custom key commands here
// This requires setting them up in Cubase Key Commands first
commands.cycleActive.trigger();
}, 200);
break;
case 2: // Start looped playback
commands.play.trigger();
break;
case 3: // Stop and prepare next
commands.stop.trigger();
break;
}
}
};
return {};
};
return driver;
}
module.exports = createDeviceDriver();