Package org.openhab.core.audio.utils
Class AudioWaveUtils
java.lang.Object
org.openhab.core.audio.utils.AudioWaveUtils
Some utility methods for parsing and cleaning wav files
- Author:
- Gwendal Roulleau - Initial contribution
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic AudioFormat
parseWavFormat
(InputStream inputStream) static void
removeFMT
(InputStream data) Remove FMT block (WAV header) from a stream by consuming it until the magic packet signaling data.
-
Constructor Details
-
AudioWaveUtils
public AudioWaveUtils()
-
-
Method Details
-
parseWavFormat
- 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
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
-