Swirl and comb a sound with a Phaser and a Flanger node (#341)
sfxr's "phaser" is a comb filter, the sound plus a copy delayed by up to 2.9 ms. That is a flanger, not the phaser a guitarist knows. Both effects come in as nodes of their own, so each name fits its sound and sfxr is covered in full. Both run on the FX worklet like the Bitcrusher, because a feedback loop in Web Audio costs a render quantum per round. - Phaser: first-order allpasses (Stages 2, 4, 6, 8, 12) around Frequency, moved by a sine LFO Depth octaves wide at Rate Hz, with Feedback and Mix. An Envelope can move Frequency and Mix. - Flanger: a delay line of Offset ms. Sweep moves it on in ms/s from the start of the voice, an LFO adds up to Depth ms. As in sfxr the delay is mirrored at 0, and it never goes past 20 ms. Feedback comes back exactly one delay later. An Envelope can move Offset and Mix. - Mix 0 leaves the sound as it is, 1 is half sound and half copy. The notches are deepest there and the peaks stay at the sound's level. sfxr adds both at full, so its sound comes out 6 dB louder. - The Flanger's processor gets the start of its voice and begins the sweep on that sample. stageNodes takes it as a new argument `at`. - Explosion gets a Flanger in one draw out of two, with sfxr's offset and sweep and no LFO. Offset is offset^2 * 2.89 ms, Sweep is ramp^2 * 125 ms/s, signed so the direction holds. - Randomize draws a Flanger's offset and sweep like sfxr. Its LFO and feedback and all of a Phaser are drawn within bounds of their own. Mix and Stages stay, as a Bitcrusher's Mix does. Mutate moves them too, and a 0 stays 0. - New instrument preset Phased Pad: saw, Envelope, low-pass, Phaser of six stages. The other 14 are unchanged. - The Bitcrusher's worklet setup is now shared with both nodes (workletNodes), its behaviour is unchanged. Tests: - Unit phaser (new): 8 green. Counter-check with clamping at 0 instead of mirroring and a flipped allpass coefficient: 3 red. - Unit soundfx, sound-library, chip-presets: 45 / 76 / 14 green. Counter-checks: start time not passed on, phaser frequency eased linearly, sweep sign dropped, Phaser left out of Mutate, each red. - Unit core, viewport, graph: 179 files, 2979 tests green. - e2e 34 (melektaus-atx): ALL PASSED, 70 checks (1 new), first run. Chrome offline: 1 kHz notch RMS 0.0000 with two stages, 0.5657 with four. Flanger echo after 48 samples, swept echo at 533/534. About 47 Phasers (12 stages) or 63 Flangers fill the audio thread. - Gate (melektaus-atx): CHECK EXIT 0, 257 files, 3991 tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
29b604dc07
commit
01fd6e6464
13 files changed
+999
-48
No files matched your search
@@ -73,8 +73,12 @@ export function installDebugHook(app: Application, state: EditorState, editor: E
|
||||
playbacks: () => soundLibrary.playbacks(),
|
||||
/** Whether the audio clock is held by the pause of the toolbar or runs. */
|
||||
clockState: () => soundLibrary.clockState(),
|
||||
/** The nodes a stage of a voice becomes, in any context – an offline one renders what it does. */
|
||||
stageNodes: (context: BaseAudioContext, stage: FxStage) => stageNodes(context, stage),
|
||||
/**
|
||||
* The nodes a stage of a voice becomes, in any context – an offline one renders what it does.
|
||||
* `at` is when its voice starts, which a Flanger's sweep counts from (#341).
|
||||
*/
|
||||
stageNodes: (context: BaseAudioContext, stage: FxStage, at?: number) =>
|
||||
stageNodes(context, stage, undefined, at),
|
||||
/** What drives the two shares of a Mix "Both at center", in any context (unstarted). */
|
||||
bothAtCenter: (context: BaseAudioContext, mix: number, a: GainNode, b: GainNode) =>
|
||||
bothAtCenter(context, mix, a, b),
|
||||
|
||||
@@ -91,11 +91,12 @@ export class InstrumentEditor extends AssetTabEditor<InstrumentAsset, GraphCanva
|
||||
onClick: () => this.openPresetMenu(),
|
||||
});
|
||||
this.randomizeButton = new Button('Randomize', {
|
||||
tooltip: 'Draw every number of the Chips, Envelopes, Filters and Bitcrushers anew',
|
||||
tooltip: 'Draw every number of the Chips, Envelopes, Filters, Bitcrushers, Phasers and Flangers anew',
|
||||
onClick: () => this.randomize(),
|
||||
});
|
||||
this.mutateButton = new Button('Mutate', {
|
||||
tooltip: 'Move some numbers of the Chips, Envelopes, Filters and Bitcrushers a little',
|
||||
tooltip:
|
||||
'Move some numbers of the Chips, Envelopes, Filters, Bitcrushers, Phasers and Flangers a little',
|
||||
onClick: () => this.mutate(),
|
||||
});
|
||||
this.auditionButton = new Button('Audition', {
|
||||
|
||||
Reference in new issue
Block a user