0

How to extract data corresponding to definite time intervals from a .wav file?

I have been given a few .wav files and asked to separate the header and data. From the obtained data, samples corresponding to every 160-microseconds should be separated and copied to buffers.

I have now separated the header and got the following information:

Channels: 2, 
Frames: 632956
Sample Rate: 44100, 
Block Align: 4
Valid Bits: 16, 
Bytes per sample: 2

For separating samples corresponding to every 160-microseconds, I am not able to calculate. I tried the following way:

Total bits per 160-microsecond = ((sampling_rate * bit depth) / (time))
 = ((44100 * 16) / (160 * 1000000)) = 0.00441 bits.

I am sure that there is a mistake in the above calculation since there exist 44100 samples per second and hence for 160-microseconds there should exist bits count which is a positive natural number and cannot be a decimal value.

Can someone help with this calculation? Thanks.

  • Possible duplicate of [Reading wav file in Java](https://stackoverflow.com/questions/5210147/reading-wav-file-in-java) – Nikolai Shevchenko May 13 '19 at 19:43
  • @NikolayShevchenko No my question is different. I am attempting to read chunks of data equivalent to a particular time interval. And stuck in calculating the same. Let's say, I read the wav file as mentioned in the other thread and obtain all the data in a byte buffer, how am I pull the data equivalent to 160-microseconds. This is my primary question. – user3022690 May 14 '19 at 02:53

0 Answers0