Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[test] Add 24khz sample to testing, remove the log line nudging users #69

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea
*.flac
*.wav
_resources_
1 change: 1 addition & 0 deletions enc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions flac_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//
Expand Down
2 changes: 0 additions & 2 deletions frame/frame.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions frame/frame_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down Expand Up @@ -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)
}
Expand Down
16 changes: 16 additions & 0 deletions meta/meta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Binary file added testdata/24000-tts-sf.flac
Binary file not shown.
5 changes: 5 additions & 0 deletions testdata/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Loading