mirror of https://github.com/coqui-ai/TTS.git
testing mean-var scalingand updating test config
parent
40cb4a53a6
commit
52b0dc39a6
|
@ -140,3 +140,24 @@ class TestAudio(unittest.TestCase):
|
|||
assert x_norm.min() < 0, x_norm.min()
|
||||
x_ = self.ap._denormalize(x_norm)
|
||||
assert (x - x_).sum() < 1e-3
|
||||
|
||||
def test_scaler(self):
|
||||
scaler_stats_path = os.path.join(get_tests_input_path(), 'scale_stats.npy')
|
||||
conf.audio['stats_path'] = scaler_stats_path
|
||||
conf.audio['preemphasis'] = 0.0
|
||||
conf.audio['do_trim_silence'] = True
|
||||
conf.audio['signal_norm'] = True
|
||||
|
||||
ap = AudioProcessor(**conf.audio)
|
||||
mel_mean, mel_std, linear_mean, linear_std, _ = ap.load_stats(scaler_stats_path)
|
||||
ap.setup_scaler(mel_mean, mel_std, linear_mean, linear_std)
|
||||
|
||||
self.ap.signal_norm = False
|
||||
self.ap.preemphasis = 0.0
|
||||
|
||||
# test scaler forward and backward transforms
|
||||
wav = self.ap.load_wav(WAV_FILE)
|
||||
mel_reference = self.ap.melspectrogram(wav)
|
||||
mel_norm = ap.melspectrogram(wav)
|
||||
mel_denorm = ap._denormalize(mel_norm)
|
||||
assert abs(mel_reference - mel_denorm).max() < 1e-4
|
|
@ -2,10 +2,12 @@
|
|||
"audio":{
|
||||
"audio_processor": "audio", // to use dictate different audio processors, if available.
|
||||
"num_mels": 80, // size of the mel spec frame.
|
||||
"num_freq": 1025, // number of stft frequency levels. Size of the linear spectogram frame.
|
||||
"num_freq": 513, // number of stft frequency levels. Size of the linear spectogram frame.
|
||||
"sample_rate": 22050, // wav sample-rate. If different than the original data, it is resampled.
|
||||
"frame_length_ms": 50, // stft window length in ms.
|
||||
"frame_shift_ms": 12.5, // stft window hop-lengh in ms.
|
||||
"frame_length_ms": null, // stft window length in ms.
|
||||
"frame_shift_ms": null, // stft window hop-lengh in ms.
|
||||
"hop_length": 256,
|
||||
"win_length": 1024,
|
||||
"preemphasis": 0.97, // pre-emphasis to reduce spec noise and make it more structured. If 0.0, no -pre-emphasis.
|
||||
"min_level_db": -100, // normalization range
|
||||
"ref_level_db": 20, // reference level db, theoretically 20db is the sound of air.
|
||||
|
@ -15,8 +17,8 @@
|
|||
"symmetric_norm": true, // move normalization to range [-1, 1]
|
||||
"clip_norm": true, // clip normalized values into the range.
|
||||
"max_norm": 4, // scale normalization to range [-max_norm, max_norm] or [0, max_norm]
|
||||
"mel_fmin": 95, // minimum freq level for mel-spec. ~50 for male and ~95 for female voices. Tune for dataset!!
|
||||
"mel_fmax": 7600, // maximum freq level for mel-spec. Tune for dataset!!
|
||||
"mel_fmin": 0, // minimum freq level for mel-spec. ~50 for male and ~95 for female voices. Tune for dataset!!
|
||||
"mel_fmax": 8000, // maximum freq level for mel-spec. Tune for dataset!!
|
||||
"do_trim_silence": false
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue