sherpa-onnx
sherpa-onnx copied to clipboard
Add situation when SubChunk1Size == 18
trafficstars
NAudio音频库录制的16k音频的 SubChunk1Size = 18 ,导致Line49报错
Console.WriteLine($"Invalid SubChunk1Size: {SubChunk1Size}. Expect 16");
此行改为
if (SubChunk1Size != 16 && SubChunk1Size != 18)
然后将 SkipMetaData方法改为如下,即可取出音频数据:
private void SkipMetaData(BinaryReader reader)
{
var bs = reader.BaseStream;
Int32 subChunk2ID = _header.SubChunk2ID;
Int32 subChunk1Size = _header.SubChunk1Size;
Int32 subChunk2Size = _header.SubChunk2Size;
if (subChunk1Size == 16)
{
while (bs.Position != bs.Length && subChunk2ID != 0x61746164)
{
bs.Seek(subChunk2Size, SeekOrigin.Current);
subChunk2ID = reader.ReadInt32();
subChunk2Size = reader.ReadInt32();
}
_header.SubChunk2ID = subChunk2ID;
_header.SubChunk2Size = subChunk2Size;
}
else
{
subChunk2Size = (int)(bs.Length - bs.Position);
}
_header.SubChunk2ID = subChunk2ID;
_header.SubChunk2Size = subChunk2Size;
}
Looks like you have uploaded encrypted files. Could you fix that?
@eugeneYz
Looks like you have uploaded encrypted files. Could you fix that? Sorry about that,It seems that these codes can be only added manually.