How to find the corresponding level of those audio samples


I am trying to self-study this problem for a future exam. The writings in red are solutions to the question. I have a problem in number part e of the question where they find the corresponding level of the samples from the audio signal's equation.

We have 256 discrete levels, and five samples.

I did not understand in part e why does the value of the sample 3V corresponds to the 255th level. and why -1.248 corresponds to the 74th level, and so on…

Any help?

enter image description here

Best Answer

I see, the 2nd sample of the cosine wave is -1.248 volts and this would be between the 74th and 75th quantize levels (effectively 74.752). With ADCs you usually round-down to the nearest integer. This makes it the 74th level.

This is based on dividing the full 6 volt range by 256 to get a quantize step size of 23.4375 mV. Take -1.248, add 3 volts to it to get the range of voltage above -3 volts (binary 00000000). The 2nd sample is therefore 1.752 volts above -3 volts. Then divide 1.752 volts by 23.4375 mV to get 74.752 (quantize step number as a non-integer) - then round down to get the 74th sample.