将大量数据从NIST更改为RIFF WAV文件 [英] Change huge amount of data from NIST to RIFF wav file
问题描述
因此,我正在编写语音识别程序.为此,我从TIMIT下载了400MB的数据.当我准备读取wav文件时(我尝试了两个库),如下所示:
So, I am writing a speech recognition program. To do that I downloaded 400MB of data from TIMIT. When I inteded to read the wav files (I tried two libraries) as follow:
import scipy.io.wavfile as wavfile
import wave
(fs, x) = wavfile.read('../data/TIMIT/TRAIN/DR1/FCJF0/SA1.WAV')
w = wave.open('../data/TIMIT/TRAIN/DR1/FCJF0/SA1.WAV')
在两种情况下,它们都存在wav文件格式为"NIST"且必须为"RIFF"格式的问题. (我也读过有关sph的信息,但是我下载的nist文件是.wav,而不是.sph).
In both cases they have the problem that the wav file format says 'NIST' and it must be in 'RIFF' format. (Something about sph also I readed but the nist file I donwloaded are .wav, not .sph).
我从 http://sox.sourceforge.net/下载了SOX 我将路径正确添加到环境变量中,以便我的cmd识别sox.但是我真的找不到如何正确使用它.
I downloaded then SOX from http://sox.sourceforge.net/ I added the path correctly to my enviromental variables so that my cmd recognize sox. But I can't really find how to use it correctly.
我现在需要的是脚本或某种东西,可以使sox将某些wav文件格式从NIST更改为RIFF在某些文件夹和子文件夹下.
What I need now is a script or something to make sox change EVERY wav file format from NIST to RIFF under certain folder and subfolder.
在中从python的TIMIT数据库中读取WAV文件我找到了对我有用的回复...
运行sph2pipe -f wav input.wav output.wav
我需要的是脚本或在文件夹下搜索的东西,所有包含.wav文件的子文件夹都适用于该行代码.
in reading a WAV file from TIMIT database in python I found a response that worked for me...
Running sph2pipe -f wav input.wav output.wav
What I need is a script or something that searches under a folder, all subfolders that contain a .wav file to apply that line of code.
推荐答案
好,我终于明白了.转到上方的文件夹并运行以下代码:
Ok, I got it finally. Go to the upper folder and run this code:
forfiles /s /m *.wav /c "cmd /c sph2pipe -f wav @file @fnameRIFF.wav"
此代码搜索每个文件,并使其可用于python库.希望对您有帮助!
This code searches for every file and make it readble for the python libs. Hope it helps!
这篇关于将大量数据从NIST更改为RIFF WAV文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!