#Remove/comment out this part of code \/ if generate_mels: create_mels() train(output_directory, log_directory, checkpoint_path, warm_start, n_gpus, rank, group_name, hparams, log_directory2) #Remove/comment out this part of code ^^^ # # # CELL 1 # # # # # # # # # %%script bash apt -qq install -y sox # # # CELL 2 # # # # # # # # # %%script bash # trim all 48Khz files mkdir /content/tacotron2/wavs/out cd /content/tacotron2/wavs; for input in *.wav; do output="out/$input" sox "$input" "$output" silence 1 0.05 0.1% reverse silence 1 0.05 0.1% reverse; done # # # CELL 3 # # # # # # # # # import os import shutil for r,d,f in os.walk("wavs"): for files in f: filepath = os.path.join(os.getcwd(),"wavs","out", files) destpath = os.path.join(os.getcwd(),"wavs") shutil.copy(filepath,destpath) shutil.rmtree(os.path.join(os.getcwd(),"wavs","out")) # # # CELL 4 # # # # # # # # # !sed -i -- 's,.wav|,.npy|,g' filelists/*.txt # # # CELL 5 # # # # # # # # # !pip3 install pysoundfile import os import sys import glob import numpy as np import librosa from scipy.io import wavfile import soundfile def fix_wav_files(): wavs = glob.glob('wavs/out/*.wav') for wav in tqdm(wavs): #print(wav) data, samplerate = soundfile.read(wav) soundfile.write(wav, data, samplerate, subtype='PCM_S8') ????????????#subtype='PCM_16') #use this one for 48 models if not os.path.exists("mels_finished_generating"): fix_wav_files(); create_mels(); #gc.collect() train(output_directory, log_directory, checkpoint_path, warm_start, n_gpus, rank, group_name, hparams, log_directory2)