Some pointers on JavaScript...

RELATED
PRODUCTS

Post

I just started with this on the last weekend.
After reading so often that you should use Java, I first tried that but then I realized that in order to do that I'd need a real refresher on modern Java (last time I used it, it was Java 6).

So I tried out how OK it is with JavaScript and while I can see that it is not optimal in some cases, it is actually quite workable.

Here some tipps:
* It really helps to use TypeScript + VScode. There are types (generated from the official API documentation?): https://github.com/taktiljs/typed-bitwig-api
* With those types, I had to almost never resort to look up on the API documentation itself. Code Intelligence worked well.
* Use `tsc --watch` so you get instant updates / feedback
* I've used a symlink (folder to folder) to put the compiled dist/ folder into my bitwig controller scripts folder.

Some annoyances:
* Debugging is not really possible in the ways you are used to it as a developer
* println can only print strings. Is there any way to outpug / debug complex objects / structures into the dev console, without resorting to JSON.stringify()?

If it helps someone, here is the github repository.
Disclaimer: I'm new at this and I'm pretty sure the overall architecture / abstractions on the controller script are not ideal.

https://github.com/Fannon/Launchpad-Pro ... Controller
Find my (music) related software projects here: github.com/Fannon

Post

Fannon wrote: Mon Oct 11, 2021 5:49 am I just started with this on the last weekend.
After reading so often that you should use Java, I first tried that but then I realized that in order to do that I'd need a real refresher on modern Java (last time I used it, it was Java 6).

So I tried out how OK it is with JavaScript and while I can see that it is not optimal in some cases, it is actually quite workable.

Here some tipps:
* It really helps to use TypeScript + VScode. There are types (generated from the official API documentation?): https://github.com/taktiljs/typed-bitwig-api
* With those types, I had to almost never resort to look up on the API documentation itself. Code Intelligence worked well.
* Use `tsc --watch` so you get instant updates / feedback
* I've used a symlink (folder to folder) to put the compiled dist/ folder into my bitwig controller scripts folder.

Some annoyances:
* Debugging is not really possible in the ways you are used to it as a developer
* println can only print strings. Is there any way to outpug / debug complex objects / structures into the dev console, without resorting to JSON.stringify()?

If it helps someone, here is the github repository.
Disclaimer: I'm new at this and I'm pretty sure the overall architecture / abstractions on the controller script are not ideal.

https://github.com/Fannon/Launchpad-Pro ... Controller
Nice, and actually with bundling with webpack, you can use more standard "JS/TS" way of code reuse and importing of dependencies.

here i have monorepo https://github.com/drakh/bitwig-scripts with webpack setup for bundling the final scripts. the idea came from Joseph Larson's (the author of typed-bitwig-package) and hist repo for maschine scripts.. https://github.com/joslarson/maschine-bitwig

and for your question about debugging and println, best thing to do is prepare your own function to use instead of println, which will do the JSON.stringify() behind the scenes for you, and use only that function.

Post Reply

Return to “Controller Scripting”