From: dalgwen Date: Mon, 4 Apr 2022 06:50:30 +0000 (+0200) Subject: [marytts] Fix incorrect wav header (#12571) X-Git-Url: https://git.basschouten.com/?a=commitdiff_plain;h=f1a1bd5f1d8de3d0e1e9a4831a0d69e68077ace2;p=openhab-addons.git [marytts] Fix incorrect wav header (#12571) With this simple fix, MaryTTS creates the correct wav header for the audio inputstream (audioformat is now assigned before we use it) Signed-off-by: Gwendal Roulleau --- diff --git a/bundles/org.openhab.voice.marytts/src/main/java/org/openhab/voice/marytts/internal/MaryTTSAudioStream.java b/bundles/org.openhab.voice.marytts/src/main/java/org/openhab/voice/marytts/internal/MaryTTSAudioStream.java index c9815c060e..f0b98fc483 100644 --- a/bundles/org.openhab.voice.marytts/src/main/java/org/openhab/voice/marytts/internal/MaryTTSAudioStream.java +++ b/bundles/org.openhab.voice.marytts/src/main/java/org/openhab/voice/marytts/internal/MaryTTSAudioStream.java @@ -57,8 +57,8 @@ class MaryTTSAudioStream extends FixedLengthAudioStream { // The length of an AudioInputStream is expressed in sample frames, not bytes so readAllBytes() cannot be used. rawAudio = inputStreamToBytes(inputStream); this.length = rawAudio.length + 36; - this.inputStream = new SequenceInputStream(getWavHeaderInputStream(length), new ByteArrayInputStream(rawAudio)); this.audioFormat = audioFormat; + this.inputStream = new SequenceInputStream(getWavHeaderInputStream(length), new ByteArrayInputStream(rawAudio)); } private byte[] inputStreamToBytes(InputStream inputStream) throws IOException {