Class AudioWaveUtils

  • @NonNullByDefault
    public class AudioWaveUtils
    extends Object
    Some utility methods for parsing and cleaning wav files
    Gwendal Roulleau - Initial contribution
    • Constructor Detail

      • AudioWaveUtils

        public AudioWaveUtils()
    • Method Detail

      • parseWavFormat

        public static AudioFormat parseWavFormat​(InputStream inputStream)
                                          throws IOException
        InputStream - an inputStream of a wav file to analyze. The InputStream must have a fmt header and support the mark/reset method
        The audio format, or the default audio format if an error occured
        IOException - If i/o exception occurs, or if the InputStream doesn't support the mark/reset
      • removeFMT

        public static void removeFMT​(InputStream data)
                              throws IOException
        Remove FMT block (WAV header) from a stream by consuming it until the magic packet signaling data. Limit to 200 readInt() (arbitrary value used in sun audio package). If you don't remove/consume the FMT and pass the data to a player as if it is a pure PCM stream, it could try to play it and will do a "click" noise at the beginning.
        audio - A wav container in an InputStream