hydra-synth / hydra

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

Adjusting speed using midi controller #207

Closed staus closed 1 year ago

staus commented 2 years ago

I love the speed function, but it seems like it doesn't work to connect it to a controller. Unless I'm doing something wrong? The scene just stops rendering as soon as I try. Would be super powerful if it did, though!

speed = cc(0).range(-5, 5)
geikha commented 2 years ago

speed it's not a function, is a variable. So you would have to periodically change it for it to act reactively. If cc(0).range(-5, 5) returns a Number value, you could try setting speed at every frame using the update function (which runs every frame):

update = (dt) => {
    speed = cc(0).range(-5, 5)
}

However I imagine cc(0).range(-5, 5) doesn't return a value given the behavior you described. Whatever MIDI library you're using, check if you want get a number value from it.

micuat commented 1 year ago

@ritchse thanks, I think this is the way to go. closing...