are you talking about hardware or software DSP?
You could do it either way. Hardware solution like a MiniDSP, although it appears they have unfortunately discontinued their more affordable products. Or a software solution like EqualizerAPO (Windows) or SoundSource (Mac). If I had a pair of decent speakers and a microphone hooked up to my PC
The gist of it is:1. Youu need a calibrated microphone like the uMik from MiniDSP or one from Dayton Audio. That's about $100, though, so that sort of kills the value equation in a lot of situations.[1]
2. You then measure the speaker's output with something such as a free tool called Room EQ Wizard: https://www.roomeqwizard.com/
3. REQ can then output the necessary DSP configuration files, that can be then be used by a MiniDSP, EqualizerAPO, etc. Or it can just tell you the necessary corrections that can then be manually typed into anything that supports parametric EQ settings.
Here's a video demonstrating all of that: https://www.youtube.com/watch?v=T1aYsjPc2m4&t=2s
---------
[1] However, there are community efforts to take these kinds of measurements and open source them so everybody can benefit. The largest I'm aware of is these open-sourced headphone measurements (which require a different sort of measurement rig) and corrections: https://github.com/jaakkopasanen/AutoEq/tree/master/results/...
For speakers, there are the measurements and EQ corrections published by places like AudioScienceReview.com and NoAudiophile.com
> You need a calibrated microphone
Ah, of course, it's a chicken and egg problem... :)
edit: typos
His corrections for cheap Micca speakers were my gateway into hi-fi. For under $100 I had true hi-fi sound at my desk. However, he's not active any more, and most of the speakers he's measured are no longer available.
Blatant plug: https://github.com/erdewit/HiFiScan