mirror of
https://github.com/eliasstepanik/strudel.git
synced 2026-01-11 21:58:37 +00:00
try sending osc in timestamped bundle with added latency
This commit is contained in:
parent
0bfbd87bbf
commit
d0d19778a4
@ -4,16 +4,17 @@ import { Pattern, isPattern } from '@strudel.cycles/core/strudel.mjs';
|
||||
const comm = new OSC();
|
||||
comm.open();
|
||||
const startTime = Date.now();
|
||||
const latency = 0.1 * 1000;
|
||||
const latency = 0.2;
|
||||
|
||||
Pattern.prototype.osc = function () {
|
||||
return this._withEvent((event) => {
|
||||
const onTrigger = (time, event) => {
|
||||
console.log(time);
|
||||
const keyvals = Object.entries(event.value).flat();
|
||||
const ts = startTime + (time*1000);
|
||||
const message = new OSC.Message('/dirt/play', ts, ...keyvals);
|
||||
comm.send(message);
|
||||
const ts = startTime + ((time+latency)*1000);
|
||||
const message = new OSC.Message('/dirt/play',...keyvals);
|
||||
const bundle = new OSC.Bundle([message], ts)
|
||||
comm.send(bundle);
|
||||
};
|
||||
return event.setContext({ ...event.context, onTrigger });
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user