diff --git a/.gitignore b/.gitignore index 939f6a5..47a4816 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.idea *.flac *.wav _resources_ diff --git a/enc_test.go b/enc_test.go index de1acb6..4051036 100644 --- a/enc_test.go +++ b/enc_test.go @@ -34,6 +34,7 @@ func TestEncode(t *testing.T) { "testdata/256529.flac", "testdata/257344.flac", // prediction method 3 (FIR) "testdata/8297-275156-0011.flac", // prediction method 3 (FIR) + "testdata/24000-tts-sf.flac", // 24khz test "testdata/love.flac", // wasted bits // IETF test cases. "testdata/flac-test-files/subset/01 - blocksize 4096.flac", diff --git a/flac_test.go b/flac_test.go index 231f648..0e1ce8a 100644 --- a/flac_test.go +++ b/flac_test.go @@ -97,6 +97,7 @@ func TestDecode(t *testing.T) { "testdata/256529.flac", "testdata/257344.flac", "testdata/8297-275156-0011.flac", + "testdata/24000-tts-sf.flac", "testdata/love.flac", // IETF test cases. // diff --git a/frame/frame.go b/frame/frame.go index 877569a..223d765 100644 --- a/frame/frame.go +++ b/frame/frame.go @@ -475,8 +475,6 @@ func (frame *Frame) parseSampleRate(br *bits.Reader, sampleRate uint64) error { case 0x7: // 0111: 24 kHz. frame.SampleRate = 24000 - // TODO(u): Remove log message when the test cases have been extended. - log.Printf("frame.Frame.parseHeader: The flac library test cases do not yet include any audio files with sample rate %d. If possible please consider contributing this audio sample to improve the reliability of the test cases.", frame.SampleRate) case 0x8: // 1000: 32 kHz. frame.SampleRate = 32000 diff --git a/frame/frame_test.go b/frame/frame_test.go index 405cd5c..744ea5a 100644 --- a/frame/frame_test.go +++ b/frame/frame_test.go @@ -25,6 +25,7 @@ var golden = []struct { {path: "../testdata/243749.flac"}, {path: "../testdata/256529.flac"}, {path: "../testdata/257344.flac"}, + {path: "../testdata/24000-tts-sf.flac"}, // IETF test cases. {path: "../testdata/flac-test-files/subset/01 - blocksize 4096.flac"}, @@ -119,6 +120,9 @@ func TestFrameHash(t *testing.T) { got := md5sum.Sum(nil) // Verify the decoded audio samples by comparing the MD5 checksum that is // stored in StreamInfo with the computed one. + // TODO WELP, seems OpenAI is moving so fast they don't even have time to compute checksums :/ + // frame_test.go:124: path="../testdata/24000-tts-sf.flac": MD5 checksum mismatch for decoded audio samples; + // expected 00000000000000000000000000000000, got f5e621f2580ee8ace6158966793abdbf if !bytes.Equal(got, want) { t.Errorf("path=%q: MD5 checksum mismatch for decoded audio samples; expected %32x, got %32x", g.path, want, got) } diff --git a/meta/meta_test.go b/meta/meta_test.go index 268e63a..b8b66d0 100644 --- a/meta/meta_test.go +++ b/meta/meta_test.go @@ -193,6 +193,22 @@ var golden = []struct { }, }, }, + // TODO reviewer: These values look weird, Apple Music cannot play it, but ffmpeg converts it just fine + // ffmpeg -i testdata/24000-tts-sf.flac -acodec pcm_s16le converted.wav + { + path: "../testdata/24000-tts-sf.flac", + info: &meta.StreamInfo{BlockSizeMin: 0x1000, BlockSizeMax: 0x1000, FrameSizeMin: 0x0, FrameSizeMax: 0x0, SampleRate: 0x5dc0, NChannels: 0x1, BitsPerSample: 0x10, NSamples: 0x0, MD5sum: [16]uint8{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}, + blocks: []*meta.Block{ + { + Header: meta.Header{Type: 0x4, Length: 40, IsLast: false}, + Body: &meta.VorbisComment{Vendor: "reference libFLAC 1.3.3 20190804", Tags: [][2]string(nil)}, + }, + { + Header: meta.Header{Type: 0x1, Length: 8192, IsLast: true}, + Body: nil, + }, + }, + }, } func TestParseBlocks(t *testing.T) { diff --git a/testdata/24000-tts-sf.flac b/testdata/24000-tts-sf.flac new file mode 100644 index 0000000..bc58e66 Binary files /dev/null and b/testdata/24000-tts-sf.flac differ diff --git a/testdata/README.md b/testdata/README.md index ac6d321..ca717db 100644 --- a/testdata/README.md +++ b/testdata/README.md @@ -20,3 +20,8 @@ The following testcase sounds have been released into the [public domain]. The following flac files are CC BY 4.0: * [8297-275156-0011.flac](http://www.openslr.org/12/) - a single file from the LibriSpeech ASR corpus, by Vassil Panyotov and DanielPovey. + + +The following flac files are TODO: + +* [24000-tts-sf.flac](https://platform.openai.com/docs/guides/text-to-speech/do-i-own-the-outputted-audio-files) \ No newline at end of file