update webmidi + remove tone piano

This commit is contained in:
Felix Roos 2022-11-04 20:36:33 +01:00
parent 854692f975
commit a677b94297
6 changed files with 395 additions and 627 deletions

1005
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -44,7 +44,6 @@
"c8": "^7.12.0", "c8": "^7.12.0",
"events": "^3.3.0", "events": "^3.3.0",
"gh-pages": "^4.0.0", "gh-pages": "^4.0.0",
"happy-dom": "^6.0.4",
"jsdoc": "^3.6.10", "jsdoc": "^3.6.10",
"jsdoc-json": "^2.0.2", "jsdoc-json": "^2.0.2",
"jsdoc-to-markdown": "^7.1.1", "jsdoc-to-markdown": "^7.1.1",

View File

@ -23,6 +23,6 @@
"dependencies": { "dependencies": {
"@strudel.cycles/tone": "^0.2.0", "@strudel.cycles/tone": "^0.2.0",
"tone": "^14.7.77", "tone": "^14.7.77",
"webmidi": "^2.5.2" "webmidi": "^3.0.21"
} }
} }

View File

@ -27,6 +27,6 @@
"dependencies": { "dependencies": {
"@strudel.cycles/core": "^0.2.0", "@strudel.cycles/core": "^0.2.0",
"@tonaljs/tonal": "^4.6.5", "@tonaljs/tonal": "^4.6.5",
"webmidi": "^3.0.15" "webmidi": "^3.0.21"
} }
} }

View File

@ -23,7 +23,6 @@
"homepage": "https://github.com/tidalcycles/strudel#readme", "homepage": "https://github.com/tidalcycles/strudel#readme",
"dependencies": { "dependencies": {
"@strudel.cycles/core": "^0.2.0", "@strudel.cycles/core": "^0.2.0",
"@tonejs/piano": "^0.2.1",
"chord-voicings": "^0.0.1", "chord-voicings": "^0.0.1",
"tone": "^14.7.77" "tone": "^14.7.77"
} }

View File

@ -30,8 +30,6 @@ const {
getDestination, getDestination,
Players, Players,
} = Tone; } = Tone;
import * as tonePiano from '@tonejs/piano';
const { Piano } = tonePiano;
import { getPlayableNoteValue } from '@strudel.cycles/core/util.mjs'; import { getPlayableNoteValue } from '@strudel.cycles/core/util.mjs';
// "balanced" | "interactive" | "playback"; // "balanced" | "interactive" | "playback";
@ -61,10 +59,6 @@ Pattern.prototype.tone = function (instrument) {
instrument.triggerAttack(note, time); instrument.triggerAttack(note, time);
} else if (instrument instanceof NoiseSynth) { } else if (instrument instanceof NoiseSynth) {
instrument.triggerAttackRelease(hap.duration.valueOf(), time); // noise has no value instrument.triggerAttackRelease(hap.duration.valueOf(), time); // noise has no value
} else if (instrument instanceof Piano) {
note = getPlayableNoteValue(hap);
instrument.keyDown({ note, time, velocity });
instrument.keyUp({ note, time: time + hap.duration.valueOf(), velocity });
} else if (instrument instanceof Sampler) { } else if (instrument instanceof Sampler) {
note = getPlayableNoteValue(hap); note = getPlayableNoteValue(hap);
instrument.triggerAttackRelease(note, hap.duration.valueOf(), time, velocity); instrument.triggerAttackRelease(note, hap.duration.valueOf(), time, velocity);
@ -110,11 +104,6 @@ export const players = (options, baseUrl = '') => {
}); });
}; };
export const synth = (options) => new Synth(options); export const synth = (options) => new Synth(options);
export const piano = async (options = { velocities: 1 }) => {
const p = new Piano(options);
await p.load();
return p;
};
// effect helpers // effect helpers
export const vol = (v) => new Gain(v); export const vol = (v) => new Gain(v);