|
|
|
@ -377,6 +377,44 @@
|
|
|
|
|
" metadata_file.write(new_info)\n",
|
|
|
|
|
"metadata_file.close()"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"execution_count": 5,
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": [
|
|
|
|
|
"from pathlib import Path\n",
|
|
|
|
|
"import os\n",
|
|
|
|
|
"import shutil\n",
|
|
|
|
|
"emo_root = Path('../audiodata/SV2TTS/synthesizer').joinpath('emo')\n",
|
|
|
|
|
"# raw_root = Path('../audiodata/aidatatang_200zh/corpus/train')\n",
|
|
|
|
|
"# emo_file_list = emo_root.glob(\"**/*.npy\")\n",
|
|
|
|
|
"# for emo_file in emo_file_list:\n",
|
|
|
|
|
"# if emo_file.name.endswith('wav__00.npy'):\n",
|
|
|
|
|
"# folder = emo_file.parent\n",
|
|
|
|
|
"# os.rename(emo_file, folder.joinpath(emo_file.name.replace(\"__00\", \"_00\")))\n",
|
|
|
|
|
" # shutil.move(emo_file, emo_root.joinpath(emo_file.name))\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"root = Path('../audiodata/SV2TTS/synthesizer')\n",
|
|
|
|
|
"dict_info = []\n",
|
|
|
|
|
"with open(root.joinpath(\"train.txt\"), \"r\", encoding=\"utf-8\") as dict_meta:\n",
|
|
|
|
|
" for raw in dict_meta:\n",
|
|
|
|
|
" if not raw:\n",
|
|
|
|
|
" continue\n",
|
|
|
|
|
" v = raw.split(\"|\")[0].replace(\"audio\",\"emo\")\n",
|
|
|
|
|
" emo_fpath = root.joinpath(\"emo\").joinpath(v)\n",
|
|
|
|
|
" if emo_fpath.exists():\n",
|
|
|
|
|
" dict_info.append(raw)\n",
|
|
|
|
|
" # else:\n",
|
|
|
|
|
" # print(emo_fpath)\n",
|
|
|
|
|
"# Iterate over each wav\n",
|
|
|
|
|
"meta2 = Path('../audiodata/SV2TTS/synthesizer/train2.txt')\n",
|
|
|
|
|
"metadata_file = meta2.open(\"w\", encoding=\"utf-8\")\n",
|
|
|
|
|
"for new_info in dict_info:\n",
|
|
|
|
|
" metadata_file.write(new_info)\n",
|
|
|
|
|
"metadata_file.close()"
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"metadata": {
|
|
|
|
|