]> git.basschouten.com Git - openhab-addons.git/commitdiff
[marytts] Fix incorrect wav header (#12571)
authordalgwen <dalgwen@users.noreply.github.com>
Mon, 4 Apr 2022 06:50:30 +0000 (08:50 +0200)
committerGitHub <noreply@github.com>
Mon, 4 Apr 2022 06:50:30 +0000 (08:50 +0200)
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 <gwendal.roulleau@gmail.com>
bundles/org.openhab.voice.marytts/src/main/java/org/openhab/voice/marytts/internal/MaryTTSAudioStream.java

index c9815c060e15dfc6bda8fb8284ba150e84333fa8..f0b98fc48315bad1d08b9a49753764d3439f2b58 100644 (file)
@@ -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 {