trummerschlunk / master_me

automatic mastering plugin for live streaming, podcasts and internet radio.
GNU General Public License v3.0
520 stars 22 forks source link

optimisations for master_me 2.0 #93

Open trummerschlunk opened 1 year ago

trummerschlunk commented 1 year ago

Hi everyone,

hope you are doing fine. I recovered a bit from the last months of master_me ;) Meanwhile, I used it on several projects and I am very happy with the sound, the dsp design, the gui... Great work y'all!

The resonance on mastodon was quite impressive. People seem to want this :) And we did not even post on birdsite & co yet... https://chaos.social/web/@trummerschlunk/108927371163970570

On my M1 macbook pro, several instances run smoothly, but I guess, master_me needs a round of optimization regarding cpu usage - so I want to start this thread.

  1. On the FAUST side Any ideas on how to make things more efficient here?

  2. On the C++ side Can some parts, or even modules (like lufs metering) be coded more efficiently, using pure C++ code (from other open-source projects)? How much potential lies in this approach at all?

  3. On the GUI side How about communication between FAUST generated code and GUI? Some issues are already discussed here: https://github.com/trummerschlunk/master_me/issues/66

Thank you for your contributions and ongoing support <3

Klaus

sletz commented 1 year ago

I guess most of the CPU goes inside the DSP loop itself, because it contains a lot of code... I cannot comment too much on the Faust DSP code itself (not enough understanding of the implementation) but by following the Optimizing the code and Debugging the Code pages here:

falkTX commented 1 year ago
  • Using some fast-math versions of them could help maybe, using the -fm <file> --fast-math <file> use optimized versions of mathematical functions implemented in <file>, use 'faust/dsp/fastmath.cpp' when file is 'def'. compilation option to replace the standard math ?

I tried this already, and results are unusable. Hard to tell exactly what breaks, we would need to split out the different blocks of processing and test 1 by 1. Can faust partially use the fastmath file for some code blocks while having the regular stuff on the rest?

sletz commented 1 year ago
  • Using some fast-math versions of them could help maybe, using the -fm <file> --fast-math <file> use optimized versions of mathematical functions implemented in <file>, use 'faust/dsp/fastmath.cpp' when file is 'def'. compilation option to replace the standard math ?

I tried this already, and results are unusable. Hard to tell exactly what breaks, we would need to split out the different blocks of processing and test 1 by 1. Can faust partially use the fastmath file for some code blocks while having the regular stuff on the rest?

Not really, -fm is global for the entire DSP.

falkTX commented 1 year ago

Did some quick tests here, disabling individual modules and seeing what would happen to the CPU load. Can say with 100% confidence that mscomp_bp is the heavy block on the whole chain. I have a little embed PC that is able to run master_me with everything enabled except mscomp_bp. Once I enable that the CPU goes way too high. More specifically, it is the B_band_Compressor_N_chan function that takes the most CPU.

If we can optimize that, the CPU usage of the plugin will become much more reasonable.

trummerschlunk commented 1 year ago

Thank you, @falkTX for testing! @magnetophon and @x42... Any ideas? I'll check the code too and see if I can find cheaper solutions. Happy 23 y'all!