Ah got yahScuzzyEye wrote: ↑07 Jan 2022MP3s (and other lossy formats) have a bit rate, not a bit depth.
It is true that encoding PCM audio into an MP3 and then decoding for playback it can produce values that clip, but it's not because of the change in bit depth.
Going back to MP3s not having a bit depth. They use a process called a discrete cosine transform. Basically they spit an audio signal into a number of signals represented by cosine functions with different amplitudes. When those functions are added back together you get (approximately) the original signal. The more (and higher frequency) cosine waves you use, the closer you can represent the original signal. Just how many you can fit into a unit of time is the rate of the MP3. The cosine function can be computed to infinite resolution, but in practice it's usually only done to 24-bits (use to be 16 in the past). The amplitude of each cosine individually won't be more than the 24-bit integer can hold, but when you sum all the different frequencies together it's possible that in some places the final value will clip.
So if you know you're audio is going to be encoded into a lossy format (e.g. its doing to be streamed), it's probably best to leave 1 dB of headroom. So that the reconstructed signal won't add up to anything greater than 0 dBfs.
So it's not the compression that causes the problem but the decompression
You should come here more often especially during these types of conversations I've actually learned two new things today and both came from you.
Thanks