Merge pull request #1114 from daslyfe/fixworklets

Fix audio worklets
This commit is contained in:
Jade (Rose) Rowland 2024-05-26 11:33:05 -04:00 committed by GitHub
commit 8f7194144d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,7 +1,9 @@
// coarse, crush, and shape processors adapted from dktr0's webdirt: https://github.com/dktr0/WebDirt/blob/5ce3d698362c54d6e1b68acc47eb2955ac62c793/dist/AudioWorklets.js
// LICENSE GNU General Public License v3.0 see https://github.com/dktr0/WebDirt/blob/main/LICENSE
import { clamp, _mod } from './util.mjs';
// const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
// TOFIX: THIS FILE DOES NOT SUPPORT IMPORTS ON DEPOLYMENT
const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
const _mod = (n, m) => ((n % m) + m) % m;
const blockSize = 128;
// adjust waveshape to remove frequencies above nyquist to prevent aliasing
// referenced from https://www.kvraudio.com/forum/viewtopic.php?t=375517