リアルタイムで取り込んだ音声信号をFFT化を行ったデータをcsvに保存する方法を教えてほしいです。
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
一秀 近藤
am 21 Sep. 2022
Kommentiert: 一秀 近藤
am 30 Sep. 2022
リアルタイムにて音声を入力を行い、timescopeを用いて波形を表示させ、SpectrumAnalyzerを使いスペクトルを表示させるプログラムをAudio Test Bench をもちいて作成しました。(SpectrumAnalyzerを最新のものに入れ替える)
そして、スペクトルのデータをmat保存しました。(ピーク時のデータのみ)ここまでのプログラミングを載せておきます。
理想的には上記のようなものを作成したいと考えております。
matファイルではなくcsvファイルにて保存の方法をご教授お願います。簡単な内容で申し訳ありませんがよろしくお願いします。
0 Kommentare
Akzeptierte Antwort
Kojiro Saito
am 24 Sep. 2022
出力したいスペクトルデータ(data)がテーブル型なので、CSVへのファイル保存は相性が良いです。
PeakFinder列が構造体(struct)になっていて、このまま書き込むと列が空になってしまうので、下記のように一旦構造体をセルにしてから格納し直してCSVに出力できます。
%save data.mat
% ←最後にdataをMATファイルに保存
% PeakFinderの構造体をセルに変換
tempTable = struct2cell(data.PeakFinder)';
% 元のデータに格納
data.PeakFinderFrequency = tempTable(:, 1);
data.PeakFinderValue = tempTable(:, 2);
% 元のPeakFinder列を削除
data.PeakFinder = [];
% CSVで書き込み
writetable(data, 'data.csv')
6 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Audio Processing Algorithm Design finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!