data_utils.py 文件源码

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

项目:deep-playlist 作者: anushabala 项目源码 文件源码
def convert_mp3_to_wav(mp3_path, wav_path, max_length=10):
    try:
        if os.path.exists(wav_path):
            return True #todo ideally check here whether file is valid but blah for now
        sound = AudioSegment.from_mp3(mp3_path)
        sound = sound[:max_length*1000]
        sound.export(wav_path, format='wav')
    except (IOError, CouldntDecodeError) as ie:
        print "Error while converting mp3 to wav: %s" % mp3_path
        return False

    return True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号