Skip to content

Commit

Permalink
Properly parse MP3 files without headers.
Browse files Browse the repository at this point in the history
  • Loading branch information
psobot committed Oct 16, 2023
1 parent be421bc commit d2805e8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Binary file added tests/audio/correct/no_header.mp3
Binary file not shown.
7 changes: 7 additions & 0 deletions tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,13 @@ def test_real_mp3_parsing_with_lyrics3():
assert f.read(f.frames).shape[1] == f.frames


def test_real_mp3_parsing_with_no_header():
filename = os.path.join(os.path.dirname(__file__), "audio", "correct", "no_header.mp3")
with pedalboard.io.AudioFile(filename) as f:
assert f.frames >= 40000 and f.frames <= 45000
assert f.read(f.frames).shape[1] == f.frames


@pytest.mark.parametrize("samplerate", [44100, 32000])
@pytest.mark.parametrize("chunk_size", [1, 2, 16])
@pytest.mark.parametrize("target_samplerate", [44100, 32000, 22050, 1234.56])
Expand Down

0 comments on commit d2805e8

Please sign in to comment.