Repository navigation
Turning a macro changes the notes already sounding - #172
Merged
Merged
Conversation
…Env Amount, Noise Mix and Overdrive Each continuous macro is one shared synthio block that every note reads, so a macro change reaches the notes already sounding (#166). _support gains live(), gain() and block_value(); note_is_silent() reads a live amplitude's current value.
…struments Volume, filter cutoff and resonance, layer mixes, envelope amounts and modulation depths and rates are shared blocks every note reads, so a macro change reaches a held chord. Envelope times, glide, pitch and anything baked into a waveform stay next-note. Renders with macros set before the note are byte-identical to before on CPython, MicroPython and CircuitPython. tests/test_live_macros.py holds a note per live macro and asserts it moves.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hold a chord and turn Cutoff: you now hear the sweep. Until now every instrument read its macros when a note started, so
set_macro()reached only the next note, and a filter sweep over a held note, the most basic synth gesture, wasn't possible.Fixes #166.
What you'll hear
On all 43 melodic instruments, the continuous macros reach the notes that are already sounding, on their next audio block: volume, filter cutoffs and resonance, layer mixes, filter-envelope amounts, brightness and tone controls, drive, and modulation depths and rates. That is 246 macros in all.
A macro set before a note sounds exactly as it did before this change. Every instrument, every macro at 0, 64 and 127, renders byte-identical to the previous release on CPython, MicroPython and CircuitPython.
What still waits for the next note, and why
Per instrument
* Live while its layer, LFO or wah is sounding; one that was off when the note started comes in on the next note.
Where a filter releases through its own sweep after note-off (arp2600, ms20, prophet_vs), the release follows Cutoff and Resonance too. Breath on the VL1 now stays live after pressure, where pressure used to freeze the filter for the rest of the note.
How it works
_support.live(value)gives a macro one sharedsynthio.Mathblock. Every note wires that block into its filter frequency, Q, amplitude or LFO, and the macro handler writesblock.a.gain()multiplies blocks for amplitudes that combine macros with velocity.note_is_silent(), which voice stealing uses, now reads a live amplitude's current value.Tests
tests/test_live_macros.pyholds a note on each instrument, moves each live macro to 0 and to 127, and asserts the held note comes out differently. Against the previous code it fails 244 of its 246 cases; the two that already passed are Mellotron's Volume and Tape Hiss, whose shared hiss note already followed the knob.The instrument, API, polyphony, scheduling, sequencer, tempo-follow, shared-circuit and reset tests pass, as does
tools/validate_api.py.