Skip to content

Commit 4a8dfd2

Browse files
authored
Merge branch 'master' into psobot/313
2 parents bbd4e59 + 1273304 commit 4a8dfd2

File tree

4 files changed

+19
-0
lines changed

4 files changed

+19
-0
lines changed

pedalboard/juce_overrides/juce_PatchedMP3AudioFormat.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -3323,6 +3323,10 @@ class PatchedMP3Reader : public AudioFormatReaderWithPosition {
33233323
return false;
33243324
}
33253325

3326+
if (numDestChannels == 0) {
3327+
return true;
3328+
}
3329+
33263330
if (currentPosition != startSampleInFile) {
33273331
if (!stream.seek((int)(startSampleInFile / samplesPerFrame - 1))) {
33283332
currentPosition = -1;

tests/audio/correct/zero_channels.mp3

1.27 KB
Binary file not shown.

tests/test_io.py

+7
Original file line numberDiff line numberDiff line change
@@ -1271,6 +1271,13 @@ def test_real_mp3_parsing_with_no_header():
12711271
assert f.read(f.frames).shape[1] == f.frames
12721272

12731273

1274+
def test_real_mp3_parsing_with_no_channels():
1275+
filename = os.path.join(os.path.dirname(__file__), "audio", "correct", "zero_channels.mp3")
1276+
with pedalboard.io.AudioFile(filename) as f:
1277+
assert f.num_channels == 0
1278+
assert f.read(f.frames).shape == (0, 0)
1279+
1280+
12741281
@pytest.mark.parametrize("samplerate", [44100, 32000])
12751282
@pytest.mark.parametrize("chunk_size", [1, 2, 16])
12761283
@pytest.mark.parametrize("target_samplerate", [44100, 32000, 22050, 1234.56])

tests/test_type_hints.py

+8
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ def get_env_with_pythonpath() -> Dict[str, str]:
4444
os.environ.get("CIBW_BUILD") is not None,
4545
reason="Unable to get MyPy tests working while in cibuildwheel",
4646
)
47+
@pytest.mark.skipif(
48+
os.environ.get("CI") is not None,
49+
reason="Unable to get MyPy tests working reliably on CI",
50+
)
4751
@pytest.mark.parametrize("filename", PASSING_FIXTURES)
4852
def test_mypy_passes(filename):
4953
# Run this test in a subprocess, as MyPy forcibly exits, killing PyTest:
@@ -63,6 +67,10 @@ def test_mypy_passes(filename):
6367
os.environ.get("CIBW_BUILD") is not None,
6468
reason="Unable to get MyPy tests working while in cibuildwheel",
6569
)
70+
@pytest.mark.skipif(
71+
os.environ.get("CI") is not None,
72+
reason="Unable to get MyPy tests working reliably on CI",
73+
)
6674
@pytest.mark.parametrize("filename", FAILING_FIXTURES)
6775
def test_mypy_fails(filename):
6876
# Run this test in a subprocess, as MyPy forcibly exits, killing PyTest:

0 commit comments

Comments
 (0)