Audio samples per second?

后端 未结 2 1378
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-04 14:12

I am wondering on the relationship between a block of samples and its time equivalent. Given my rough idea so far:

Number of samples played per second = total filesize /

2条回答
  •  无人共我
    2021-02-04 14:24

    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 (for WAV files there will be some inaccuracy to account for the header). How these translate into samples depends on

    1. the sample rate
    2. bits used per sample, i.e. commonly used is 16 bits = 2 bytes
    3. number of channels, i.e. for stereo this is 2

    If you know 2) and 3) you can determine 1)

    In your example 89300 bytes/second, assuming stereo and 16 bits per sample would be 89300 / 4 ~= 22Khz sample rate

提交回复
热议问题