Sound samples per second?

I wonder about the relationship between a block of samples and its time equivalent. Given my rough idea:

Number of playable samples per second = total file size / duration.

So, I have a file with a size of 1.02 MB and a duration of 12 seconds (avg), I will have about 89,300 samples played per second. It is right?

Are there other ways to calculate this? For example, how can I find out how many bytes of a [1024] array are equivalent in time?

+7
source share
2 answers

Generally speaking, for PCM samples, you can divide the total length (in bytes) by the duration (in seconds) to get the number of bytes per second (there will be some inaccuracy for WAV files, consider the header). How they are converted to samples depends on

  • sampling frequency
  • bits used per pattern, i.e. 16 bits = 2 bytes are commonly used
  • the number of channels, that is, for stereo it is 2

If you know 2) and 3), you can define 1)

In your example, 89300 bytes per second, assuming that stereo and 16 bits per sample will have a sampling rate of 89300/4 ~ = 22 kHz

+17
source

In addition to @BrokenGlass, a very good answer, Iโ€™ll just add that for uncompressed audio with a fixed sampling rate, number of channels and sample bits, arithmetic is pretty simple. For example. for sound โ€œCD qualityโ€ we have a sampling frequency of 44.1 kHz, 16 bits per sample, 2 channels (stereo), so the data transfer speed:

44100 * 16 * 2 = 1,411,200 bits / sec = 176,400 bytes / sec = 10 MB / minute (approx) 
+14
source

All Articles