Skip to content

Play the music through the DirectMusic synth's reverb (0.4.3) - #9

Merged
lowlevelmetal merged 3 commits into
mainfrom
integration
Oct 14, 2026
Merged

lowlevelmetal merged 3 commits into
mainfrom
integration

Conversation

@lowlevelmetal

Copy link
Copy Markdown
Owner

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::InitPort opens 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() + 1 audio channels;
  • 22050 Hz.

The reverb's parameters. MM2 never sets them, so the documented DMUS_WAVES_REVERB_PARAMS defaults apply (0 dB, −10 dB, 1000 ms, 0.001). The synth's algorithm (Waves "SimpleVerb") is proprietary. audio/SynthReverb approximates it following OpenMPT's BSD-3 emulation of the Waves Reverb DMO, and is marked inferred. OpenMPT's notice ships as licenses/openmpt.txt.

Measured. On the near-mono songs, left/right correlation dropped:

  • cruise 0: 0.988 → 0.868
  • race 4: 0.995 → 0.852
  • menu: 0.980 → 0.816

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

lowlevelmetal and others added 3 commits October 13, 2026 23:54
…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>
@lowlevelmetal
lowlevelmetal merged commit f4e3430 into main Oct 14, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Music playback sounds incorrect when enabled in the settings

1 participant