jhtonyKoo commited on
Commit
08a42aa
1 Parent(s): d27d101

Update inference/mastering_transfer.py

Browse files
Files changed (1) hide show
  1. inference/mastering_transfer.py +3 -3
inference/mastering_transfer.py CHANGED
@@ -95,8 +95,8 @@ class Mastering_Style_Transfer_Inference:
95
 
96
  # loudness normalization for stability
97
  meter = pyloudnorm.Meter(44100)
98
- loudness_in = meter.integrated_loudness(input_aud.transpose())
99
- loudness_ref = meter.integrated_loudness(reference_aud.transpose())
100
 
101
  input_aud = pyloudnorm.normalize.loudness(input_aud, loudness_in, -12)
102
  input_aud = np.clip(input_aud, -1., 1.)
@@ -152,7 +152,7 @@ class Mastering_Style_Transfer_Inference:
152
  fin_data_out_mastered = fin_data_out[:, :input_aud.shape[-1]].numpy()
153
 
154
  # adjust to reference's loudness
155
- loudness_out = meter.integrated_loudness(fin_data_out_mastered.transpose())
156
  fin_data_out_mastered = pyloudnorm.normalize.loudness(fin_data_out_mastered, loudness_out, loudness_ref)
157
  fin_data_out_mastered = np.clip(fin_data_out_mastered, -1., 1.)
158
 
 
95
 
96
  # loudness normalization for stability
97
  meter = pyloudnorm.Meter(44100)
98
+ loudness_in = meter.integrated_loudness(input_aud.transpose(-1, -2))
99
+ loudness_ref = meter.integrated_loudness(reference_aud.transpose(-1, -2))
100
 
101
  input_aud = pyloudnorm.normalize.loudness(input_aud, loudness_in, -12)
102
  input_aud = np.clip(input_aud, -1., 1.)
 
152
  fin_data_out_mastered = fin_data_out[:, :input_aud.shape[-1]].numpy()
153
 
154
  # adjust to reference's loudness
155
+ loudness_out = meter.integrated_loudness(fin_data_out_mastered.transpose(-1, -2))
156
  fin_data_out_mastered = pyloudnorm.normalize.loudness(fin_data_out_mastered, loudness_out, loudness_ref)
157
  fin_data_out_mastered = np.clip(fin_data_out_mastered, -1., 1.)
158