mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-24 20:18:34 +00:00
note default to 36
This commit is contained in:
parent
7ef3d33d0e
commit
4d60a582fe
@ -100,12 +100,8 @@ const getSoundfontKey = (s) => {
|
|||||||
|
|
||||||
const getSampleBufferSource = async (s, n, note, speed) => {
|
const getSampleBufferSource = async (s, n, note, speed) => {
|
||||||
let transpose = 0;
|
let transpose = 0;
|
||||||
let midi;
|
let midi = typeof note === 'string' ? toMidi(note) : note || 36;
|
||||||
|
transpose = midi - 36; // C3 is middle C
|
||||||
if (note !== undefined) {
|
|
||||||
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(..)
|
||||||
@ -128,9 +124,6 @@ const getSampleBufferSource = async (s, n, note, speed) => {
|
|||||||
if (Array.isArray(bank)) {
|
if (Array.isArray(bank)) {
|
||||||
sampleUrl = bank[n % bank.length];
|
sampleUrl = bank[n % bank.length];
|
||||||
} else {
|
} else {
|
||||||
if (!note) {
|
|
||||||
throw new Error('no note(...) set for sound', s);
|
|
||||||
}
|
|
||||||
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