Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Novation launchpad integration #321

Open
thebabush opened this issue Mar 16, 2020 · 5 comments
Open

Novation launchpad integration #321

thebabush opened this issue Mar 16, 2020 · 5 comments

Comments

@thebabush
Copy link

Hi,

I sketched my first "program" (?) with livecodelab and it turned out pretty amazing (I mean, I enjoyed the experience a lot and the result was not bad at all imho) but I feel like I could use it in a semi-livecoding way:

  1. write the sketch
  2. create some kind of improv hook (like, fixed color vs dynamic)
  3. hook a midi controller and handle it live without changing the code (without changing it too much anyway)

AFAIK Firefox is starting to implement webmidi, but chrome should be ready so API-wise it should be possible without node/electron thingies.

Can you give me a pointer on the best way to structure this? I'll delve in the code later today and try to figure it out myself, but some insider knowledge would speed up the process a lot :)

cheers

@davidedc
Copy link
Owner

Ciao Paolo (sono Italiano anch'io),

there is already some midi-related code and comments here: https://github.com/davidedc/livecodelab/search?q=midi&unscoped_q=midi
I think the approach there was to go through... a server of some sort? I don't remember, but the code is there (I never used midi to control tempo, I don't have any MIDI devices).

Honestly I don't know much about midi, but I guess the idea is to use some special variables from inside the program, like MIDI_1 MIDI_2, etc., that you can change via MIDI? I'm guessing.

Give it a try and we'll gladly take a look!

@davidedc
Copy link
Owner

P.S. I forgot - the video is very cool, I watched it a couple of times with headphones and I found it to be very well made!

@thebabush
Copy link
Author

thebabush commented Mar 20, 2020

Ciao :) grazie. Comunque LCL e' una figata, props.

Anyway, I made a simple launchpad PoC using
launchpad-webmidi.

I'm not a web guy by any means, so I just hacked together some js.
This also includes an additional dependency so probably you don't want to upstream it.

Anyway, I opened a PR just in case.
Any feedback is very welcome :)

#322

@davidedc
Copy link
Owner

thanks 🙏 !
if I had one of these and I had a consistent practice then I'd merge this and make sure it keeps working over time...

please let us know in here when you make a video and show us how it works!

@thebabush
Copy link
Author

thebabush commented Mar 20, 2020

Test video

The code was pretty simple. I just added two functions:

  • lps(y, x) that returns the LaunchPad State of the button at the given position
  • lpd(y, x) that returns 0/1 if the button is currently down

the difference between the two is that one is stateful and the other is not. In other words, lpd gives the current value, while lps alternates between 0 and 1 at every button-down event.

I integrated it with my previous box thingie and it works nice imho :)

EDIT: using (y, x) coordinates was dumb given how LCL works, but I'll fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants