From 05a43ef687729766524dde006964ef31cf045fce Mon Sep 17 00:00:00 2001 From: eefano <77832+eefano@users.noreply.github.com> Date: Tue, 2 Jun 2026 13:14:30 +0200 Subject: [PATCH 1/4] included midichan value in midikeys haps --- packages/midi/midi.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/midi/midi.mjs b/packages/midi/midi.mjs index bd40b743e..51a077115 100644 --- a/packages/midi/midi.mjs +++ b/packages/midi/midi.mjs @@ -633,7 +633,7 @@ export async function midikeys(input) { */ return; } else { - value = { ...value, note: Math.round(note), velocity: velocity / 127 }; + value = { ...value, note: Math.round(note), velocity: velocity / 127, midichan: message.channel }; } kHaps[input].push(new Hap(span, span, value, {})); if (!noteoff && triggerAvailable) { From 0ae2c120b33ea5613d631625403505ad51c8cff6 Mon Sep 17 00:00:00 2001 From: eefano <77832+eefano@users.noreply.github.com> Date: Tue, 2 Jun 2026 13:28:23 +0200 Subject: [PATCH 2/4] updated documentation for midikeys --- packages/midi/midi.mjs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/midi/midi.mjs b/packages/midi/midi.mjs index 51a077115..73383a378 100644 --- a/packages/midi/midi.mjs +++ b/packages/midi/midi.mjs @@ -536,6 +536,9 @@ export async function midin(input) { * * The note length is fixed as Superdough is not currently set up for undetermined * note durations + * + * The 'midichan' control value contains the number of the channel the note is coming from + * so it could be filtered or manipulated further in the chain. * * @name midikeys * @tags external_io, midi @@ -552,6 +555,10 @@ export async function midin(input) { * .s("saw") * .add(note(rand.mul(0.3))) * .lpf(1000).lpe(2).room(0.5) + * @example + * // discard all notes not coming out from midi channel 2 + * const kb = await midikeys('Arturia KeyStep 32') + * kb().filterValues(v=>v.midichan==2).s("tri") */ const kHaps = {}; const kListeners = {}; From 58f956b57e5f9f94be10e14c3d8ba954187637e9 Mon Sep 17 00:00:00 2001 From: eefano <77832+eefano@users.noreply.github.com> Date: Tue, 2 Jun 2026 14:29:28 +0200 Subject: [PATCH 3/4] prettier fix --- packages/midi/midi.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/midi/midi.mjs b/packages/midi/midi.mjs index 73383a378..5880ca268 100644 --- a/packages/midi/midi.mjs +++ b/packages/midi/midi.mjs @@ -536,7 +536,7 @@ export async function midin(input) { * * The note length is fixed as Superdough is not currently set up for undetermined * note durations - * + * * The 'midichan' control value contains the number of the channel the note is coming from * so it could be filtered or manipulated further in the chain. * From 2635716c878059ef5c5ee89898841a50fae9cc0f Mon Sep 17 00:00:00 2001 From: eefano <77832+eefano@users.noreply.github.com> Date: Tue, 2 Jun 2026 14:56:55 +0200 Subject: [PATCH 4/4] added midikeys third test --- test/__snapshots__/examples.test.mjs.snap | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/__snapshots__/examples.test.mjs.snap b/test/__snapshots__/examples.test.mjs.snap index f7989dc7e..f465f06bf 100644 --- a/test/__snapshots__/examples.test.mjs.snap +++ b/test/__snapshots__/examples.test.mjs.snap @@ -7927,6 +7927,8 @@ exports[`runs examples > example "midikeys" example index 0 1`] = `[]`; exports[`runs examples > example "midikeys" example index 1 1`] = `[]`; +exports[`runs examples > example "midikeys" example index 2 1`] = `[]`; + exports[`runs examples > example "midin" example index 0 1`] = ` [ "[ 0/1 → 1/4 | note:c cutoff:0 resonance:0 s:sawtooth ]",