Make an 8-bit sound with a Preset, Randomize or Mutate (#329)
A Chip could play a sound, but finding a good one meant typing a dozen numbers. sfxr's buttons do that in one click: a kind of sound drawn anew every time, a wild draw, or a small nudge. The Instrument tab now has the same, and plays the result at once. - Preset menu with Pickup, Laser, Explosion, Powerup, Hit, Jump and Blip. It puts a new graph in place of the instrument's, as one undo step: Notes for all 128 notes, Chip, Envelope, Filter, Bitcrusher, Output. The Chip keeps its own frequency with follow note off, so every key plays the same effect, and sustain 0 ends it by itself. - The presets are sfxr's generators, worked out into Hz, semitones and seconds with sfxr's own formulas, in chipPresets.ts. sfxr's envelope holds and falls in a line, ours falls quick at first. So the decay is three times sfxr's hold and fall. - Randomize draws every number of the Chips, Envelopes, Filters and Bitcrushers anew, as sfxr's randomizer does. Waves, filter types, the Bitcrusher's mix and an Envelope's from and to stay. - Mutate moves each of those numbers a little, one in two. A 0 stays 0, so nothing that was off comes on. - An input fed by an edge is left alone by both. Both are grey while the graph has none of those nodes. - Audition, off by default as in the Pattern tab, plays the note last played again 150 ms after a change to the graph rests. - Preset, Randomize and Mutate always play that note, for up to 2 s. - ReplaceGraphCommand swaps nodes and edges and keeps groups and notes. - The info on the right of the header kept 220 px and was cut off with the four new buttons. 140 px still fit "No sound picked". Not done: punch, filter sweeps and the phaser of sfxr (#341). Tests: - Unit chip-presets (new) 7. Counter-check: a wrong Hz formula and fed inputs not left alone turn 3 of them red. Unit tests of the instrument tab, graph commands and sound FX nodes: 49 files, 851 green. - e2e 34 (melektaus-atx): ALL PASSED, 64 checks (4 new): Preset, Randomize and Mutate, Audition, three undos back to the Sample. - Screenshot with a Laser preset: the header fits at 1280 px, the chain is fitted, the Chip is a saw with its duty grey. - Gate (melektaus-atx): CHECK EXIT 0, 256 files, 3969 tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f46b2316f2
commit
f3ae19431a
7 files changed
+906
-9
No files matched your search
@@ -135,6 +135,13 @@ export function graphHooks({ state, editor }: HookContext) {
|
||||
}),
|
||||
keyAt: (note: number) => editor.instrumentEditor.keyboard.keyCentre(note),
|
||||
stopAt: () => centreOf(editor.instrumentEditor.stopButton),
|
||||
presetAt: () => centreOf(editor.instrumentEditor.presetButton),
|
||||
randomizeAt: () => centreOf(editor.instrumentEditor.randomizeButton),
|
||||
mutateAt: () => centreOf(editor.instrumentEditor.mutateButton),
|
||||
auditionAt: () => ({
|
||||
...centreOf(editor.instrumentEditor.auditionButton),
|
||||
toggled: editor.instrumentEditor.auditionButton.toggled,
|
||||
}),
|
||||
params: () => editor.instrumentEditor.previewValues,
|
||||
setParam: (key: string, value: number) => editor.instrumentEditor.setPreviewValue(key, value),
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user