Formatting and tests
This commit is contained in:
parent
51b150b829
commit
9848740e18
6 changed files with 85 additions and 8 deletions
|
|
@ -1586,7 +1586,7 @@ export const { shape } = registerControl(['shape', 'shapevol']);
|
|||
* @example
|
||||
* note("d1!8").s("sine").penv(36).pdecay(.12).decay(.23).distort("8:.4")
|
||||
* @example
|
||||
* s("bd*4").bank("tr909").distort("4:0.5:fold")
|
||||
* s("bd:4*4").bank("tr808").distort("3:0.5:diode")
|
||||
*
|
||||
*/
|
||||
export const { distort, dist } = registerControl(['distort', 'distortvol', 'distorttype'], 'dist');
|
||||
|
|
@ -1614,8 +1614,8 @@ export const { distortvol } = registerControl('distortvol', 'distvol');
|
|||
* @example
|
||||
* s("sine").note("F1*2").release(1)
|
||||
* .penv(24).pdecay(0.05)
|
||||
* .distort(70)
|
||||
* .distorttype("<fold decimate scurve hard soft diode asym>")
|
||||
* .distort(rand.range(1, 8))
|
||||
* .distorttype("<fold chebyshev scurve diode asym sinefold>")
|
||||
*/
|
||||
export const { distorttype } = registerControl('distorttype', 'disttype');
|
||||
|
||||
|
|
|
|||
|
|
@ -15,4 +15,4 @@ export const getAudioContext = () => {
|
|||
|
||||
export function getAudioContextCurrentTime() {
|
||||
return getAudioContext().currentTime;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue