修改WAV头

April 19, 2018, 9:50 p.m.

read: 979

WAV头文

16kHz的情况

波形音频数据传送速率,其值为通道数×每秒数据位数×每样本的数据位数/8

1 * 16000 * 16 / 8 = 32000

修改到正确的值

def modify_wav(wav_file_path):
    with open(wav_file_path, 'rb+') as wav_file:
        with open(wav_file_path.replace(".wav", "") + "_modify.wav", "wb+") as new_wav_file:
            index = 0
            while True:
                data = wav_file.read(1)
                if not data:
                    break
                if index == 28 or index == 29:
                    if index == 28:
                        new_wav_file.write(b'\x00')
                    if index == 29:
                        new_wav_file.write(b'}')
                else:
                    new_wav_file.write(data)
                index += 1

简单方法:

import soundfile as sf
sig, sr = sf.read(wav_file_path)
sf.write(wav_file_path, sig, sr)




记Tensorflow Sering GPU版本 部署成功

+-----------------------------------------------------------------------------+ | NVIDIA-SMI 387.26…

kaldi mono对齐

文章标题:kaldi mono对齐文章内容:我们采用的是aishell训练集,训练完成之后,我们来对mono进行解码:在mono里面有这样的一段的代码: # Monophone decoding u…

此站点由 ASP.NETIIS 驱动 | © 2018-2023 hupeng.me. All Rights Reserved.