π π A Python library for audio.
C audioaudio-processingaudio-productionaudio-researchaudio-unitaugmentationjucemachine-learningpybind11pythonvst3vst3-host
Fix MP3 files that start with ID3 tags and end with LYRICS3 blocks.
Peter Sobotcf7eb67b051f
diff --git a/pedalboard/io/AudioFile.h b/pedalboard/io/AudioFile.hindex 347c5ec..462f603 100644--- a/pedalboard/io/AudioFile.h+++ b/pedalboard/io/AudioFile.h@@ -53,12 +53,12 @@ void registerPedalboardAudioFormats(juce::AudioFormatManager &manager,// Linux. To do so, we use this flag:if (crossPlatformOnly) {- manager.registerFormat(new juce::MP3AudioFormat(), false);+ manager.registerFormat(new juce::PatchedMP3AudioFormat(), false);} else {#if JUCE_MAC || JUCE_IOSmanager.registerFormat(new juce::CoreAudioFormat(), false);#else- manager.registerFormat(new juce::MP3AudioFormat(), false);+ manager.registerFormat(new juce::PatchedMP3AudioFormat(), false);#endif}}diff --git a/pedalboard/io/ReadableAudioFile.h b/pedalboard/io/ReadableAudioFile.hindex 3bbb30a..32914ed 100644--- a/pedalboard/io/ReadableAudioFile.h+++ b/pedalboard/io/ReadableAudioFile.h@@ -493,7 +493,7 @@ private:if (PythonInputStream *stream = getPythonInputStream()) {if (stream->isExhausted()) {- ss << " The file may contain invalid data past or near its end. Try "+ ss << " The file may contain invalid data near its end. Try ""reading fewer audio frames from the file.";}}diff --git a/tests/audio/correct/bad_audio_file_lyrics3.mp3 b/tests/audio/correct/bad_audio_file_lyrics3.mp3new file mode 100644index 0000000..f341f6cBinary files /dev/null and b/tests/audio/correct/bad_audio_file_lyrics3.mp3 differdiff --git a/tests/test_io.py b/tests/test_io.pyindex bb7b2fc..9679e40 100644--- a/tests/test_io.py+++ b/tests/test_io.py@@ -1032,6 +1032,16 @@ def test_mp3_parsing_with_lyrics3(cross_platform_formats_only: bool, lyric_data_assert f.read(f.frames).shape[1] >= input_audio.shape[-1][email protected]("cross_platform_formats_only", [True, False])+def test_real_mp3_parsing_with_lyrics3(cross_platform_formats_only: bool):+ with pedalboard.io.ReadableAudioFile(+ os.path.join(os.path.dirname(__file__), "audio", "correct", "bad_audio_file_lyrics3.mp3"),+ cross_platform_formats_only=cross_platform_formats_only,+ ) as f:+ assert f.frames >= 0+ assert f.read(f.frames).shape[1] == f.frames++@pytest.mark.parametrize("quality", list(range(9)))@pytest.mark.parametrize("chunk_duration", [16, 1024, 2048, 1024 * 1024])@pytest.mark.parametrize("granularity", [1, 16, 17, 1024, 1025])