fix non note samples
This commit is contained in:
parent
09b06da403
commit
c6d57f6a56
2 changed files with 3 additions and 4 deletions
|
|
@ -39,8 +39,7 @@ export const valueToMidi = (value, fallbackValue) => {
|
|||
if (typeof value !== 'object') {
|
||||
throw new Error('valueToMidi: expected object value');
|
||||
}
|
||||
let { freq, note, n } = value;
|
||||
note = note ?? n;
|
||||
let { freq, note } = value;
|
||||
if (typeof freq === 'number') {
|
||||
return freqToMidi(freq);
|
||||
}
|
||||
|
|
@ -51,7 +50,7 @@ export const valueToMidi = (value, fallbackValue) => {
|
|||
return note;
|
||||
}
|
||||
if (!fallbackValue) {
|
||||
throw new Error('Hap.getMidi: expected freq or n / note to be set');
|
||||
throw new Error('valueToMidi: expected freq or note to be set');
|
||||
}
|
||||
return fallbackValue;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ export const getSampleBufferSource = async (s, n, note, speed, freq) => {
|
|||
if (freq !== undefined && note !== undefined) {
|
||||
logger('[sampler] hap has note and freq. ignoring note', 'warning');
|
||||
}
|
||||
let midi = valueToMidi({ freq, n, note }, 36);
|
||||
let midi = valueToMidi({ freq, note }, 36);
|
||||
transpose = midi - 36; // C3 is middle C
|
||||
|
||||
const ac = getAudioContext();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue