1

ファイルの最初と最後の「相対的な」無音部分を削除してwavファイルの長さを計算し、ミリ秒単位で期間を返す必要があります。私はあなたがそのようにwavファイルの持続時間を見つけることができることを知っています:

[w,fs] = wavread('file.wav');
length = length(w)/fs;

私のロジックは、波形マトリックスの最初の列(左チャネル)を使用し、任意のしきい値を取得してから、サンプルウィンドウを介してマトリックスをトラバースすることです。これらのウィンドウの最大値がしきい値よりも大きい場合は、そこで時間をカウントし始めます。このウィンドウの最大値が値よりも小さい場合は、そこで停止します。これは私がこれまでに持っているものです:

%Just use the first column in the waveform matrix, 2 gives strange results
w = w(:,1);
%Get threshold value by multiplying max amplitude of waveform and
%predetermined percentage (this varies with testing)
thold = max(w) * .04;

サンプリングウィンドウを介してマトリックスを実際にトラバースする方法についてのヘルプが必要です。

4

1 に答える 1

0

I am not entirely certain what you want to achieve, but I think you can use your own suggestion (sort of):

soundIdx                      = find(abs(w) > thold)
total_time_w_sound            = sum(abs(w) > thold)/fs;
time_from_first_sound_to_last = (soundIdx(end)-soundIdx(1))/fs;

Is it one of those you are trying to find?

于 2013-03-19T12:39:36.107 に答える