missionpinball / mpf-mc

The Mission Pinball Framework Media Controller. Controls graphics, sounds, DMDs, and LCD displays in MPF.
http://missionpinball.org
MIT License
21 stars 42 forks source link

Auto Ducking #447

Open qcapen opened 1 year ago

qcapen commented 1 year ago

Discussed in https://github.com/orgs/missionpinball/discussions/106

Originally posted by **Laurent0722** August 12, 2023 Hi, I'm a long time reader but first post here :) I'm currently fine tuning my homebrew machine and i'm strugling with audio ducking... Is threre a way to set a TRACK so it automatically duck another one ? ie: voices and/or sfx track automatically duck music track... I've read that we must specifie ducking parametters for each individual sound but what a job to do... ! An auto ducking feature would be so much more efficient ! don't you think ? is there a method to achieve this kind of feature ? Thank you for your answer. Laurent (From France)
qcapen commented 1 year ago

In audio processing terms, auto-ducking is basically sidechain compression where the signal of one audio track is used to attenuate the signal of another track (Dynamic Range Compression, ). Unlike automatic ducking in audio/video editors which can analyze prerecorded audio signals and apply the effect appropriately, the MPF-MC audio engine uses real-time processing to generate its audio signals. Since sounds are generated by an event-driven system, real-time signal processing must be used to analyze and generate an automatic ducking effect. This kind of signal processing is not trivial to implement, meaning this is not a simple feature to add to the MPF-MC and would certainly add some processing overhead.

qcapen commented 1 year ago

I simpler implementation could just use a common ducking envelope (set of ducking settings) and apply them to every sound played on a track when auto ducking is enabled (or perhaps set an auto ducking flag on each sound that should be ducked). This would just require setting the ducking settings on each sound instance by copying the settings from the master ducking envelope. No other changes would be necessary. This is much easier than doing realtime audio analysis and processing and would lead to similar results.