dosbox-staging
dosbox-staging copied to clipboard
Add reverb support
Related to https://github.com/dosbox-staging/dosbox-staging/issues/1662
Add reverb support.
There are two ways to set the reverb:
1. Easy mode
This is what most users should use. The reverb is simply enabled in the mixer section by specifying one of four presets (tiny, small, medium, and large):
[mixer]
reverb = large
The reverb is off by default. The on setting is also recognised, which maps to the medium preset.
By selecting a reverb preset, the reverb aux send levels will be automatically set up as defined in the preset.
2. Advanced mode
Advanced users can fine-tune the reverb send levels per channel. A reverb preset still needs to be selected in the mixer section first, then the aux send levels set by the preset can be overridden via mixer commands. Reverb send level commands are prefixed with r:
mixer fm r42
mixer sb 80:50 r20
The reverb levels are displayed in the mixer:
Channel Volume Volume(db) Rate(Hz) Mode Xfeed Reverb Chorus
MASTER 100:100 +0.00:+0.00 48000 Stereo - - -
CDAUDIO 100:100 +0.00:+0.00 10000 Stereo 50 0 0
DISNEY 100:100 +0.00:+0.00 10000 Stereo 50 42 75
FM 100:100 +0.00:+0.00 48000 Stereo 50 42 75
INNOVATION 100:100 +0.00:+0.00 48000 Stereo 0 42 75
MT32 100:100 +0.00:+0.00 48000 Stereo 50 - -
SB 100:100 +0.00:+0.00 22050 Stereo 50 8 0
SPKR 100:100 +0.00:+0.00 18939 Stereo 0 42 75
The amount of reverb can be set as a percentage from 0 to 100 per channel in the mixer.
Internally, this controls the reverb aux send level for the channel between -40 and -6dB using square taper (so technically a setting of 1 results in ~39.66dB, and 0 means -inf, so no send).
Reverb cannot be applied to MT-32 and Fluidsynth as they implement their own reverbs.
Future work
In the future we might support specifying custom reverb preset, similarly to Fluidsynth.
mverb was released under GPL3. Is that a problem @kcgen?
https://github.com/martineastwood/mverb/
Okay I've checked again what open-source reverbs are available, and most good ones are under GPL 3.0... But it turns out Freeverb3 has an implementation of the same algorithm that mverb uses ("Freeverb3 ProG"), and it's under GPL 2. I can replicate the same sound with it that I really like in mverb, and it's actually a bit better quality.
The downside is it's not just a single header file but ~500k of source files (although I could weed out the other 4-5 algorithms that we don't need), plus it has a lot more params to tweak, so user presets are out of the question. It's also more optimised, at least for x86.
Sorry for not replying in time! The inherited GPL v2+ license (at the time of fork) gives us the option to ratchet up to a newer GPL version, so we can relicense it GPL v3+ to be compatible with mverb's v3+ license.
Cheers, I'll decide which one to use then. I'm still leaning towards mverb due to its simplicity (both code & interface).
(default initializer warning clean-up: https://github.com/dosbox-staging/mverb/blob/kc/zero-init-members-1/MVerb.h), and PR'd upstream: https://github.com/martineastwood/mverb/pull/7
(default initializer warning clean-up: https://github.com/dosbox-staging/mverb/blob/kc/zero-init-members-1/MVerb.h), and PR'd upstream: martineastwood/mverb#7
Thanks for that. You might have seen that the reverb implementation is close to completition:
https://github.com/dosbox-staging/dosbox-staging/tree/jnovak/reverb
It's a few days away from review-time, though.