1

移動する音源と静止した観測者を使用して線形運動測定を行っています。ここで説明: http://www.animations.physics.unsw.edu.au/labs/Doppler/doppler_lab.html

オーディオ ファイルで最大のパワーを持つ周波数のサンプル番号を取得する MATLAB スクリプトを作成する方法は?

4

1 に答える 1

3

必要なのは、時間-周波数ローカリゼーション情報です。これは、短時間フーリエ変換を使用して取得できます。他にも多くの時間周波数分析手法がありますが、STFT は最も単純であり、出発点として適しています。概念を理解するのに役立つ簡単なコードを次に示します。

% Parameters
Fs = 44100; % Sample rate (44100 Hz)
t = 0:1/Fs:5; % Time instances
t1 = 5; % End time of signal, 5 secs
f0 = 440; % frequency swiped from 440 Hz
f1 = 880; % to 880 Hz

% Signal generation
audio = chirp(t,f0,t1,f1);
% wavplay(audio,Fs) % to play the audio


% Signal analysis
window = 2050; % Should be minimum twice the maximum frequency we want to analyze
noverlap = 1025; % 50% overlap
nfft = 44100;

[S,F,T,P] = spectrogram(audio,window,noverlap,nfft,Fs); % Spectrogram takes the STFT of the signal
% P matrix contains the power spectral density of each segment of the STFT

% Plotting results
imagesc(real(S)) % frequency-time Plot of the signal
ylim([0 1000])
xlabel('Time (secs)')
ylabel('Frequency (Hz)')
title('Time-Frequency plot of a Audio signal')

サンプル数を取得するには、関心のある周波数が現れる時間インスタンスを見つけ、サンプリング周波数を使用してサンプル数を計算するだけです。

P はパワー スペクトル密度行列です。y 軸は周波数、x 軸は時間で、各瞬間における各周波数の電力がこの行列に格納されます。マトリックス全体で最も高い値を持つ要素が必要です。以下のようなコードが機能するはずです。

[maxElement, maxElementTimeIndex] = max(max(P, [], 1)); % max(P, [], 1) finds maximum power for each time instance, max(max(P,[],1)) finds maximum for the entire 2D matrix.
maxPoweredSampleInAudioSignal = (maxElementTimeIndex-1) * Fs; % This calculation is made within the limitations of STFT, so approximately here the maximum power for any frequency is present
于 2013-08-28T07:00:24.377 に答える