From ca88a9f9aab6ee49bdc77f5f2c02e70d6ffaa46c Mon Sep 17 00:00:00 2001 From: kFYatek <4499762+kFYatek@users.noreply.github.com> Date: Tue, 17 Dec 2024 17:42:46 +0100 Subject: [PATCH] Add DIFF_SPEC ensemble mode --- gui_data/constants.py | 3 ++- lib_v5/spec_utils.py | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gui_data/constants.py b/gui_data/constants.py index 22c59186..92b67b9a 100644 --- a/gui_data/constants.py +++ b/gui_data/constants.py @@ -304,6 +304,7 @@ MIN_SPEC = 'Min Spec' MAX_SPEC = 'Max Spec' +DIFF_SPEC = 'Diff Spec' AUDIO_AVERAGE = 'Average' MAX_MIN = f'{MAX_SPEC}/{MIN_SPEC}' @@ -351,7 +352,7 @@ else: AUDIO_TOOL_OPTIONS = (MANUAL_ENSEMBLE, ALIGN_INPUTS, MATCH_INPUTS) -MANUAL_ENSEMBLE_OPTIONS = (MIN_SPEC, MAX_SPEC, AUDIO_AVERAGE, COMBINE_INPUTS) +MANUAL_ENSEMBLE_OPTIONS = (MIN_SPEC, MAX_SPEC, DIFF_SPEC, AUDIO_AVERAGE, COMBINE_INPUTS) PROCESS_METHODS = (VR_ARCH_PM, MDX_ARCH_TYPE, DEMUCS_ARCH_TYPE, ENSEMBLE_MODE, AUDIO_TOOLS) diff --git a/lib_v5/spec_utils.py b/lib_v5/spec_utils.py index 8ec520d9..ceb6868b 100644 --- a/lib_v5/spec_utils.py +++ b/lib_v5/spec_utils.py @@ -5,6 +5,7 @@ import math import platform import traceback +import scipy from . import pyrb from scipy.signal import correlate, hilbert import io @@ -43,10 +44,12 @@ MAX_SPEC = 'Max Spec' MIN_SPEC = 'Min Spec' +DIFF_SPEC = 'Diff Spec' LIN_ENSE = 'Linear Ensemble' MAX_WAV = MAX_SPEC MIN_WAV = MIN_SPEC +DIFF_WAV = DIFF_SPEC AVERAGE = 'Average' @@ -541,7 +544,9 @@ def ensembling(a, inputs, is_wavs=False): if MIN_SPEC == a: input = np.where(np.abs(inputs[i]) <= np.abs(input), inputs[i], input) if MAX_SPEC == a: - input = np.where(np.abs(inputs[i]) >= np.abs(input), inputs[i], input) + input = np.where(np.abs(inputs[i]) >= np.abs(input), inputs[i], input) + if DIFF_SPEC == a: + input = np.abs(np.abs(input) - np.abs(inputs[i])) * np.exp(1j * np.angle(input + inputs[i])) #linear_ensemble #input = ensemble_wav(inputs, split_size=1)