Play tunes on 14 instrument presets next to the sfxr sounds (#329)
The Preset menu only had sfxr's effects: each a fixed pitch on every key that dies away by itself. Now its top half holds instruments to play melodies, basses and drums on. - Instruments: Square Lead, Pulse Lead, Echo Lead, Octave Arp, Synth Brass, Detuned Saws, String Pad, Organ, Flute, Bell, Pluck, Triangle Bass, Pluck Bass and Drum Kit. A line in the menu parts them from the seven effects below. - Their Chips follow the note, and all but Bell, Pluck and the drums hold it while the key is held. - They come out the same every time they are picked. Randomize and Mutate make a variant, as before. - They use what the graph already has: two Chips through a Mix for Detuned Saws, String Pad, Organ, Flute and Bell, an Envelope on a Filter's cutoff for Brass, Pluck and Pluck Bass, a Pitch for the detune and the octave, a Delay for Echo Lead and Bell. - Drum Kit uses single notes 36 to 46: kick, snare, closed and open hat on their General MIDI keys, each ending by itself. - A small Sketch helper lays the nodes on a grid. The sfxr presets use it too and come out as before. - Numbers keep to the steps of their rows. Pulse Lead's duty is 0.13, not 0.125, because the field rounds to 0.01. Tests: - Unit chip-presets: 12 green (5 new). Every instrument compiles without a problem, doubles its frequency an octave up, holds unless struck and is the same on every pick. The drum kit sounds on exactly 36, 38, 42 and 46. Countercheck with Follow note forced off: red. - e2e 34 (CI image on stein2, melektaus-atx was off): ALL PASSED, 65 checks (1 new). A first run had the scheduler's looped-bar check red by 10 ticks between two clock reads, which the presets do not touch; the second run was green. - Gate (stein2): CHECK EXIT 0, 256 files, 3974 tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f3ae19431a
commit
a2d0a02645
4 files changed
+467
-43
No files matched your search
@@ -1161,6 +1161,28 @@ export async function sound(t) {
|
||||
restored.types.join() === 'InstrumentNotes,InstrumentSample,InstrumentOutput',
|
||||
JSON.stringify(restored.types),
|
||||
);
|
||||
|
||||
// 34g-7. An instrument to play tunes on: Preset → Square Lead follows the note and holds it, and
|
||||
// plays C4 at once. One undo takes it back.
|
||||
await evaluate('__gm.sound.stopAll()');
|
||||
const beforeLead = await stats();
|
||||
await clickHook('presetAt');
|
||||
await clickText('Square Lead');
|
||||
const lead = await waitFor(stats, (s) => s.started > beforeLead.started);
|
||||
const leadGraph = await insGraph();
|
||||
const leadInfo = await json('__gm.instrument.info()');
|
||||
await t.clickToolbar('undo');
|
||||
const unled = await insGraph();
|
||||
check(
|
||||
'Preset → Square Lead plays every note at its own pitch and holds it; one undo takes it back',
|
||||
['Square Lead', 'Organ', 'Bell', 'Drum Kit'].every((label) => presetMenu.includes(label)) &&
|
||||
leadGraph.chip?.followNote === true &&
|
||||
leadGraph.envelope?.sustain > 0 &&
|
||||
lead.last?.file === `instrument:${insId}` &&
|
||||
leadInfo === '128 notes' &&
|
||||
unled.types.join() === 'InstrumentNotes,InstrumentSample,InstrumentOutput',
|
||||
JSON.stringify({ chip: leadGraph.chip, envelope: leadGraph.envelope, last: lead.last, leadInfo, unled }),
|
||||
);
|
||||
await evaluate('__gm.sound.stopAll()');
|
||||
|
||||
await mutate(`
|
||||
|
||||
Reference in new issue
Block a user