From efd40716375a696190ceadd959d004cfdfc551fc Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Thu, 6 Feb 2025 13:51:53 +0100 Subject: [PATCH] remove midisounds for now --- packages/midi/midi.mjs | 33 ------------------------ test/examples.test.mjs | 1 - website/src/pages/learn/input-output.mdx | 4 --- 3 files changed, 38 deletions(-) diff --git a/packages/midi/midi.mjs b/packages/midi/midi.mjs index 70df93e8c..2c1d1f200 100644 --- a/packages/midi/midi.mjs +++ b/packages/midi/midi.mjs @@ -165,37 +165,6 @@ export async function midimaps(map) { // registry for midi sounds, converting sound names to controls export const midisoundMap = new Map(); -/** - * Maps a sound name to a set of controls: - * @example - * midisounds({ bd: { note: 'c2' } }) - * $: s("bd").midi() - * @example - * // notes can be set directly to simplify typical midi drum kit mappings - * midisounds({ bd: 'c2', rim: 'c#2' }) - * $: s("bd rim").midi() - **/ -export async function midisounds(map) { - if (typeof map === 'object') { - Object.entries(map).forEach(([name, mapping]) => midisoundMap.set(name, mapping)); - } -} - -function applyMidisounds(hapValue) { - const { s } = hapValue; - if (!midisoundMap.has(s)) { - return; - } - let controls = midisoundMap.get(hapValue.s); - if (Array.isArray(controls)) { - controls = controls[hapValue.n || 0]; - } - if (typeof controls === 'string') { - controls = { note: controls }; - } - Object.assign(hapValue, controls); -} - // normalizes the given value from the given range and exponent function normalize(value = 0, min = 0, max = 1, exp = 1) { if (min === max) { @@ -260,8 +229,6 @@ Pattern.prototype.midi = function (output) { const latencyMs = 34; // passing a string with a +num into the webmidi api adds an offset to the current time https://webmidijs.org/api/classes/Output const timeOffsetString = `+${getEventOffsetMs(targetTime, currentTime) + latencyMs}`; - // convert s to midisounds preset (if set) - applyMidisounds(hap.value); // destructure value let { diff --git a/test/examples.test.mjs b/test/examples.test.mjs index ccce6c2af..896a02f8a 100644 --- a/test/examples.test.mjs +++ b/test/examples.test.mjs @@ -20,7 +20,6 @@ const skippedExamples = [ 'accelerationX', 'defaultmidimap', 'midimaps', - 'midisounds', ]; describe('runs examples', () => { diff --git a/website/src/pages/learn/input-output.mdx b/website/src/pages/learn/input-output.mdx index 666a39f79..cec06a34f 100644 --- a/website/src/pages/learn/input-output.mdx +++ b/website/src/pages/learn/input-output.mdx @@ -56,10 +56,6 @@ Instead of setting `ccn` and `ccv` directly, you can also create mappings with ` -## midisounds - - - # OSC/SuperDirt/StrudelDirt In TidalCycles, sound is usually generated using [SuperDirt](https://github.com/musikinformatik/SuperDirt/), which runs inside SuperCollider. Strudel also supports using SuperDirt, although it requires installing some additional software.