1

I'm reading in 16 bit WAV files in Java (apparently always little-endian). I need to check the amplitude at the beginning and end of a WAV file. I'm hoping for silence at the start and end of clips but need to report on a scale if not. The files are always accessible locally. I've read about converting the file to a byte array and that converting each byte to a signed integer representation of the hex gives the amplitude but (if this is the case) I'm confused about how to apply this to audio that would need to be split across 2 bytes per sample. I've also read about bit-shifting but I'm unsure if it's relevant if I use a byte array.

To clarify, I'd rather not use unnecessary imports if possible but could and I don't have to use bytes to divide up the WAV, I only need a reliable way to present the amplitude at particular points in the array (start and end).

gianthair
  • 13
  • 4
  • Step 1: Google "wav file format" – user253751 Feb 04 '15 at 22:00
  • Not sure it's exactly a duplicate but you should read my Q&A http://stackoverflow.com/questions/26824663/how-do-i-use-audio-sample-data-from-java-sound which presents an overview of what is involved here. (Though since you are asking about a specific format, it is a subset of what I covered there.) – Radiodef Feb 04 '15 at 22:03
  • @immibis Helpful... As you can see from the fact that I stated "I've read...", I already have. – gianthair Feb 04 '15 at 22:04
  • Having a look @Radiodef, thanks. – gianthair Feb 04 '15 at 22:09

0 Answers0