在matlab中阅读wav段

时间:2016-05-20 17:38:29

标签: matlab wav

如何在Matlab中读取使用htk mlf文件生成的特定音素。我想在MLF文件中访问音素的特定持续时间。例如,如果音素片段为200000 800000 dh,我想在0.2 ms到0.8 ms读取波形文件

2 个答案:

答案 0 :(得分:1)

您可以read the file as a whole,并剪切您需要的细分

[signal, fs] = wavread('file.wav')

start_sample = fs * 200000 / 1000000
end_sample = fs * 800000  / 1000000

phoneme_signal = signal(start_sample:end_sample)

如果您已知道频率,也可以在wavread中指定范围:

start_sample = fs * 200000 / 1000000
end_sample = fs * 800000  / 1000000

[phoneme_signal, fs] = wavread('file.wav', [start_sample, end_sample])

答案 1 :(得分:1)

您可以使用提供audioread参数的samples函数,让您指定要获取的信号的开头和结尾:

% Suppose 'Fs' is the sampling frequency %
begin = 2^(-5) * Fs;
end = 8^(-5) * Fs;
[signal, fs] = audioread('file.wav', [begin,end]);