平台准备:
python 3.6
os包
WSJ0 corpus———csr_1_senn
sph2pipe包
csr_1_senn,sph2pipe包和wv_convert_wav.py在同一个目录下
代码:wv_convert_wav.py
import os
# the root dir for WSJ0 corpus
root_dir = "csr_1_senn"
# the disc number
disc_dir = []
disc_index = 0
for list_disc in os.listdir(root_dir):
if list_disc not in ["doc", "11-13.1"]:
# the data dir for each disc
disc_dir.append(os.path.join(root_dir, list_disc, "wsj0"))
disc_index = disc_index + 1
if not os.path.exists("wsj0"):
os.mkdir("wsj0")
# the sub_data dir for each disc
for i, list_sub_data in enumerate(disc_dir):
for sub_data_dir in os.listdir(list_sub_data):
s_dir = os.path.join("wsj0", sub_data_dir)
if not os.path.exists(s_