Update inference/mastering_transfer.py
Browse files
inference/mastering_transfer.py
CHANGED
@@ -85,13 +85,10 @@ class Mastering_Style_Transfer_Inference:
|
|
85 |
# Inference whole song
|
86 |
def inference(self, input_track_path, reference_track_path):
|
87 |
print("\n======= Start to inference music mastering style transfer =======")
|
88 |
-
# normalized input
|
89 |
-
output_name_tag = 'output' if self.args.normalize_input else 'output_notnormed'
|
90 |
|
|
|
91 |
input_aud = load_wav_segment(input_track_path, axis=0)
|
92 |
reference_aud = load_wav_segment(reference_track_path, axis=0)
|
93 |
-
input_aud = torch.FloatTensor(input_aud).to(self.device)
|
94 |
-
reference_aud = torch.FloatTensor(reference_aud).to(self.device)
|
95 |
|
96 |
# loudness normalization for stability
|
97 |
meter = pyloudnorm.Meter(44100)
|
@@ -103,6 +100,9 @@ class Mastering_Style_Transfer_Inference:
|
|
103 |
reference_aud = pyloudnorm.normalize.loudness(reference_aud, loudness_ref, -12)
|
104 |
reference_aud = np.clip(reference_aud, -1., 1.)
|
105 |
|
|
|
|
|
|
|
106 |
cur_out_dir = './yt_dir/0/'
|
107 |
os.makedirs(cur_out_dir, exist_ok=True)
|
108 |
''' segmentize whole songs into batch '''
|
|
|
85 |
# Inference whole song
|
86 |
def inference(self, input_track_path, reference_track_path):
|
87 |
print("\n======= Start to inference music mastering style transfer =======")
|
|
|
|
|
88 |
|
89 |
+
# load input wavs
|
90 |
input_aud = load_wav_segment(input_track_path, axis=0)
|
91 |
reference_aud = load_wav_segment(reference_track_path, axis=0)
|
|
|
|
|
92 |
|
93 |
# loudness normalization for stability
|
94 |
meter = pyloudnorm.Meter(44100)
|
|
|
100 |
reference_aud = pyloudnorm.normalize.loudness(reference_aud, loudness_ref, -12)
|
101 |
reference_aud = np.clip(reference_aud, -1., 1.)
|
102 |
|
103 |
+
input_aud = torch.FloatTensor(input_aud).to(self.device)
|
104 |
+
reference_aud = torch.FloatTensor(reference_aud).to(self.device)
|
105 |
+
|
106 |
cur_out_dir = './yt_dir/0/'
|
107 |
os.makedirs(cur_out_dir, exist_ok=True)
|
108 |
''' segmentize whole songs into batch '''
|