attempt to send an OSC message

This commit is contained in:
alex 2022-03-28 22:10:20 +01:00
parent 69884c61b4
commit 7fca7e6bd9
2 changed files with 11 additions and 4 deletions

View File

@ -1,5 +1,7 @@
import {OSC} from 'osc-js';
//const OSC = require('osc-js');
import OSC from './node_modules/osc-js/lib/osc.js';
import { Pattern, isPattern } from '@strudel.cycles/core/strudel.mjs';
//import {OSC} from 'osc-js';
const comm = new OSC();
comm.open();
@ -7,8 +9,12 @@ 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);
//const keyvals = Object.entries(event.value).flat();
//const message = new OSC.Message("/dirt/play", ...keyvals);
const message = new OSC.Message(
'/dirt/play',
...['_id_', '1', 'cps', 0.5625, 'cycle', 412.3333435058594, 'delta', 0.592592716217041, 'orbit', 0, 's', 'hh'],
);
comm.send(message);
};
return event.setContext({ ...event.context, onTrigger });

View File

@ -28,6 +28,7 @@ import '@strudel.cycles/xen/tune.mjs';
import '@strudel.cycles/core/euclid.mjs';
import '@strudel.cycles/tone/pianoroll.mjs';
import '@strudel.cycles/tone/draw.mjs';
import '@strudel.cycles/osc/osc.mjs';
extend(Tone, strudel, strudel.Pattern.prototype.bootstrap(), toneHelpers, voicingHelpers, drawHelpers, uiHelpers, {
gist,