Published
Edited
May 18, 2021
1 star
Insert cell
Insert cell
Insert cell
Insert cell
{
await WebMidi.enable();
// Delay needed or inputs will be empty...
await delay(1);
const inputs = WebMidi.inputs;
for (const input of WebMidi.inputs) {
input.addListener("noteon", "all", (event) => {
notes.push(event);
synth.triggerAttack(`${event.note.name}${event.note.octave}`, Tone.now());
});
input.addListener("noteoff", "all", (event) => {
synth.triggerRelease(
[`${event.note.name}${event.note.octave}`],
Tone.now()
);
});
}
return WebMidi;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more