Repository navigation
Play the music through the DirectMusic synth's reverb (0.4.3) - #9
Merged
Merged
Conversation
…EO FX MM2 plays all its DirectMusic through a port on the "Microsoft Synthesizer", opened by DMusicObject::InitPort (MMDMusicManager::Init, DMusicManager::Init, DMusicObject::Init): the menu music, a race's music with its Big Air motif on the same performance, and the city ambience segment. The port asks for DMUS_EFFECT_REVERB (the object's reverb flag, set by its constructor, and the synth's caps report the effect) and for AudManagerBase::IsStereo() + 1 audio channels, at AudManager::GetSamplesPerSecond (22050 Hz). MM2 never sets the reverb's parameters, so the synth's documented DMUS_WAVES_REVERB_PARAMS defaults apply: 0 dB in-gain, -10 dB mix, 1000 ms, high-frequency ratio 0.001. OpenMM2's music had no reverb (TinySoundFont has none) and stayed stereo with STEREO FX mono, which made it sound narrower than the original (GitHub issue #8). SynthReverb approximates that reverb. Waves' algorithm is proprietary, so the structure (inferred) follows OpenMPT's BSD-licensed emulation of the Waves Reverb DMO, which takes the same four parameters: four combs of 45 ms x 2^(n/4) coupled in pairs by golden-ratio allpass lattices, a two-tap loop low-pass for the high-frequency decay, and a power-preserving dry/wet split. It runs near the port's 22050 Hz, so its loop filter cuts where MM2's did. MusicEngine runs the soundtrack with its motif and the ambience through it, and folds both to mono when STEREO FX is mono; as MM2 reads the flag when a phase opens its port, MusicPlayer takes the setting when the menus or a race start their music. Measured on 30 s renders of every song: the channel correlation goes from 0.90-0.995 to 0.74-0.90 and side/mid from -12.6..-26.0 dB to -8.3..-12.5 dB; the reverb decays in 1.00 s at 250 Hz, 0.75 s at 4 kHz and 0.46 s at 8 kHz. mm2tool music gains --dry (no reverb, bit-identical to the old renders) and --mono, and prints the stereo image. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
audio/SynthReverb follows the structure and constants of OpenMPT's Waves Reverb emulation, which is BSD-3-Clause: its copyright notice and conditions now ship with the packages as licenses/openmpt.txt, next to the fetched dependencies' licences. The reverb's files get their manifest rows (M, audio: MM2's synth reverb by an inferred algorithm). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Fixes #8. Version 0.4.3; the network protocol is unchanged.
What changes: the music, the Big Air motif and the city ambience now play through the reverb MM2's DirectMusic synthesizer added. With mono STEREO FX they play in mono.
MM2's synth settings.
DMusicObject::InitPortopens the Microsoft Synthesizer port with:DMUS_EFFECT_REVERB: the object's flag is set by its constructor, and the synth's caps report reverb;AudManagerBase::IsStereo() + 1audio channels;The reverb's parameters. MM2 never sets them, so the documented
DMUS_WAVES_REVERB_PARAMSdefaults apply (0 dB, −10 dB, 1000 ms, 0.001). The synth's algorithm (Waves "SimpleVerb") is proprietary.audio/SynthReverbapproximates it following OpenMPT's BSD-3 emulation of the Waves Reverb DMO, and is marked inferred. OpenMPT's notice ships aslicenses/openmpt.txt.Measured. On the near-mono songs, left/right correlation dropped:
RMS rises by at most 0.7 dB.
Tests.
tests/audio/test_synth_reverb.cpp(12 tests): decay time, high-frequency damping, decorrelation, dry path, silence, no NaN. Full suite with game data: 1064/1064. Sweep unchanged (515/507).🤖 Generated with Claude Code