Merge pull request #190 from svc-develop-team/4.1-Stable
Restore Loud match logic
This commit is contained in:
commit
71814e488d
|
@ -20,5 +20,4 @@ tensorboard
|
|||
tensorboardX
|
||||
edge_tts
|
||||
pyyaml
|
||||
pynvml
|
||||
pyloudnorm
|
||||
pynvml
|
|
@ -23,5 +23,4 @@ onnxoptimizer
|
|||
tensorboardX
|
||||
edge_tts
|
||||
pyyaml
|
||||
pynvml
|
||||
pyloudnorm
|
||||
pynvml
|
22
resample.py
22
resample.py
|
@ -5,7 +5,6 @@ import numpy as np
|
|||
from multiprocessing import Pool, cpu_count
|
||||
from scipy.io import wavfile
|
||||
from tqdm import tqdm
|
||||
import pyloudnorm as pyln
|
||||
|
||||
|
||||
def process(item):
|
||||
|
@ -22,20 +21,13 @@ def process(item):
|
|||
wav = 0.98 * wav / peak
|
||||
wav2 = librosa.resample(wav, orig_sr=sr, target_sr=args.sr2)
|
||||
wav2 /= max(wav2.max(), -wav2.min())
|
||||
try:
|
||||
meter = pyln.Meter(args.sr2,block_size=0.2)
|
||||
loudness = meter.integrated_loudness(wav2)
|
||||
wav2 = pyln.normalize.loudness(wav2, loudness, -23.0)
|
||||
# wav2 /= max(wav2.max(), -wav2.min())
|
||||
save_name = wav_name
|
||||
save_path2 = os.path.join(args.out_dir2, speaker, save_name)
|
||||
wavfile.write(
|
||||
save_path2,
|
||||
args.sr2,
|
||||
(wav2 * np.iinfo(np.int16).max).astype(np.int16))
|
||||
except ValueError as e:
|
||||
print(f"{wav_path} is too short(<200ms), the wav skip")
|
||||
|
||||
save_name = wav_name
|
||||
save_path2 = os.path.join(args.out_dir2, speaker, save_name)
|
||||
wavfile.write(
|
||||
save_path2,
|
||||
args.sr2,
|
||||
(wav2 * np.iinfo(np.int16).max).astype(np.int16)
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Reference in New Issue