jevstrudel.git / packages / osc / index.html
index.html22 lines · 858 B · raw
1<button id="send" style="font-size: 2em">Thank you @ojack</button>
2<script type="text/javascript" src="./node_modules/osc-js/lib/osc.min.js"></script>
3<script type="text/javascript">
4  const comm = new OSC();
5  comm.open(); // connect by default to ws://localhost:8080
6  document.getElementById('send').addEventListener('click', function () {
7    // this will send a message via websocket to the node server
8
9    // the great question: how do i know which time super collider is at????????
10    const message = new OSC.Message(
11      '/dirt/play',
12      ...['_id_', '1', 'cps', 0.5625, 'cycle', 412.3333435058594, 'delta', 0.592592716217041, 'orbit', 0, 's', 'hh'],
13    );
14
15    comm.send(message);
16    console.log('sent:', message.address, message.args);
17  });
18  /* 
19  comm.on('*', (m) => {
20    console.log('received:', m.address, m.args);
21  }); */
22</script>