mirror of
https://github.com/Anjok07/ultimatevocalremovergui.git
synced 2024-11-24 15:30:11 +01:00
Update spec_utils.py
This commit is contained in:
parent
49c9d776f4
commit
f3106dffdf
@ -276,21 +276,6 @@ def cmb_spectrogram_to_wave(spec_m, mp, extra_bins_h=None, extra_bins=None):
|
||||
wave_band = {}
|
||||
bands_n = len(mp.param['band'])
|
||||
offset = 0
|
||||
|
||||
if False:
|
||||
from scipy import ndimage
|
||||
|
||||
intersect_h2 = 167
|
||||
intersect_y2 = 67
|
||||
intersect_h1 = 62
|
||||
intersect_y1 = 244
|
||||
|
||||
intersect_left = ndimage.zoom(spec_m[0, intersect_y1:intersect_y1+intersect_h1, :].real, zoom=(intersect_h2 / intersect_h1, 1.0), order=3) * 6
|
||||
intersect_right = ndimage.zoom(spec_m[1, intersect_y1:intersect_y1+intersect_h1, :].real, zoom=(intersect_h2 / intersect_h1, 1.0), order=3) * 6
|
||||
s = intersect_y2+intersect_left.shape[0]
|
||||
|
||||
spec_m[0, intersect_y2:s, :] = np.where(np.abs(spec_m[0, intersect_y2:s, :]) <= np.abs(intersect_left) * 1.5, spec_m[0, intersect_y2:s, :], intersect_left)
|
||||
spec_m[1, intersect_y2:s, :] = np.where(np.abs(spec_m[1, intersect_y2:s, :]) <= np.abs(intersect_right) * 1.5, spec_m[1, intersect_y2:s, :], intersect_right)
|
||||
|
||||
for d in range(1, bands_n + 1):
|
||||
bp = mp.param['band'][d]
|
||||
@ -403,15 +388,15 @@ if __name__ == "__main__":
|
||||
if args.algorithm == 'max_mag':
|
||||
v_spec_m = np.where(np.abs(y_spec_m) >= np.abs(X_spec_m), y_spec_m, X_spec_m)
|
||||
|
||||
X_mag = np.abs(X_spec_m)
|
||||
y_mag = np.abs(y_spec_m)
|
||||
v_mag = np.abs(v_spec_m)
|
||||
|
||||
X_image = spectrogram_to_image(X_mag)
|
||||
y_image = spectrogram_to_image(y_mag)
|
||||
v_image = spectrogram_to_image(v_mag)
|
||||
|
||||
if args.algorithm == 'invert':
|
||||
X_mag = np.abs(X_spec_m)
|
||||
y_mag = np.abs(y_spec_m)
|
||||
v_mag = np.abs(v_spec_m)
|
||||
|
||||
X_image = spectrogram_to_image(X_mag)
|
||||
y_image = spectrogram_to_image(y_mag)
|
||||
v_image = spectrogram_to_image(v_mag)
|
||||
|
||||
cv2.imwrite('{}_X.png'.format(args.output_name), X_image)
|
||||
cv2.imwrite('{}_y.png'.format(args.output_name), y_image)
|
||||
cv2.imwrite('{}_v.png'.format(args.output_name), v_image)
|
||||
|
Loading…
Reference in New Issue
Block a user