Repository navigation
fix(midi): fade via expression and restore it with the voice's next note - #2995
Merged
Merged
Conversation
Danielku15
force-pushed
the
feature/issue-2978
branch
from
October 29, 2026 18:13
11795d9 to
ce2651e
Compare
Fade in, fade out and volume swell ramped the channel volume and never restored it, silencing the rest of the track and overriding volume automations. Fades now ramp the expression controller, and after a fade out or volume swell the expression is restored when the same voice plays its next non-rest beat. Fixes #2978
Danielku15
force-pushed
the
feature/issue-2978
branch
from
October 29, 2026 18:48
ce2651e to
4957f09
Compare
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.
Note
AI-authored disclosure (
alphatab-ai-authored-v1)Portions of this content were authored by an AI agent. The agent has read
AGENTS.md and the human submitter accepts responsibility for
compliance with the rules in that document.
Issues
Fixes #2978
Proposed changes
Fade in, fade out and volume swell ramped the channel volume (CC7) and never restored it. After a fade out or volume swell the rest of the track was silent, and
changeTrackVolumecould not help because it scales that zeroed volume. Fades also ramped from or to the static track volume, ignoring volume automations.Fades now ramp the expression controller (CC11) instead. The synth multiplies volume and expression, so a fade scales whatever volume is in effect, and volume automations and the track volume keep working. This is also the usual split in MIDI (CC7 for the mixer level, CC11 for performance dynamics), so exported MIDI files behave the same way in other software.
After a fade out or volume swell, the expression is restored when the same voice plays its next non-rest beat, at that beat's real start tick. Restoring at the end of the faded beat would make the release of the faded note audible again (about −7 dB for roughly 250 ms with the default SoundFont) whenever a rest follows. Because generation follows play order, repeats, jumps, triplet feel and grace notes need no extra handling. A following fade beat sets the expression with its own ramp. Single-beat playback restores at the end of the beat.
Known limitations, accepted to keep this simple:
Tests cover the fade ramps, the restore after rests across bars, repeats, Scottish triplet feel, a fade out into a fade in, volume automation staying intact, and an audio render checking that the rest after a fade out stays silent and the following notes are audible.
Checklist
AI authorship disclosure
(
alphatab-ai-authored-v1) is present at the top of this body, and I havepersonally reviewed every change and can explain each one
Further details