mirror of https://github.com/coqui-ai/TTS.git
Add RMS based norm in save_wav method
This commit is contained in:
parent
bb7a645e7a
commit
21cbfe964e
|
@ -111,7 +111,8 @@ synthesizer = Synthesizer(
|
||||||
use_cuda=args.use_cuda,
|
use_cuda=args.use_cuda,
|
||||||
)
|
)
|
||||||
|
|
||||||
use_multi_speaker = hasattr(synthesizer.tts_model, "num_speakers") and synthesizer.tts_model.num_speakers > 1
|
use_multi_speaker = hasattr(synthesizer.tts_model, "num_speakers") and (synthesizer.tts_model.num_speakers > 1 or synthesizer.tts_speakers_file is not None)
|
||||||
|
print("Multispeaker?", use_multi_speaker, synthesizer.tts_model.num_speakers)
|
||||||
speaker_manager = getattr(synthesizer.tts_model, "speaker_manager", None)
|
speaker_manager = getattr(synthesizer.tts_model, "speaker_manager", None)
|
||||||
# TODO: set this from SpeakerManager
|
# TODO: set this from SpeakerManager
|
||||||
use_gst = synthesizer.tts_config.get("use_gst", False)
|
use_gst = synthesizer.tts_config.get("use_gst", False)
|
||||||
|
|
|
@ -859,7 +859,11 @@ class AudioProcessor(object):
|
||||||
path (str): Path to a output file.
|
path (str): Path to a output file.
|
||||||
sr (int, optional): Sampling rate used for saving to the file. Defaults to None.
|
sr (int, optional): Sampling rate used for saving to the file. Defaults to None.
|
||||||
"""
|
"""
|
||||||
wav_norm = wav * (32767 / max(0.01, np.max(np.abs(wav))))
|
if self.do_rms_norm:
|
||||||
|
wav_norm = self.rms_volume_norm(wav, self.db_level) * 32767
|
||||||
|
else:
|
||||||
|
wav_norm = wav * (32767 / max(0.01, np.max(np.abs(wav))))
|
||||||
|
|
||||||
scipy.io.wavfile.write(path, sr if sr else self.sample_rate, wav_norm.astype(np.int16))
|
scipy.io.wavfile.write(path, sr if sr else self.sample_rate, wav_norm.astype(np.int16))
|
||||||
|
|
||||||
def get_duration(self, filename: str) -> float:
|
def get_duration(self, filename: str) -> float:
|
||||||
|
|
Loading…
Reference in New Issue