modify_wav.py 文件源码

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

项目:AssembleAudio 作者: The-White-Wolf 项目源码 文件源码
def wavFileType(filename):
    #Given a file, the function will determine
    #whether it is a SCOT WAV file or just a
    #regular WAV file.

    try:
        with open(filename, 'rb') as wav_file:
            wav_file.seek(8)
            is_wav_file = wav_file.read(4)
            if not is_wav_file == bytes('WAVE', 'ASCII'):
                return 'notwav'
            else:
                wav_file.seek(60)
                scot = wav_file.read(4)
                if scot == bytes('scot', 'ASCII'):
                    return 'scottwav'
                else:
                    return 'wav'

    except IOError:
        print("--wavFileType Error--")
        return 'error'
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号