Skip to content

πŸŽ› πŸ”Š A Python library for audio.

Python formatting.

Peter Sobot0d65125e0847
diff --git a/pedalboard/pedalboard.py b/pedalboard/pedalboard.py
index 8ee6070..c231ad7 100644
--- a/pedalboard/pedalboard.py
+++ b/pedalboard/pedalboard.py
@@ -14,18 +14,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import os
-import collections
import platform
import weakref
from functools import update_wrapper
from contextlib import contextmanager
-from typing import List, Optional, Dict, Union, Tuple, Set, Iterable, Union
+from typing import List, Optional, Dict, Tuple, Iterable, Union
-import numpy as np
-
-from pedalboard_native import Plugin, process, _AudioProcessorParameter
-from pedalboard_native.utils import Mix, Chain
+from pedalboard_native import Plugin, _AudioProcessorParameter
+from pedalboard_native.utils import Chain
class Pedalboard(Chain):
diff --git a/tests/test_mix_and_chain.py b/tests/test_mix_and_chain.py
index c87585f..4f20e8a 100644
--- a/tests/test_mix_and_chain.py
+++ b/tests/test_mix_and_chain.py
@@ -167,14 +167,18 @@ def test_chain_latency_compensation(sample_rate, buffer_size, latency_a_seconds,
noise = np.random.rand(int(NUM_SECONDS * sample_rate))
pb = Pedalboard(
[
- Chain([
- AddLatency(int(latency_a_seconds * sample_rate)),
- AddLatency(int(latency_b_seconds * sample_rate)),
- ]),
- Chain([
- AddLatency(int(latency_a_seconds * sample_rate)),
- AddLatency(int(latency_b_seconds * sample_rate)),
- ]),
+ Chain(
+ [
+ AddLatency(int(latency_a_seconds * sample_rate)),
+ AddLatency(int(latency_b_seconds * sample_rate)),
+ ]
+ ),
+ Chain(
+ [
+ AddLatency(int(latency_a_seconds * sample_rate)),
+ AddLatency(int(latency_b_seconds * sample_rate)),
+ ]
+ ),
]
)
output = pb(noise, sample_rate, buffer_size=buffer_size)
@@ -216,11 +220,13 @@ def test_readme_example_does_not_crash(sample_rate, buffer_size):
# Put a compressor at the front of the chain:
Compressor(),
# Split the chain and mix three different effects equally:
- Mix([
- Pedalboard([passthrough, Distortion(drive_db=36)]),
- Pedalboard([delay_and_pitch_shift, Reverb(room_size=1)]),
- delay_longer_and_more_pitch_shift,
- ]),
+ Mix(
+ [
+ Pedalboard([passthrough, Distortion(drive_db=36)]),
+ Pedalboard([delay_and_pitch_shift, Reverb(room_size=1)]),
+ delay_longer_and_more_pitch_shift,
+ ]
+ ),
# Add a reverb on the final mix:
Reverb(),
]
@@ -281,7 +287,6 @@ def test_empty_list_is_valid_constructor_arg(cls):
assert len(cls([])) == 0
-
@pytest.mark.parametrize("cls", [Mix, Chain, Pedalboard])
def test_no_arg_constructor(cls):
assert len(cls()) == 0
diff --git a/tests/test_python_interface.py b/tests/test_python_interface.py
index 82ae34c..807fc9c 100644
--- a/tests/test_python_interface.py
+++ b/tests/test_python_interface.py
@@ -46,7 +46,6 @@ def test_fail_on_invalid_buffer_size():
def test_repr():
- sr = 44100
gain = Gain(-6)
value = repr(Pedalboard([gain]))
# Allow flexibility; all we care about is that these values exist in the repr.
@@ -56,7 +55,6 @@ def test_repr():
def test_is_list_like():
- sr = 44100
gain = Gain(-6)
assert len(Pedalboard([gain])) == 1
diff --git a/tests/test_tensorflow.py b/tests/test_tensorflow.py
index c84e80e..f78009f 100644
--- a/tests/test_tensorflow.py
+++ b/tests/test_tensorflow.py
@@ -37,8 +37,7 @@ def test_can_be_called_in_tensorflow_data_pipeline():
noise = np.random.rand(sr)
ds = tf.data.Dataset.from_tensor_slices([noise]).map(
- lambda audio: tf.numpy_function(plugins.process, [audio, sr], tf.float32
- )
+ lambda audio: tf.numpy_function(plugins.process, [audio, sr], tf.float32)
)
model = tf.keras.models.Sequential(