hydra-synth / hydra

Livecoding networked visuals in the browser
https://hydra.ojack.xyz
GNU Affero General Public License v3.0
2.18k stars 267 forks source link

Implement Midi #136

Open arnoson opened 3 years ago

arnoson commented 3 years ago

For a seminar at my university im trying to work with hydra and web midi. I've seen the description on how to use web midi with the developer console but I was wondering if you are interested in including midi in hydra itself?

I've been thinking about writing a browser extension for using midi with hydra but I could also try to include the features directly inside hydra. What would be a good place for this?

I have the following features in mind:

micuat commented 3 years ago

you can always use hydra-synth as a module for a webpage and add your extensions https://glitch.com/edit/#!/hydra-webpage

the first point can be directly integrated in your page - the second one needs a bit of work but I think it's beyond the scope of github issues

arnoson commented 3 years ago

Thanks for the reply @micuat! Still I think it would be great if midi would be integrated directly into hydra. For now I wrote a chrome extension, so I can use midi with hydra.ojack.xyz and without having to paste custom scripts into the console: https://github.com/arnoson/hydra-midi. I don't have a chrome developer account so I can't release it as a web extension yet, but I plan to release it soon. I tried to keep the midi syntax close to the existing hydra functions so it feels like a part of hydra.

ojack commented 3 years ago

I like the idea of directly including midi, or at least checking for it when hydra first loads.

micuat commented 3 years ago

problem may be if you plug/unplug after initialization the api may not work.. so we have to add a listener etc if you want to make it proper

arnoson commented 3 years ago

I guess it would also be okay having to reload the tab when you added (the first) midi device. On the other hand, the midi library I used in the chrome extension is not that big, so something similar could also be included by default. A dynamic import, that is triggered when a midi device is present or a new one is detected, would of course be the most elegant solution!