prepare_data.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:tfkaldi 作者: vrenkens 项目源码 文件源码
def read_wav(wavfile):
    '''
    read a wav file formatted by kaldi

    Args:
        wavfile: a pair containing eiher the filaname or the command to read the
            wavfile and a boolean that determines if its a name or a command
    '''

    if wavfile[1]:
        #read the audio file and temporarily copy it to tmp (and duplicate, I
        #don't know how to avoid this)
        os.system(wavfile[0] + ' tee tmp.wav > duplicate.wav')
        #read the created wav file
        (rate, utterance) = wav.read('tmp.wav')
        #delete the create file
        os.remove('tmp.wav')
        os.remove('duplicate.wav')
    else:
        (rate, utterance) = wav.read(wavfile[0])

    return rate, utterance
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号