Fix incorrect envelope time conversions in disting EX, 1010music and Maschine 2/3#174
Merged
Merged
Conversation
…Maschine 2/3 Three independent envelope-time conversion bugs found while auditing the creators and detectors. Each is a self-contained fix; the amplitude envelope of the same format is the correct reference in every case. * disting EX: a misplaced parenthesis in the amplitude decay conversion divided only the decay time (not hold + decay) by the time constant, so any hold time was effectively dropped from the written decay. Now (hold + decay) is divided as a whole, matching the reader (decay = 0.02 * exp(0.0521 * value)). * 1010music (blackbox and Bento): the amplitude decay and release were written with a 25 s full-scale but read back with a 38 s full-scale, so a decay/release did not round-trip and played noticeably shorter than the source. The attack already used 9 s on both sides; decay and release now use the 38 s read scale as well. * Maschine 2/3: the modulation (filter/pitch) envelope times were converted incorrectly. When reading, the attack and decay stayed in milliseconds instead of seconds (a thousand times too long) and the release skipped the time-curve mapping entirely; when writing, the release skipped that mapping as well. The modulation envelope now uses the same conversion as the amplitude envelope in the same file.
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.
While auditing the creators/detectors for envelope-time conversion bugs I found three independent issues. In each case the amplitude envelope of the same format already does it correctly, so the fix is to make the affected path match that reference. Each fix is small and independent.
1. disting EX — dropped hold time in amplitude decay
DistingExCreatorwrites the amplitude decay as:Operator precedence makes
/ 0.02bind to the decay term only, i.e.log(hold + decay/0.02)instead of the intendedlog((hold + decay)/0.02). Becausedecay/0.02dwarfshold, the hold time is effectively dropped from the written decay. The reader confirms the intent — it decodes withdecay = 0.02 * Math.exp (0.0521 * value), whose inverse islog((hold+decay)/0.02)/0.0521. Fixed by parenthesising(hold + decay)before the division.2. 1010music (blackbox and Bento) — decay/release write scale doesn't match read scale
The amplitude decay and release are written with a 25 s full-scale but read back with a 38 s full-scale:
normalizeTime…)denormalizeTime)9.09.0✅ consistent25.038.0❌ mismatch25.038.0❌ mismatchnormalizeTime/denormalizeTimeare inverse operations, so the same full-scale constant must be used on both sides or the value doesn't round-trip — a converted blackbox/Bento preset plays its decay and release noticeably shorter than the source. Attack is already consistent at 9 s. The reader's 38 s is the device-calibrated value (it was introduced when read-back of the amp envelope was implemented), so I aligned the writer (Music1010CreatorandBentoCreator) to 38 s.3. Maschine 2/3 — modulation (filter/pitch) envelope time conversions
In
MaschinePresetAccessorthe modulation envelope (used for the filter and pitch envelopes) is converted differently from the amplitude envelope in the same file:mapToAttackMillis/mapToDecayAndReleasewithout the/ 1000.0the amp envelope applies), so they come out a thousand times too long; the release skipsmapToDecayAndReleaseentirely and uses the raw normalized value.decayAndReleaseMillisToInput, writing raw milliseconds into the parameter row instead of the device's encoded value.Fixed so the modulation envelope uses the same conversion as the amplitude envelope (read:
… / 1000.0; write:decayAndReleaseMillisToInput (…)). Read and write offsets (148/156/160/164) already match, so this only corrects the value mapping.All four changed files compile. (The tree currently has an unrelated
XMLUtils.escapeAttributecompile error inOmnisphereCreatoratmainHEAD against the vendoreduitoolsjar; it is independent of these changes.) CHANGELOG updated with a per-format entry.