Although the images are very very good at explaining what quantization error is, they are a tiny bit inaccurate if I am not mistaken (not that you claimed they were 100% accurate).
FWIW all that is plotted there is taken from actual wav files, although admittedly with some shenanigans

SoX doesn't want to create linear PCM with less than 8 bits, so the signal I generated was at about -30 dBFS, so that top bits are 0. Then I took the lower, non-zero bits and scaled them to [-1, 1] range for the graph.
Technically it is inaccurate, because it has 4 levels above 0 and this is neither 3 bits (3 levels) nor 4 bits (7 levels). Also my intention for X-axis was to count the samples 1 through 40, but it turned out it counts the samples from the continous waveform, which is the input upsampled 8x.
Here's more like I wanted them, 3-bits and 4-bits examples:
(still inaccurate, because I promptly ignored one additional level on the negative side

)
But I don't think those have any impact on the main point.
And regarding the main point, because I don't think I spelled it out clear enough. When:
- you treat quantization as mixing the original signal with some additional signal
- and you use dither, which makes this additional signal a white noise
then it's easy to see that
the only effect quantization/reducing bitdepth has on a signal is increasing noise floor. That's the point that some people try to put across, sometimes with some
exasperation, whenever other people start discussing bitdepth.
For example the sinusoidal that confirms to the samples around sample 40 would go over 1, and if the device can not go above 1, it would clip, if it can, the noise will be higher I think, no?. And around sample 120, the curve that passes through all the samples would have a high frequency component to it, and the quantization noise would be higher again, I think. Am I incorrect?
If you mean intersample overs, then yes, I guess it's a possibility when your input hits at or near 0 dBFS. When I generate 32-bits sine, reduce it to 16-bits and then upsample both 8x:
Code:
sox -r44100 -n -b32 sin1.wav synth 10 sin 1k vol .98856218
sox -D sin1.wav -b16 tmp.wav
sox tmp.wav -b32 sin2.wav
sox sin1.wav -b32 sin1.up.wav rate 352800
sox sin2.wav -b32 sin2.up.wav rate 352800
then the max samples are:
Code:
sin1.wav - 0x7e890000 2'122'907'648
sin2.wav - 0x7e890000 2'122'907'648
sin1.up.wav - 0x7e89349b 2'122'921'115
sin2.up.wav - 0x7e895c91 2'122'931'345
The one that was reduced has a slightly higher level. That's one more reason to leave some headroom.