Skip to content

Instantly share code, notes, and snippets.

@Mya-Mya
Last active March 7, 2021 05:53
Show Gist options
  • Save Mya-Mya/1151158f448db0c5d3e1a8e550bf501f to your computer and use it in GitHub Desktop.
Save Mya-Mya/1151158f448db0c5d3e1a8e550bf501f to your computer and use it in GitHub Desktop.
`1.wav`,`2.wav`...`100.wav`というファイル名をJVSコーパスの音声ファイル名に合わせる。
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