How can I limit the maximum audio volume?

The headphones that I use are stupidly loud. They’ll blow out my ears if I accidentally play a loud sound while having the volume set too high and they’re loud enough to be used as speakers, so I almost never have the volume set to more than half. Is there a way to set a hard limit on the maximum volume that can be output to make sure that I don’t accidentally hurt my ears? It would be best if the method doesn’t prevent amplifying quiet sounds.

I’m using the default setup with PipeWire and GNOME.

If you both want to limit the audio level and have the possibility to amplify sounds, I think you need a limiter. You can try it if you install and start “pulseeffects”. I must admit I had some problems with it in the new pipewire configurations, but that could be a local issue. The limiter looks ahead in the sound stream, and turns down the volume to a preset max level if strong levels are coming. Of course, if you want to enjoy music, you have to decrease the input volume until the limiter’s attenuation is zero otherwise dynamics gets lost. The limiter is also available as ladspa plugin, but I’ve not enough knowledge how to fit this in the pipewire-alsa chain.

A solution both protecting your ears and robust agains software misconfigurations or flaws in a developing Fedora-Pipewire environment is hardware: a jack-to-jack cable with volume control included. Of coursing assuming your headphone is wired.