Given the WAV file, its file size and sampling rate, is it possible to count the number of samples?

Our application should know the number of samples of downloaded audio files. The library we use can reliably determine the sampling rate, but not the sample counter. Is it possible to calculate the number of samples only from file size and sample rate?

+5
source share
3 answers

What a sign said. No, usually you need to interpret the header. But if the format, the number of channels and the number of bits per sample are known and the same for all files, it is theoretically possible to calculate them from the file size.

WAV - , , . , , . , WaveLab , () .

.wav- . StripWav - ; , : sox. Sox , , - WAV , "".

: sox, . Sox ​​ , :)

+5

, WAV PCM, , . - , . WAVEFORMAT. .

+4

PCM wav , blockalign, .

, WIF RIFF PCM ( ). Blockalign 2- 32 (33-34- wav ). , datasize, 4- 40 ( 41- 44- wav ).

datasize/blockalign - , .

PS

wav, RIFF, "" ( , ), , , , . fmt data.

4- ASCII- , FOURCC, 'fmt' , chunk , "" - . , FOURCC 4- , ( ) (FOURCC 4 ).

:

wav

WIF WAV

+1

All Articles