pull out debugging fn

This commit is contained in:
Felix Roos 2023-08-31 03:53:52 +02:00
parent b991cfc493
commit 213b1a2dae

View File

@ -56,31 +56,7 @@ export const getZZFX = (value, t, duration) => {
decay,
tremolo,
];
const paramOrder = [
'volume',
'randomness',
'frequency',
'attack',
'sustain',
'release',
'shape',
'shapeCurve',
'slide',
'deltaSlide',
'pitchJump',
'pitchJumpTime',
'repeatTime',
'noise',
'modulation',
'bitCrush',
'delay',
'sustainVolume',
'decay',
'tremolo',
];
const readableParams = Object.fromEntries(paramOrder.map((param, i) => [param, params[i]]));
console.log(readableParams);
// console.log(redableZZFX(params));
const samples = /* ZZFX. */ buildSamples(...params);
const context = getAudioContext();
@ -112,6 +88,33 @@ export function registerZZFXSounds() {
});
}
// just for debugging
function redableZZFX(params) {
const paramOrder = [
'volume',
'randomness',
'frequency',
'attack',
'sustain',
'release',
'shape',
'shapeCurve',
'slide',
'deltaSlide',
'pitchJump',
'pitchJumpTime',
'repeatTime',
'noise',
'modulation',
'bitCrush',
'delay',
'sustainVolume',
'decay',
'tremolo',
];
return Object.fromEntries(paramOrder.map((param, i) => [param, params[i]]));
}
// https://github.com/KilledByAPixel/ZzFX/blob/master/ZzFX.js#L85C5-L180C6
// changes: replaced this.volume with 1 + using sampleRate from getAudioContext()
function buildSamples(