the wav file has header (44 bytes). in header specified sample rate of signal, number of channels , on, number of samples audio file. need know can find number of samples information in header.
what formula.
starting @ 40th byte next 4 bytes (little endian) subchunk2 size. can deduced formula:
subchunk2size = numsamples * numchannels * bitspersample/8
numchannels
start @ byte 22 , 2 bytes (little endian) in length. bitspersample
start @ 34th byte , 2 bytes (little endian) in length. replacing these can numsamples number of samples.
for example: if subchunksize2=2048, numchannels=2 , bitspersample=16
, 2048 = numsamples * 2 * 2
numsamples=512
a read here.
Comments
Post a Comment