Given an audio file of duration say 10s, how do I find out the no of samples betweeen 2s and 8s?
if it's LPCM (e.g. not compressed), then use the sample rate.
in pseudocode:
double sampleRate = audioFile.getSampleRate();
// you may also need to account for channel count here
size_t sampleCount = sampleRate * (8-2);
-- where (8-2)
represents "betweeen 2s and 8s"