OSC/SuperDirt fixes (#1093)
* If note is a midi note, and it's sent together with octave to SuperDirt, then that will be wrong. instead we should to midinote whenever sure that it's a midi note. * mapbank to work like tidal's drumFrom * roomsize is size in SuperDirt * fix tidal-sniffer * export `registerControl` (but see #1098)
This commit is contained in:
parent
55c7f2b575
commit
e268802f3c
3 changed files with 12 additions and 4 deletions
|
|
@ -6,7 +6,7 @@ This program is free software: you can redistribute it and/or modify it under th
|
|||
|
||||
import OSC from 'osc-js';
|
||||
|
||||
import { logger, parseNumeral, Pattern, getEventOffsetMs } from '@strudel/core';
|
||||
import { logger, parseNumeral, Pattern, getEventOffsetMs, isNote, noteToMidi } from '@strudel/core';
|
||||
|
||||
let connection; // Promise<OSC>
|
||||
function connect() {
|
||||
|
|
@ -52,7 +52,15 @@ Pattern.prototype.osc = function () {
|
|||
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));
|
||||
if (typeof controls.note !== 'undefined') {
|
||||
if (isNote(controls.note)) {
|
||||
controls.midinote = noteToMidi(controls.note, controls.octave || 3);
|
||||
} else {
|
||||
controls.note = parseNumeral(controls.note);
|
||||
}
|
||||
}
|
||||
controls.bank && (controls.s = controls.bank + controls.s);
|
||||
controls.roomsize && (controls.size = parseNumeral(controls.roomsize));
|
||||
const keyvals = Object.entries(controls).flat();
|
||||
// time should be audio time of onset
|
||||
// currentTime should be current time of audio context (slightly before time)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue