mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-24 12:08:28 +00:00
fix: osc notes
This commit is contained in:
parent
fbf7c6293f
commit
e3bc63e4fa
@ -40,11 +40,6 @@ const generic_params = [
|
|||||||
* @example
|
* @example
|
||||||
* n("0 1 2 3").s('east').osc()
|
* n("0 1 2 3").s('east').osc()
|
||||||
*/
|
*/
|
||||||
// TODO: nOut does not work
|
|
||||||
// TODO: notes don't work as expected
|
|
||||||
// current "workaround" for notes:
|
|
||||||
// s('superpiano').n("<c0 d0 e0 g0>"._asNumber()).osc()
|
|
||||||
// -> .n or .osc (or .superdirt) would need to convert note strings to numbers
|
|
||||||
// also see https://github.com/tidalcycles/strudel/pull/63
|
// also see https://github.com/tidalcycles/strudel/pull/63
|
||||||
['f', 'n', 'The note or sample number to choose for a synth or sampleset'],
|
['f', 'n', 'The note or sample number to choose for a synth or sampleset'],
|
||||||
['f', 'note', 'The note or pitch to play a sound or synth with'],
|
['f', 'note', 'The note or pitch to play a sound or synth with'],
|
||||||
|
|||||||
@ -5,7 +5,7 @@ This program is free software: you can redistribute it and/or modify it under th
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import OSC from 'osc-js';
|
import OSC from 'osc-js';
|
||||||
import { Pattern } from '@strudel.cycles/core';
|
import { parseNumeral, Pattern } from '@strudel.cycles/core';
|
||||||
|
|
||||||
const comm = new OSC();
|
const comm = new OSC();
|
||||||
comm.open();
|
comm.open();
|
||||||
@ -31,6 +31,10 @@ Pattern.prototype.osc = function () {
|
|||||||
startedAt = Date.now() - currentTime * 1000;
|
startedAt = Date.now() - currentTime * 1000;
|
||||||
}
|
}
|
||||||
const controls = Object.assign({}, { cps, cycle, delta }, hap.value);
|
const controls = Object.assign({}, { cps, cycle, delta }, hap.value);
|
||||||
|
// make sure n and note are numbers
|
||||||
|
controls.n && (controls.n = parseNumeral(controls.n));
|
||||||
|
controls.note && (controls.note = parseNumeral(controls.note));
|
||||||
|
|
||||||
const keyvals = Object.entries(controls).flat();
|
const keyvals = Object.entries(controls).flat();
|
||||||
const ts = Math.floor(startedAt + (time + latency) * 1000);
|
const ts = Math.floor(startedAt + (time + latency) * 1000);
|
||||||
const message = new OSC.Message('/dirt/play', ...keyvals);
|
const message = new OSC.Message('/dirt/play', ...keyvals);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user