Hello everybody!
Im new to bitwig, and im not a profesisonal programmer.
So please bear with me.
I want to build a step sequencer that uses my launchpad as my input device and gui, i actually got it working with touchosc and lua, feeding it an external clock, but the timing is not the best because of midi jitter.
So i thought about using bitwig as the engine by coding a script that basically creates a step sequencer.
As i said im not really a programmer, so java seems too much of a stretch for me right now, so i was looking for a javascript remote script that does any time of sequencing, but couldn't find anything.
so i am here asking for your advice.
what would be the best and easiest way to code a basic sequencer in bitwig with a remote script?
i appreciate any help.
thanks in advance.
Building a step sequencer.
-
- KVRist
- Topic Starter
- 190 posts since 16 Nov, 2010
so far what i have is the following code, which i was able to put together by following the instructions in the api explained pdf and watching the moss video series,
it does play a note, but the timing is wonky, and what i would like it to do is for it to follow bitwigs transport and play the note at every 16th of a note.
so, any advice is welcome and appreciated.
Code: Select all
loadAPI(19);
// Remove this if you want to be able to use deprecated methods without causing script to stop.
// This is useful during development.
host.setShouldFailOnDeprecatedUse(true);
host.defineController("pupupu", "simple-seq", "0.1", "74b05fbc-a1b4-4b05-95ba-fbb9331ccac8", "Octaviu5");
host.defineMidiPorts(1, 1);
var noteDuration = 240; // Duration of a quarter note in ticks (can adjust as needed)
var tickCounter = 0;
function init() {
// TODO: Perform further initialization here.
inputNotes = host.getMidiInPort(0).createNoteInput("inputnotes");
inputNotes.setShouldConsumeEvents(true);
// Start a timer to track the tick count and play C3 every 4th note.
host.scheduleTask(playC3Every4thNote, 100); // Check every 1000ms (1 second)
}
function playC3Every4thNote() {
tickCounter++;
if (tickCounter % 4 === 0) {
// Play C3 (note number 60) every 4th note.
inputNotes.sendRawMidiEvent(0x90, 40, 127); // Note On (status byte 0x90)
} else if (tickCounter % 4 === 2) {
// Send a Note Off for C3 (note number 60, velocity 127) using sendRawMidiEvent
inputNotes.sendRawMidiEvent(0x80, 60, 127); // Note Off (status byte 0x80)
}
// Keep checking every second
host.scheduleTask(playC3Every4thNote, 100); // Re-run after 1 second
}
function flush() {
// TODO: Flush any output to your controller here.
}
function exit() {
// Cleanup if necessary.
}
so, any advice is welcome and appreciated.
- KVRist
- 393 posts since 12 Apr, 2020
I wouldn't do anything real time in the bitwig api for critical events like note timing. Imo your best bet is to create a CursorClip, make a new clip and use that to put your notes inside it. Let Bitwig handle the playback but you can edit the notes in the Clip.
----------------------------------------------------------------------
/CTRL → http://slashctrl.io
Music & mixes → http://soundcloud.com/kirkwoodwest
/CTRL → http://slashctrl.io
Music & mixes → http://soundcloud.com/kirkwoodwest
