Questions about Bitwig Scripting + API Docs?

Post Reply New Topic
RELATED
PRODUCTS

Post

Hi All,

I'm interested in scripting with Bitwig, and have a couple questions related to that:

1) My computer at the moment is too old to install Bitwig, so I don't have access to the scripting guide within the software. Does anybody know if there is API Documentation hosted online anywhere? I want to make an informed decision on whether or not to upgrade my computer + shift from Ableton to Bitwig, and scripting plays a big role in that.

2) Is it possible to send data from Bitwig to other scripts via the API? For example, would it be possible to grab level data from a particular channel and stream that in real time to another location? The two use cases that I'm interested in are streaming level (dB) data to a controller with an LED strip (e.g. KMI's K-Mix), as well as to a Node.js script. Anybody know if either of these are possible with Bitwig scripting?

If anybody knows of any online resources that'll give me a good sense of what's possible with Bitwig scripting - I would highly appreciate that! The Bitwig website seems to be severely lacking with documentation on this front.

Cheers, and hope you all are having lovely days!!
Sami

Post

Regarding 2), don't know if that's what you mean, but the scripts you write act as a communication layer between the controller and Bitwig. You can set up a callback function in the script that will be called each time your level (dB) value changes on a given channel (you can do the same with pretty much any value in Bitwig). Then you can do with this value whatever you want, including sending data to your controller with MIDI or SysEx. You can also set up communication via TCP in the script, so you could send it to any other place that is listening on a given port, but I haven't tried that.

Hope that answers your question.

Post

@Netsu - yes, that mostly does. My follow up question is as follows: can I run any kind of script that I want within the scripts folder? Do they have to be inherently tied to a controller? Your answer makes it sound like I *can* do that, but I just wanted to clarify this. I'd love to have a script that interfaced with my own server script running elsewhere using websockets without having any connection to a hardware controller. Any idea if that's possible?

Post

I don't think so. Each script is tied to a specific controller and will not run when the controller is not connected. Maybe with a virtual controller of some sort?

Post

Netsu wrote:I don't think so. Each script is tied to a specific controller and will not run when the controller is not connected.
That's wrong. A script doesn't need to define any input or output devices, so it can act in the way the Op intended.
However, as there is no Web API available in the script interpreter, there's no higher protocols like http or websocket. But pure udp or tcp communication will do the job just as fine with a node app.

Post

@BufoBufo so based off of your response, I'm guessing that when Bitwig is running a script, it will not let you import whatever library you want into the script?

Post

BufoBufo wrote:That's wrong. A script doesn't need to define any input or output devices, so it can act in the way the Op intended.
However, as there is no Web API available in the script interpreter, there's no higher protocols like http or websocket. But pure udp or tcp communication will do the job just as fine with a node app.
Oh, sorry, that's good to know :)

Post

thisissami wrote:@BufoBufo so based off of your response, I'm guessing that when Bitwig is running a script, it will not let you import whatever library you want into the script?
Yes it does let you, using the provided load(..) function, but that is limited (a) to local files, (b) loading before the script's entry point (an init function), i.e. no late-loading during runtime, and (c) the imported script must not rely on anything the environment doesn't provide. And the Nashorn environment provides pretty little ;). So if you want to import any fancy JS library, you'll most likely have to refactor it beforehand, removing any code that relies on node, DOM or Web API stuff etc. Not even to think of ES6 :hihi:.

Post

Ok understood! Thanks for the clarification & quick responses BufoBufo & Netsu. :)

Now... if anybody knows where I can find some API documentation to take a look at, that would be incredible. I've shot the tech support an email asking them if they can share the documentation with me somehow, and I'm hopeful they send something my way soon. :)

Post

thisissami wrote:Now... if anybody knows where I can find some API documentation to take a look at, that would be incredible. I've shot the tech support an email asking them if they can share the documentation with me somehow, and I'm hopeful they send something my way soon. :)
Simply install any of the demos. You do NOT have to run the demo. You can find the documentation e.g. on Windows in C:\Program Files\Bitwig Studio\resources\doc\control-surface\api
Open the index.html in any browser.

Post Reply

Return to “Controller Scripting”