100 percent coverage
MODIFY
nussl/core/audio_signal.py
nussl/core/audio_signal.py
@@ -1654,20 +1654,23 @@ class AudioSignal(object):
##################################
def build_effect(self, reset=True, overwrite=False):
+ """
+ Builds all effects
+ """
if not self._ffmpeg_effects_chain and not self._sox_effects_chain:
raise RuntimeError("No effect hooks have been called on this AudioSignal")
- # TODO: SOX before ffmpeg
new_signal = self
- if self._ffmpeg_effects_chain:
- new_signal = effects.build_effects_ffmpeg(new_signal, self._ffmpeg_effects_chain)
if self._sox_effects_chain:
new_signal = effects.build_effects_sox(new_signal, self._sox_effects_chain)
+ if self._ffmpeg_effects_chain:
+ new_signal = effects.build_effects_ffmpeg(new_signal, self._ffmpeg_effects_chain)
if reset:
self.reset_effects_chain()
if overwrite:
self.audio_data = new_signal.audio_data
+ self.stft_data = None
return self
return new_signal

MODIFY
nussl/core/effects.py
nussl/core/effects.py
@@ -17,7 +17,6 @@ class FilterFunction():
audio processing streams, such as ffmpeg-python and pysndfx
"""
def __init__(self, _filter, **filter_kwargs):
- self.func = None
raise NotImplementedError
def __call__(self, stream):

MODIFY
tests/core/test_effects.py
tests/core/test_effects.py
@@ -316,6 +316,9 @@ def test_misc_param_check():
with pytest.raises(ValueError):
effects.equalizer([band])
+ with pytest.raises(ValueError):
+ effects.SoXFilter('fail')
+
def test_silent_mode(mix_and_sources):
signal, _ = mix_and_sources
effects.build_effects_ffmpeg(signal, [], silent=True)
@@ -353,7 +356,12 @@ def test_hooks(mix_and_sources, check_against_regression_data):
assert len(signal._ffmpeg_effects_chain) == 10
assert len(signal._sox_effects_chain) == 2
- augmented_signal = signal.build_effect()
+ augmented_signal = signal.build_effect(reset=False, overwrite=True)
+
+ reg_path = path.join(REGRESSION_PATH, "hooks.json")
+ fx_regression(augmented_signal.audio_data, reg_path, check_against_regression_data)
+
+ augmented_signal = augmented_signal.build_effect()
assert len(signal._ffmpeg_effects_chain) == 0
assert len(signal._sox_effects_chain) == 0
@@ -361,6 +369,3 @@ def test_hooks(mix_and_sources, check_against_regression_data):
with pytest.raises(RuntimeError):
signal.build_effect()
- reg_path = path.join(REGRESSION_PATH, "hooks.json")
-
- fx_regression(augmented_signal.audio_data, reg_path, check_against_regression_data)

DELETE
tests/utils/plots/viz_sources_dict.png
tests/utils/plots/viz_sources_dict.png
Binary files a/tests/utils/plots/viz_sources_dict.png and /dev/null differ

DELETE
tests/utils/plots/viz_sources_list.png
tests/utils/plots/viz_sources_list.png
Binary files a/tests/utils/plots/viz_sources_list.png and /dev/null differ

DELETE
tests/utils/plots/viz_spectrogram.png
tests/utils/plots/viz_spectrogram.png
Binary files a/tests/utils/plots/viz_spectrogram.png and /dev/null differ

DELETE
tests/utils/plots/viz_waveform.png
tests/utils/plots/viz_waveform.png
Binary files a/tests/utils/plots/viz_waveform.png and /dev/null differ

100 percent coverage