-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
28 lines (24 loc) · 1.03 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<script src="node_modules/push-wrapper/dist/umd/push-wrapper.js"></script>
<script>
navigator.requestMIDIAccess({ sysex: true }).then((midiAccess) => {
const push = pushWrapper.push()
const inputs = midiAccess.inputs.values()
for(let input of inputs) {
if(!input.manufacturer) continue //might be midi loopback
input.onmidimessage = (event) =>{
if(!event.data) return //I guess this happens sometimes?
push.midiFromHardware(event.data)
push.gridRow(0)[0].ledRGB(255,255,255)
}
}
const outputs = midiAccess.outputs.values()
for(let output of outputs) {
if(!output.manufacturer) continue //might be midi loopback
push.onMidiToHardware(output.send.bind(output))
}
const socket = new WebSocket('ws://localhost:8080')
socket,addEventListener('open', (event) => {
socket.send('30115')
})
})
</script>