first (broken) attempt
This commit is contained in:
parent
ed6cf2ecf1
commit
69884c61b4
1 changed files with 16 additions and 0 deletions
16
packages/osc/osc.mjs
Normal file
16
packages/osc/osc.mjs
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
import {OSC} from 'osc-js';
|
||||||
|
//const OSC = require('osc-js');
|
||||||
|
|
||||||
|
const comm = new OSC();
|
||||||
|
comm.open();
|
||||||
|
|
||||||
|
Pattern.prototype.osc = function () {
|
||||||
|
return this._withEvent((event) => {
|
||||||
|
const onTrigger = (time, event) => {
|
||||||
|
const keyvals = Object.entries(event.value).flat();
|
||||||
|
const message = new OSC.message("/dirt/play", ...keyvals);
|
||||||
|
comm.send(message);
|
||||||
|
};
|
||||||
|
return event.setContext({ ...event.context, onTrigger });
|
||||||
|
});
|
||||||
|
};
|
||||||
Loading…
Add table
Add a link
Reference in a new issue