diff --git a/.vscode/settings.json b/.vscode/settings.json index e4398576..5e61b650 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,4 @@ { + "cmake.configureOnOpen": false, "dotnet.defaultSolution": "Whisper.net.sln" } \ No newline at end of file diff --git a/Whisper.net/Wave/WaveParser.cs b/Whisper.net/Wave/WaveParser.cs index 97c163e6..89c8df8e 100644 --- a/Whisper.net/Wave/WaveParser.cs +++ b/Whisper.net/Wave/WaveParser.cs @@ -354,6 +354,13 @@ private async Task InitializeCore(bool useAsync) } dataChunkSize = BitConverter.ToUInt32(buffer, 4); + // if the data chunk is not specified, it means the wave was constructed on the fly + // and we need to read until the end of the stream + if (dataChunkSize == uint.MaxValue) + { + dataChunkSize = (uint)(waveStream.Length - waveStream.Position); + } + dataChunkPosition = waveStream.Position; isInitialized = true; }