hotfix: regression of #196
- samples loaded as arrays would not be repitched
This commit is contained in:
parent
88e1211762
commit
a5f05b4715
1 changed files with 7 additions and 2 deletions
|
|
@ -70,6 +70,13 @@ const getSoundfontKey = (s) => {
|
||||||
|
|
||||||
const getSampleBufferSource = async (s, n, note) => {
|
const getSampleBufferSource = async (s, n, note) => {
|
||||||
let transpose = 0;
|
let transpose = 0;
|
||||||
|
let midi;
|
||||||
|
|
||||||
|
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(..)
|
||||||
const samples = getLoadedSamples();
|
const samples = getLoadedSamples();
|
||||||
|
|
@ -90,8 +97,6 @@ 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…
Add table
Add a link
Reference in a new issue