Main Content

このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。

Goertzel アルゴリズムを使用した DFT の推定

この例は、Goertzel 関数を使用して DFT ベースの DTMF 検出アルゴリズムを実装する方法を示します。

デュアルトーン マルチ周波数 (DTMF) 信号は、音声通信制御の基本であり、番号にダイヤルして交換局を設置する現代の電話技術において世界中で使われています。ボイス メールや、電子メール、テレフォン バンキングのようなシステムでも使われます。

DTMF トーンの生成

DTMF 信号は、周波数が互いに排他的な 2 つのグループから取得された 2 つの正弦波 (トーン) の和で構成されます。このような周波数は、受信機によって高調波が他の DTMF 周波数として間違って検出されるのを防ぐために使用されています。トーンの各ペアは、低群 (697 Hz、770 Hz、852 Hz、941 Hz) の 1 周波数と高群 (1209 Hz、1336 Hz、1477 Hz) の 1 周波数で構成され、固有のシンボルを表します。電話パッドのプッシュボタンに割り当てられている周波数は以下のとおりです。

電話パッドの各ボタンの DTMF 信号を生成してプロットします。各信号のサンプル レートは 8 kHz で持続時間は 100 ms です。

symbol = {'1','2','3','4','5','6','7','8','9','*','0','#'};
[tones, Fs, f, lfg, hfg] = helperDTMFToneGenerator(symbol, false);
helperDFTEstimationPlot1(tones, symbol, Fs, f);

Figure contains 12 axes objects. Axes object 1 with title Symbol "1": [697,1209], ylabel Amplitude contains an object of type line. Axes object 2 with title Symbol "2": [697,1336], ylabel Amplitude contains an object of type line. Axes object 3 with title Symbol "3": [697,1477], ylabel Amplitude contains an object of type line. Axes object 4 with title Symbol "4": [770,1209], ylabel Amplitude contains an object of type line. Axes object 5 with title Symbol "5": [770,1336], ylabel Amplitude contains an object of type line. Axes object 6 with title Symbol "6": [770,1477], ylabel Amplitude contains an object of type line. Axes object 7 with title Symbol "7": [852,1209], ylabel Amplitude contains an object of type line. Axes object 8 with title Symbol "8": [852,1336], ylabel Amplitude contains an object of type line. Axes object 9 with title Symbol "9": [852,1477], ylabel Amplitude contains an object of type line. Axes object 10 with title Symbol "*": [941,1209], xlabel Time (ms), ylabel Amplitude contains an object of type line. Axes object 11 with title Symbol "0": [941,1336], xlabel Time (ms), ylabel Amplitude contains an object of type line. Axes object 12 with title Symbol "#": [941,1477], xlabel Time (ms), ylabel Amplitude contains an object of type line.

DTMF トーンの再生

例として、電話番号 508-647-7000 に対応するトーンを再生します。シンボル "0" は 11 番目のトーンに対応します。

% To hear, uncomment these lines:

% for i = [5 11 8 6 4 7 7 11 11 11]
%     p = audioplayer(tones(:,i),Fs,16);
%     play(p)
%     pause(0.5)
% end

Goertzel アルゴリズムを使用した DTMF トーンの推定

ITU 規格で定義されている DTMF 信号の最小持続時間は 40 ms です。したがって、推定と検出に使用できるサンプル数は最大で 0.04 x 8000 = 320 サンプルです。このような短い信号に含まれている周波数を推定するには、DTMF 復号器が必要です。

この推定の問題に対する共通の対処方法は、7 つの基本トーンと非常に似ている離散時間フーリエ変換 (DFT) のサンプルを計算することです。DFT ベースの方法では、周波数領域で 205 サンプルを使用すると、元の周波数と DFT を推定したポイント間の誤差が最小になります。

Nt = 205;
original_f = [lfg(:);hfg(:)]  % Original frequencies
original_f = 7×1

         697
         770
         852
         941
        1209
        1336
        1477

k = round(original_f/Fs*Nt);  % Indices of the DFT
estim_f = round(k*Fs/Nt)      % Frequencies at which the DFT is estimated
estim_f = 7×1

         702
         780
         859
         937
        1210
        1327
        1483

元の周波数と DFT を推定したポイント間の誤差を最小にするため、トーンを打ち切り、以降の処理には 205 サンプルまたは 25.6 ms のみを維持します。

tones = tones(1:205,:);

ここで、高速フーリエ変換 (FFT) アルゴリズムを使用して、DFT を計算できますが、この状況では DFT を推定するポイント数が少ないことから Goertzel アルゴリズムがよく使用されます。この場合、Goertzel アルゴリズムは FFT アルゴリズムよりも効果的です。

for toneChoice = 1:12
    % Select tone
    tone = tones(:,toneChoice);
    % Estimate DFT using Goertzel
    ydft(:,toneChoice) = goertzel(tone,k+1); % Goertzel uses 1-based indexing   
end

各トーンの Goertzel の DFT 振幅の推定値を電話パッドに対応するグリッドにプロットします。

helperDFTEstimationPlot2(ydft,symbol,f, estim_f);

Figure contains 12 axes objects. Axes object 1 with title Symbol "1": [697,1209], ylabel DFT Magnitude contains an object of type stem. Axes object 2 with title Symbol "2": [697,1336], ylabel DFT Magnitude contains an object of type stem. Axes object 3 with title Symbol "3": [697,1477], ylabel DFT Magnitude contains an object of type stem. Axes object 4 with title Symbol "4": [770,1209], ylabel DFT Magnitude contains an object of type stem. Axes object 5 with title Symbol "5": [770,1336], ylabel DFT Magnitude contains an object of type stem. Axes object 6 with title Symbol "6": [770,1477], ylabel DFT Magnitude contains an object of type stem. Axes object 7 with title Symbol "7": [852,1209], ylabel DFT Magnitude contains an object of type stem. Axes object 8 with title Symbol "8": [852,1336], ylabel DFT Magnitude contains an object of type stem. Axes object 9 with title Symbol "9": [852,1477], ylabel DFT Magnitude contains an object of type stem. Axes object 10 with title Symbol "*": [941,1209], xlabel Frequency (Hz), ylabel DFT Magnitude contains an object of type stem. Axes object 11 with title Symbol "0": [941,1336], xlabel Frequency (Hz), ylabel DFT Magnitude contains an object of type stem. Axes object 12 with title Symbol "#": [941,1477], xlabel Frequency (Hz), ylabel DFT Magnitude contains an object of type stem.

DTMF トーンの検出

デジタル トーンは、上記で推定した 7 つの周波数に存在するエネルギーを測定して検出します。各シンボルは、低群周波数および高群周波数の最大エネルギー成分を使用して分けることができます。

付録

この例では次の補助関数が使用されています。

参考