audiosizewavpcm

Why do you divide bit depth by 8 when computing PCM file size?


So basically, I thought the formula for computing pcm file size went as follows:

fileSize(in bits) = samples_per_sec x seconds x number_of_channels

And it worked just fine for me since I was exclusively dealing with pcm files which had 8 bit depth. When I started to deal with 16 bit depth files, the formula didn't produce accurate results. Through some googling I found out that my aformentioned formula was wrong, actually you have to adhere to this one:

fileSize(in bits) = samples_per_sec x seconds x number_of_channel x bit_depth/8

It explains why I was getting correct results with the incorrect formula since, you know, 8 / 8 = 1.

The thing that I don't get is this: why do you have to divide bit depth by eight?
In order to get bits as a result of your calculations, you have to get them on the right side of your formula as well:

bits = samples/seconds x seconds x  num_of_channels(dimensionless) x bits/sample = bits

which is fine. So, it should work without division by eight. But it doesn't. Where am I wrong?


Solution

  • In your notation style:

    The main confusion is likely from bits and bytes. Audio sample size is typically described in bit depth not byte depth. File size / memory is described typically in bytes. To go from bits to bytes you simply divide by 8.