Final cleanup
This commit is contained in:
parent
f8c9425569
commit
157b05536a
1 changed files with 2 additions and 13 deletions
|
|
@ -591,10 +591,6 @@ class PhaseVocoderProcessor extends OLAProcessor {
|
||||||
this.fftSize = this.blockSize;
|
this.fftSize = this.blockSize;
|
||||||
this.invfftSize = 1 / this.fftSize;
|
this.invfftSize = 1 / this.fftSize;
|
||||||
this.hannWindow = genHannWindow(this.fftSize);
|
this.hannWindow = genHannWindow(this.fftSize);
|
||||||
// rescale hann window (empirically sounds nicer)
|
|
||||||
for (let i = 0; i < this.hannWindow.length; i++) {
|
|
||||||
this.hannWindow[i] *= 1.62;
|
|
||||||
}
|
|
||||||
// prepare FFT and pre-allocate buffers
|
// prepare FFT and pre-allocate buffers
|
||||||
this.fft = new FFT(this.fftSize);
|
this.fft = new FFT(this.fftSize);
|
||||||
this.freqComplexBuffer = this.fft.createComplexArray();
|
this.freqComplexBuffer = this.fft.createComplexArray();
|
||||||
|
|
@ -633,7 +629,7 @@ class PhaseVocoderProcessor extends OLAProcessor {
|
||||||
/** Apply Hann window in-place */
|
/** Apply Hann window in-place */
|
||||||
applyHannWindow(input) {
|
applyHannWindow(input) {
|
||||||
for (let i = 0; i < this.blockSize; i++) {
|
for (let i = 0; i < this.blockSize; i++) {
|
||||||
input[i] *= this.hannWindow[i];
|
input[i] *= this.hannWindow[i] * 1.62;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -791,7 +787,7 @@ class PulseOscillatorProcessor extends AudioWorkletProcessor {
|
||||||
const detune = pv(params.detune, i);
|
const detune = pv(params.detune, i);
|
||||||
const freq = applySemitoneDetuneToFrequency(pv(params.frequency, i), detune / 100);
|
const freq = applySemitoneDetuneToFrequency(pv(params.frequency, i), detune / 100);
|
||||||
|
|
||||||
dphi = freq * (PI / (sampleRate * 0.5)); // phase increment
|
dphi = freq * TWO_PI * INVSR; // phase increment
|
||||||
this.dphif += 0.1 * (dphi - this.dphif);
|
this.dphif += 0.1 * (dphi - this.dphif);
|
||||||
|
|
||||||
env *= 0.9998; // exponential decay envelope
|
env *= 0.9998; // exponential decay envelope
|
||||||
|
|
@ -981,7 +977,6 @@ export const WarpMode = Object.freeze({
|
||||||
SIGMOID: 19,
|
SIGMOID: 19,
|
||||||
FRACTAL: 20,
|
FRACTAL: 20,
|
||||||
FLIP: 21,
|
FLIP: 21,
|
||||||
MODULAR: 22,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function hash32(u) {
|
function hash32(u) {
|
||||||
|
|
@ -1162,12 +1157,6 @@ class WavetableOscillatorProcessor extends AudioWorkletProcessor {
|
||||||
const ridx = bitReverse(idx, b);
|
const ridx = bitReverse(idx, b);
|
||||||
return ridx / n;
|
return ridx / n;
|
||||||
}
|
}
|
||||||
case WarpMode.MODULAR: {
|
|
||||||
const { n } = this._toBits(amt);
|
|
||||||
const depth = 0.5 * amt;
|
|
||||||
const jump = ffrac(phase * n) / n;
|
|
||||||
return ffrac(phase + depth * jump);
|
|
||||||
}
|
|
||||||
case WarpMode.BROWNIAN: {
|
case WarpMode.BROWNIAN: {
|
||||||
const disp = 0.25 * amt * brownian(64 * phase, 4);
|
const disp = 0.25 * amt * brownian(64 * phase, 4);
|
||||||
return frac(phase + disp);
|
return frac(phase + disp);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue