Bitwig JS API Method Stubs

Official support for: bitwig.com
RELATED
PRODUCTS

Post

Hey all, I'm currently in the process of working on a manual conversion of the Bitwig Control Surface Scripting API into javascript method stubs complete with JSDoc. If you're working on any controller scripts this should be super helpful to you!

I use JetBrains Webstorm for my controller development, and so by including these stubs as an external library I get full code-hinting/autocompletion for anything Bitwig related. This is insanely helpful if you're planning on developing some code for an unsupported controller. This is the kind of auto-completion I'm talking about:

Image

Here's what I've got so far. There's still quite a lot to do and I'd appreciate some help if anyone feels generous with their time but if not I'll keep plugging away at it!

trappar/bitwig-api-stubs on Github

Good luck with those controller scripts!

Post

Cool! :-)

Can this be used with Komodo Edit somehow or is it specific to Webstorm?

Cheers,

Tom
"Out beyond the ideas of wrongdoing and rightdoing, there is a field. I’ll meet you there." · Rumi
UrbanFlow.art · Instagram · YouTube

Post

A resounding YES!

This will be very helpful to us who do not have scripting knowledge and enough experience to create a working script for our controllers.

Thank you for thinking this one up!

Looking forward to the results of your efforts Trappar :tu:

I am happy to assist you with what time I can muster (which is quite limited - day job you know :x); however, be warned I am ignorant of coding and not sure how much help I can be :shrug:

Happy Musiking!
dsan
My DAW System:
W7, i5, x64, 8Gb Ram, Edirol FA-101

Post

Happy scripting :clap:

Post

ThomasHelzle wrote:Can this be used with Komodo Edit somehow or is it specific to Webstorm?
I haven't tested it there, but it does seem Komodo Edit supports JSDoc, so I suspect it should work. It really just depends on how they manage external libraries/includes.

If you wouldn't mind testing it out for me that would be nice since I'd like to know what IDEs will support this, if not I'll probably test it out myself when I get the chance. Just let me know.
dsan@mail.com wrote:I am happy to assist you with what time I can muster (which is quite limited - day job you know :x); however, be warned I am ignorant of coding and not sure how much help I can be :shrug:
This actually isn't really coding at all haha, it's just reformatting their reference guide. Lots of copy paste into a very specific syntax. I'm making good headway though so I probably won't really need any help. Thanks for offering though!

Post

Worked on first try:
- Download the Files from Github as a Zip, extract to any folder you like (I added it to the documents/Bitwig Studio Folder).

- Open Komodo Edit, go to Edit -> Preferences -> Languages -> JavaScript and add the "api" folder from the download to the list with the "+" sign.
(Komodo Edit is a great free Editor: http://www.activestate.com/komodo-edit/downloads Check out the dark theme ;-) )

- Enjoy trappars work, showing available commands etc. while typing.

Great stuff trappar!!! :-) :tu:

I'll link here from the Ressources and Scripting Threads.

Cheers,

Tom
"Out beyond the ideas of wrongdoing and rightdoing, there is a field. I’ll meet you there." · Rumi
UrbanFlow.art · Instagram · YouTube

Post

Hey guys I could use some help with figuring out how the nested classes NoteInput.NoteExpression, PrimaryDevice.ChainLocation, and PrimaryDevice.DeviceType work and how I can build stubs for them. I'm pretty sure if I can at least figure out how you're supposed to use them then I could mock up something which will help you do those things while maybe not perfectly matching the way the API is structured.

Everything else so far has been fairly easy.. but with these parts some help would be greatly appreciated :)

Post

Hi,

Since those are actually enumerations, seems to me they would just be represented as static variables in javascript.

PrimaryDevice.ChainLocation = {};
PrimaryDevice.ChainLocation.FIRST = 0;
PrimaryDevice.ChainLocation.LAST = 1;
PrimaryDevice.ChainLocation.NEXT = 2;
PrimaryDevice.ChainLocation.PREVIOUS = 3;

etc. (notice no 'prototype')

I haven't used these yet in my actual code but I know this is how they translate to Java on the Bitwig side.

Mike
Michael Schmalle
http://www.teotigraphix.com
Surfing on sine waves

Maschine4Bitwig - Studio, MK2, MikroMK2, MK1
http://www.teotigraphix.com/bitwig/maschine

Post

Thanks a lot!

Post

TeotiGraphix wrote:Hi,

Since those are actually enumerations, seems to me they would just be represented as static variables in javascript.

PrimaryDevice.ChainLocation = {};
PrimaryDevice.ChainLocation.FIRST = 0;
PrimaryDevice.ChainLocation.LAST = 1;
PrimaryDevice.ChainLocation.NEXT = 2;
PrimaryDevice.ChainLocation.PREVIOUS = 3;

etc. (notice no 'prototype')

I haven't used these yet in my actual code but I know this is how they translate to Java on the Bitwig side.
I think thats right.

Coincidentally, i'd started building my own set of stubs, but these are nicer with the doc comments and whatnot.

I just submitted a pull request for the enum changes.

Post

ThomasHelzle wrote:Worked on first try:
- Download the Files from Github as a Zip, extract to any folder you like (I added it to the documents/Bitwig Studio Folder).

- Open Komodo Edit, go to Edit -> Preferences -> Languages -> JavaScript and add the "api" folder from the download to the list with the "+" sign.
(Komodo Edit is a great free Editor: http://www.activestate.com/komodo-edit/downloads Check out the dark theme ;-) )

- Enjoy trappars work, showing available commands etc. while typing.

Great stuff trappar!!! :-) :tu:

I'll link here from the Ressources and Scripting Threads.

Cheers,

Tom
Thomas, trappar:
I dl'd all necessary files and placed them as instructed (I'm sure of this); however, when running Komodo Edit I'm not getting the suggestions like in trappar's example pic/movie.

The only time I get a suggestion is when I write "function"....I get the suggested "function" in a box but no list of functions.

If I start a line host. - no suggestions.

Any ideas?

Thanks!

Happy Musiking!
dsan
My DAW System:
W7, i5, x64, 8Gb Ram, Edirol FA-101

Post

Hey dsan, no, not really.

When I type "host." I get:

Image

Just to makes sure:
- You pointed Komodo to the "api" folder in which there are the xxxx.js files from trappar?
- Make sure you have "Code Intelligence" Auto Complete and Calltips active in Komodo Preferences (not sure what the defaults are).

If all else fails you can PM me and I give you my Skype address for a debugging session ;-)

Cheers,

Tom
"Out beyond the ideas of wrongdoing and rightdoing, there is a field. I’ll meet you there." · Rumi
UrbanFlow.art · Instagram · YouTube

Post

Thanks Tom - got it figured out. Yes, settings are correct - first things I looked into.

It seems if I create a new document I do not get the hints; however, if I open an existing document I get the hints.

Strange :shrug:

All working now.....but still lost :lol:

Thanks again!

Happy Musiking!
dsan
My DAW System:
W7, i5, x64, 8Gb Ram, Edirol FA-101

Post

Not that strange actually, but maybe not obvious either: the file needs to have a .js extension so Komodo knows that it is supposed to be Javascript. A new document has no extension... ;-)
Just save it with a proper name and it should work.

Cheers,

Tom
"Out beyond the ideas of wrongdoing and rightdoing, there is a field. I’ll meet you there." · Rumi
UrbanFlow.art · Instagram · YouTube

Post

marvotron wrote:
TeotiGraphix wrote:Hi,

Since those are actually enumerations, seems to me they would just be represented as static variables in javascript.

PrimaryDevice.ChainLocation = {};
PrimaryDevice.ChainLocation.FIRST = 0;
PrimaryDevice.ChainLocation.LAST = 1;
PrimaryDevice.ChainLocation.NEXT = 2;
PrimaryDevice.ChainLocation.PREVIOUS = 3;

etc. (notice no 'prototype')

I haven't used these yet in my actual code but I know this is how they translate to Java on the Bitwig side.
I think thats right.

Coincidentally, i'd started building my own set of stubs, but these are nicer with the doc comments and whatnot.

I just submitted a pull request for the enum changes.
Thanks guys :D I just merged in those changes.

Post Reply

Return to “Bitwig”