For those wondering why the hell we need all this safety system stuff for the speakers: because the speakers sound nice and loud and crisp, but only if you drive them well past the max "always safe" volume level. With current kernel settings, that level is at -14dBFS on the 14" M1 Pro MBP. That means that while your system will work without speakersafetyd (once this is all tested and enabled), the speakers will be much quieter.
This is especially true for the tweeters. You can hear that in the stream where I played I Won The Loudness War: during the dubstep parts of the song, the snares sound nice and crisp. At those points, the tweeters are probably putting out 2-4x the amount of power they could handle without melting - briefly. But then when the nasty clipped lead comes in, that overloads them a lot more and the safety daemon clamps down on the tweeter volume. After that part, you can hear them recover over a few seconds and the snares gradually come back.
Most music does not have ridiculous clipped leads like that song, but it very often does have loud snares and cymbals, and other high-frequency transients. Additionally, the tweeters are high-passed in hardware at 800 Hz, and most music does not have that much energy in the high end to begin with relative to the bass, but could. So if you want to set the overall max volume to a safe level, you have to assume the input is a 4000 Hz square wave or something ridiculous like that. And that's how you get that -14dBFS "dumb" level limit, which makes the speakers sound a lot quieter and worse, even though the vast majority of music played at 100% would never come close to needing that much reduction to be safe.
With a dynamic temperature/power limit model for the speakers, you can squeeze out a lot more of that headroom and still remain safe. And that gives you nice and punchy music without requiring harsh limiters or low volume caps to keep the speakers from melting.
And this is one reason why Mac speakers sound better and louder than most. Because most manufacturers don't bother to do this.
This post brought to you by
gdb
andgrep -a
, because after typing all that out as a quote toot and deciding that nah, I wanted it standalone, I clicked the "x" next to the quote box (which implies removing the quote association) and that didn't just cancel the quote, it deleted all the text.So I attached gdb to the Firefox content process hosting this tab, took a core dump, and grepped it for the lost text. I wasn't about to write all that again from scratch.
cc @ariadne.