Is volume applied before or after resampling?

I’d like to add a -4 db volume limit (“headroom”) before resampling, as it’s basically recommended for all resampling operations, to avoid clipping. Since Volumio cannot support this now, I was thinking of using a 90% volume max limit.

My question is that is this applied before or after resampling? Basically this only helps avoid clipping if it is applied before resampling. Can someone confirm this?

Also, any plans to add a “headroom” option in the settings?

Is this user manual information answering your question?

Resampling in volumio is applied on mpd via sox. So yes, it is done before volume setting (soft or hw).
Other sources (Spotify, Spotify connect) are not affected by resampling though

So basically it’s totally useless for adding headroom for resampling, right?
How do people avoid clipping then?

I do not understand why resampling.would add clipping. What is your sources?
In my plugin DSP you can add an attenuation and resample though
It works for all sources

@balbuze good reference here:

And

And here Archimago recommends using SoX with a -4 dB attenuation, (built into SoX):

In my plugin DSP you can add an attenuation and resample though It works for all sources

Can you point me to your plugin?