-
-
Save Mya-Mya/1151158f448db0c5d3e1a8e550bf501f to your computer and use it in GitHub Desktop.
`1.wav`,`2.wav`...`100.wav`というファイル名をJVSコーパスの音声ファイル名に合わせる。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os,re | |
from glob import glob | |
def to_jvs_fp(fp): | |
directory,basename = os.path.split(fp) | |
if bool(re.match('VOICEACTRESS100_\d{3}.wav',basename)): | |
return fp | |
index,_ = os.path.splitext(basename) | |
new_basename = 'VOICEACTRESS100_{:03d}.wav'.format(int(index)) | |
return os.path.join(directory,new_basename) | |
target_directory = input('target directory?> ') | |
for fp in glob(os.path.join(target_directory,'*')): | |
new_fp = to_jvs_fp(fp) | |
os.rename(fp,new_fp) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment