Class AudioWaveUtils

java.lang.Object
org.openhab.core.audio.utils.AudioWaveUtils

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

    • AudioWaveUtils

      public AudioWaveUtils()
  • Method Details

    • parseWavFormat

      public static AudioFormat parseWavFormat(InputStream inputStream) throws IOException
      Parameters:
      inputStream - an InputStream of a wav file to analyze. The InputStream must have a fmt header and support the mark/reset method
      Returns:
      The audio format, or the default audio format if an error occured
      Throws:
      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.
      Parameters:
      data - A wav container in an InputStream
      Throws:
      IOException