diff --git a/packages/core/controls.mjs b/packages/core/controls.mjs index 4c5f40c8..165508a7 100644 --- a/packages/core/controls.mjs +++ b/packages/core/controls.mjs @@ -40,11 +40,6 @@ const generic_params = [ * @example * 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(""._asNumber()).osc() - // -> .n or .osc (or .superdirt) would need to convert note strings to numbers // also see https://github.com/tidalcycles/strudel/pull/63 ['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'], diff --git a/packages/osc/osc.mjs b/packages/osc/osc.mjs index 72eb4e7f..4e1011b1 100644 --- a/packages/osc/osc.mjs +++ b/packages/osc/osc.mjs @@ -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 { Pattern } from '@strudel.cycles/core'; +import { parseNumeral, Pattern } from '@strudel.cycles/core'; const comm = new OSC(); comm.open(); @@ -31,6 +31,10 @@ Pattern.prototype.osc = function () { startedAt = Date.now() - currentTime * 1000; } 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 ts = Math.floor(startedAt + (time + latency) * 1000); const message = new OSC.Message('/dirt/play', ...keyvals);