Formatting and tests

This commit is contained in:
Aria 2025-09-10 21:39:02 -05:00
parent 51b150b829
commit 9848740e18
6 changed files with 85 additions and 8 deletions

View file

@ -15,4 +15,4 @@ export const getAudioContext = () => {
export function getAudioContextCurrentTime() {
return getAudioContext().currentTime;
}
}

View file

@ -1,6 +1,7 @@
import { getAudioContext } from './audioContext.mjs';
import { clamp, ffloor, nanFallback } from './util.mjs';
import { clamp, nanFallback } from './util.mjs';
import { getNoiseBuffer } from './noise.mjs';
import { logger } from './logger.mjs';
export const noises = ['pink', 'white', 'brown', 'crackle'];
@ -365,7 +366,7 @@ const _chebyshev = (x, k) => {
tnm2 = tnm1;
tnm1 = tn;
if (i % 2 === 0) {
y += Math.min(1.3 * kl / i, 2) * tn;
y += Math.min((1.3 * kl) / i, 2) * tn;
}
}
// Soft clip

View file

@ -77,4 +77,4 @@ export function secondsToCycle(t, cps) {
return t * cps;
}
export const ffloor = (x) => x | 0; // fast floor for positive numbers
export const ffloor = (x) => x | 0; // fast floor for positive numbers

View file

@ -4,7 +4,7 @@
import OLAProcessor from './ola-processor';
import FFT from './fft.js';
import { getDistortionAlgorithm } from './helpers.mjs';
import { getDistortionAlgorithm } from './helpers.mjs';
const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
const _mod = (n, m) => ((n % m) + m) % m;