Repository navigation
Sound module: Expression on every part, kept when a part's instrument is made again - #53
Merged
Merged
Conversation
…ment is made again CC11 only reached a SoundFont part, and a part forgot it when its instrument was made again (a bank change to another instrument and back, or All Sound Off). A part now keeps its Expression: on an instrument part it multiplies with volume in the mixer level, squared as on a SoundFont part, and a rebuilt SoundFont part has it before its first note.
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.
Expression (CC11) now works on every part of the sound module and a part keeps it when its instrument is made again. Closes #52.
On a part playing one of audioinstruments' instruments (bank 80), CC11 did nothing, so a MIDI file that fades such a part with Expression did not fade. And a SoundFont part lost its Expression when its instrument was made again, by a bank change to another instrument and back or by All Sound Off, which should stop the sound and keep the controllers. The part now remembers Expression the way it remembers volume and pan. On an instrument part, volume and Expression multiply and the product is squared, as a SoundFont part plays them; a rebuilt SoundFont part is given its Expression before its first note; Reset All Controllers and GM System On put it back to 127 on every part. The module's docstring says so.
I rendered one held note through the module on the FluidR3_GM bank, with audioinstruments 0.5.2.dev2, RMS against CC11 = 127. Before and after this change:
A SoundFont part set to CC11 = 32 played 23.5 RMS before the rebuild and 371.4 after it (-23.9 dB, then 0 dB: Expression lost) both by a bank change and back and by All Sound Off. With this change it plays 23.6 after both.
New checks in
tests/engine_contract.pycover the instrument part's level, Reset All Controllers, All Sound Off, a rebuilt SoundFont part and GM System On; each fails without the change, and three new plants break the module in the ways they guard against. Rantests/test_engine.py(the contract on CPython and every plant) against audioinstruments main; it passes. I did not run the MicroPython or CircuitPython contract; CI does.