I have an AudioFormat object (returned from audioInputStream.getFormat()
). I have a timestamp (in milliseconds) that I want to start reading from the corresponding wav file from. How do I determine how many bytes to read/skip from the AudioInputStream in order to get to the appropriate timeStamp?
I get confused with frame rate (and how it does or doesn't relate to sample rate).
This is what I have so far... startPos is the timestamp in milliseconds.
float skipTotalFrames = audioInputStream.getFormat().getFrameRate() * (startPos / 1000);
long byteStartPos = (long) (audioInputStream.getFormat().getFrameSize() * skipTotalFrames);
Where am I off at?
Edit: My code did in fact work, I just had other errors.