jhtonyKoo commited on
Commit
0a0d52d
1 Parent(s): 9d51225

Update inference/mastering_transfer.py

Browse files
Files changed (1) hide show
  1. inference/mastering_transfer.py +3 -2
inference/mastering_transfer.py CHANGED
@@ -92,12 +92,13 @@ class Mastering_Style_Transfer_Inference:
92
 
93
  # loudness normalization for stability
94
  meter = pyloudnorm.Meter(44100)
 
95
  loudness_in = meter.integrated_loudness(input_aud.transpose(-1, -2))
96
  loudness_ref = meter.integrated_loudness(reference_aud.transpose(-1, -2))
97
 
98
- input_aud = pyloudnorm.normalize.loudness(input_aud, loudness_in, -12)
99
  input_aud = np.clip(input_aud, -1., 1.)
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)
 
92
 
93
  # loudness normalization for stability
94
  meter = pyloudnorm.Meter(44100)
95
+ norm_loudness_gain = -16.
96
  loudness_in = meter.integrated_loudness(input_aud.transpose(-1, -2))
97
  loudness_ref = meter.integrated_loudness(reference_aud.transpose(-1, -2))
98
 
99
+ input_aud = pyloudnorm.normalize.loudness(input_aud, loudness_in, norm_loudness_gain)
100
  input_aud = np.clip(input_aud, -1., 1.)
101
+ reference_aud = pyloudnorm.normalize.loudness(reference_aud, loudness_ref, norm_loudness_gain)
102
  reference_aud = np.clip(reference_aud, -1., 1.)
103
 
104
  input_aud = torch.FloatTensor(input_aud).to(self.device)