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