Fixing density and adding documentation
This commit is contained in:
parent
476bda812e
commit
fb28083ce6
5 changed files with 22 additions and 4 deletions
|
|
@ -35,7 +35,8 @@ function getNoiseBuffer(type, density) {
|
|||
output[i] *= 0.11;
|
||||
b6 = white * 0.115926;
|
||||
} else if (type === 'crackle') {
|
||||
if (Math.random() < (Math.random() * (density - 0.001) + density).toFixed(4)) {
|
||||
const probability = density * 0.01
|
||||
if (Math.random() < probability) {
|
||||
output[i] = Math.random() * 2 - 1;
|
||||
} else {
|
||||
output[i] = 0;
|
||||
|
|
|
|||
|
|
@ -241,6 +241,7 @@ export const superdough = async (value, deadline, hapDuration) => {
|
|||
source,
|
||||
gain = 0.8,
|
||||
postgain = 1,
|
||||
density = 0.03,
|
||||
// filters
|
||||
ftype = '12db',
|
||||
fanchor = 0.5,
|
||||
|
|
|
|||
|
|
@ -36,7 +36,8 @@ export function registerSynthSounds() {
|
|||
if (waveforms.includes(s)) {
|
||||
sound = getOscillator(s, t, value);
|
||||
} else {
|
||||
sound = getNoiseOscillator(s, t, 0.002);
|
||||
let { density } = value;
|
||||
sound = getNoiseOscillator(s, t, density);
|
||||
}
|
||||
|
||||
let { node: o, stop, triggerRelease } = sound;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue