waityousea / xuniren

MIT License
551 stars 159 forks source link

No such file or directory: 'data/audio/aud_0.wav' #16

Closed HongdaChen closed 1 year ago

HongdaChen commented 1 year ago

这个需要连接fay才有的吗?还是代码有bug

HongdaChen commented 1 year ago

解决了,因为目录audio不存在,所以无法通过open()创建,可以改为:

def txt_to_audio(text_):
    audio_list = []
    audio_path = 'data/audio/aud_0.wav'
    voicename = "zh-CN-YunxiaNeural"
    # 检查目录是否存在,不存在就创建
    directory = os.path.dirname(audio_path)
    if not os.path.exists(directory):
        os.makedirs(directory)
    # 让我们一起学习。必应由 AI 提供支持,因此可能出现意外和错误。请确保核对事实,并 共享反馈以便我们可以学习和改进!
    text = text_
    asyncio.get_event_loop().run_until_complete(main(voicename,text,audio_path))
    audio_process(audio_path)
lucasjinreal commented 10 months ago

FileNotFoundError: [Errno 2] No such file or directory: 'data/audio/aud_0_eo.npy'