mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-22 11:08:35 +00:00
simplify
This commit is contained in:
parent
85835087ba
commit
7c8a8b8b70
@ -57,19 +57,16 @@ export const getSampleBufferSource = async (s, n, note, speed, freq, vib, vibmod
|
|||||||
const bufferSource = ac.createBufferSource();
|
const bufferSource = ac.createBufferSource();
|
||||||
bufferSource.buffer = buffer;
|
bufferSource.buffer = buffer;
|
||||||
const playbackRate = 1.0 * Math.pow(2, transpose / 12);
|
const playbackRate = 1.0 * Math.pow(2, transpose / 12);
|
||||||
|
bufferSource.playbackRate.value = playbackRate;
|
||||||
if (vib > 0) {
|
if (vib > 0) {
|
||||||
let vibrato_oscillator = getAudioContext().createOscillator();
|
let vibrato_oscillator = getAudioContext().createOscillator();
|
||||||
vibrato_oscillator.frequency.value = vib;
|
vibrato_oscillator.frequency.value = vib;
|
||||||
const gain = getAudioContext().createGain();
|
const gain = getAudioContext().createGain();
|
||||||
// Vibmod is the amount of vibrato, in semitones
|
// Vibmod is the amount of vibrato, in semitones
|
||||||
bufferSource.playbackRate.value = Math.pow(2, transpose / 12);
|
|
||||||
gain.gain.value = vibmod / 4;
|
gain.gain.value = vibmod / 4;
|
||||||
vibrato_oscillator.connect(gain);
|
vibrato_oscillator.connect(gain);
|
||||||
gain.connect(bufferSource.playbackRate);
|
gain.connect(bufferSource.playbackRate);
|
||||||
vibrato_oscillator.start(0);
|
vibrato_oscillator.start(0);
|
||||||
} else {
|
|
||||||
bufferSource.playbackRate.value = Math.pow(2, transpose / 12);
|
|
||||||
bufferSource.playbackRate.value = playbackRate;
|
|
||||||
}
|
}
|
||||||
return bufferSource;
|
return bufferSource;
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user