Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DIFF_SPEC ensemble mode #1669

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion gui_data/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}'
Expand Down Expand Up @@ -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)

Expand Down
7 changes: 6 additions & 1 deletion lib_v5/spec_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import math
import platform
import traceback
import scipy
from . import pyrb
from scipy.signal import correlate, hilbert
import io
Expand Down Expand Up @@ -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'

Expand Down Expand Up @@ -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)
Expand Down