Public Access
26 lines
943 B
C#
26 lines
943 B
C#
namespace MeetingAssistant.Tests;
|
|
|
|
public sealed class SampleWavFixtureTests
|
|
{
|
|
[Fact]
|
|
public async Task SampleWavFixtureIsSmallMonoPcmAudio()
|
|
{
|
|
var path = Path.Combine(AppContext.BaseDirectory, "Fixtures", "sample-16khz-mono.wav");
|
|
var bytes = await File.ReadAllBytesAsync(path);
|
|
|
|
Assert.True(bytes.Length < 16_000);
|
|
Assert.Equal("RIFF", ReadAscii(bytes, 0, 4));
|
|
Assert.Equal("WAVE", ReadAscii(bytes, 8, 4));
|
|
Assert.Equal("fmt ", ReadAscii(bytes, 12, 4));
|
|
Assert.Equal((short)1, BitConverter.ToInt16(bytes, 20));
|
|
Assert.Equal((short)1, BitConverter.ToInt16(bytes, 22));
|
|
Assert.Equal(16000, BitConverter.ToInt32(bytes, 24));
|
|
Assert.Equal((short)16, BitConverter.ToInt16(bytes, 34));
|
|
}
|
|
|
|
private static string ReadAscii(byte[] bytes, int start, int length)
|
|
{
|
|
return System.Text.Encoding.ASCII.GetString(bytes, start, length);
|
|
}
|
|
}
|