mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-27 05:28:41 +00:00
fix non note samples
This commit is contained in:
parent
09b06da403
commit
c6d57f6a56
@ -39,8 +39,7 @@ export const valueToMidi = (value, fallbackValue) => {
|
|||||||
if (typeof value !== 'object') {
|
if (typeof value !== 'object') {
|
||||||
throw new Error('valueToMidi: expected object value');
|
throw new Error('valueToMidi: expected object value');
|
||||||
}
|
}
|
||||||
let { freq, note, n } = value;
|
let { freq, note } = value;
|
||||||
note = note ?? n;
|
|
||||||
if (typeof freq === 'number') {
|
if (typeof freq === 'number') {
|
||||||
return freqToMidi(freq);
|
return freqToMidi(freq);
|
||||||
}
|
}
|
||||||
@ -51,7 +50,7 @@ export const valueToMidi = (value, fallbackValue) => {
|
|||||||
return note;
|
return note;
|
||||||
}
|
}
|
||||||
if (!fallbackValue) {
|
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;
|
return fallbackValue;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -25,7 +25,7 @@ export const getSampleBufferSource = async (s, n, note, speed, freq) => {
|
|||||||
if (freq !== undefined && note !== undefined) {
|
if (freq !== undefined && note !== undefined) {
|
||||||
logger('[sampler] hap has note and freq. ignoring note', 'warning');
|
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
|
transpose = midi - 36; // C3 is middle C
|
||||||
|
|
||||||
const ac = getAudioContext();
|
const ac = getAudioContext();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user