mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-26 21:18:49 +00:00
pull in midi logic
This commit is contained in:
parent
42922a0d75
commit
59e1664223
@ -70,8 +70,6 @@ const getSoundfontKey = (s) => {
|
|||||||
|
|
||||||
const getSampleBufferSource = async (s, n, note) => {
|
const getSampleBufferSource = async (s, n, note) => {
|
||||||
let transpose = 0;
|
let transpose = 0;
|
||||||
const midi = typeof note === 'string' ? toMidi(note) : note;
|
|
||||||
transpose = midi - 36; // C3 is middle C
|
|
||||||
const ac = getAudioContext();
|
const ac = getAudioContext();
|
||||||
// is sample from loaded samples(..)
|
// is sample from loaded samples(..)
|
||||||
const samples = getLoadedSamples();
|
const samples = getLoadedSamples();
|
||||||
@ -92,6 +90,8 @@ const getSampleBufferSource = async (s, n, note) => {
|
|||||||
if (!note) {
|
if (!note) {
|
||||||
throw new Error('no note(...) set for sound', s);
|
throw new Error('no note(...) set for sound', s);
|
||||||
}
|
}
|
||||||
|
const midi = typeof note === 'string' ? toMidi(note) : note;
|
||||||
|
transpose = midi - 36; // C3 is middle C
|
||||||
const midiDiff = (noteA) => toMidi(noteA) - midi;
|
const midiDiff = (noteA) => toMidi(noteA) - midi;
|
||||||
// object format will expect keys as notes
|
// object format will expect keys as notes
|
||||||
const closest = Object.keys(bank)
|
const closest = Object.keys(bank)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user