I came across Sonarworks few days ago.
To my understanding (I just quickly glimpsed over their website) they have a database of headphone frequency responses. So, in few words, a headphone is like a filter: it has a frequency response. You can "undo" it by measuring it and creating a filter which is the exact specular of it: it will attenuate what the headphone boosts and boost what the headphone attenuates.
So, the chain would be: audio software -> matched inverse filter -> headphone. The combo matched inverse filter -> headphone yields, in theory, to perfectly flat frequency response.
Now, there are few caveats that make me skeptical about Sonarworks (and anything similar).
The main reason is the following: most likely they measured the responses using the
B&K HATS. That is brilliant, as it has microphones inside that simulate the acoustic impedance of real ears. Now, you have your own ears instead. What is gonna change?
In the page
you linked we can see a plot. That's a fairly typical headphone frequency response. All the stuff below 1 kHz is fairly stable and consistent between different measurement techniques. It is mostly dictated by speakers, front earcup volume, rear earcup volume, acoustic ports and cushions (yes, they define the acoustics too, and are very important). However, that is consistent as long as the fitting of the headphone doesn't vary too much. A earcup not properly sealed against the ear or head or a different clamping force can very significantly alter the low frequency (< 100 Hz). What you see after the first few kilohertz instead is dictated by your ear. The shape of your pinna and ear canal dictate what you see (and hear) there. That part of the response varies between every human being.
Another thing is that headphones have sometimes a lot of production variability.
So, I am not really sure about how well that works in reality really. Moreover, to make a good simulation, one would need to create a crossover based on head related transfer functions. I think there is already an open source library for that.
So, can we have that for Linux?
In a way, yes. The core idea is simple. However, to do it correctly there are two approaches (that I am aware of):
1) Have a database of many many responses of different headphones measured in the same conditions. Then average over to get the best estimate of the response of each model (compensating for sensitivity differences first). Then, just fit a trend after 4 kHz so that it will sort of work for everybody. I believe this is what Sonarworks is doing. But we can't: we don't have resources to build such a database (and you can see that even Sonarworks supports only a (not seemingly big) number of headphones).
2) Create an adaptive algorithm which aims to flatten out the final response. We must do it without a probe mic entering the ear of the user to get a reference signal... which is gonna make it super hard.
So, in few words: the idea is simple but headphone responses vary so much that I don't genuinely believe these calibrator really do work as advertised, even though perhaps they can improve things up to the first few kilohertz. To replicate something like that the best approach in open source world would be some kind of adaptive algorithm.
So, yeah... my two cents.
EDIT:
There is also a third way: the artisanal way. Measure the response of your personal headphone against a very crude ear simulator mic: a flat rigid surface with a hole in the middle where you insert the tip of maybe
this mic, making sure that the hole is very well sealed. Blu tack is good for that. Then, to make the inverse filter you need just some maths... maybe not very easy math if you want low latency. If not, I think there are FIR filter programs that can do the filtering already. You will still have poor high frequency match, but you can increase it by replicating the ear canal length in the plate instead of just using a hole.