リアルタイムで取り込んだ音声信号をFFT化を行ったデータをcsvに保存する方法を教えてほしいです。
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
リアルタイムにて音声を入力を行い、timescopeを用いて波形を表示させ、SpectrumAnalyzerを使いスペクトルを表示させるプログラムをAudio Test Bench をもちいて作成しました。(SpectrumAnalyzerを最新のものに入れ替える)
そして、スペクトルのデータをmat保存しました。(ピーク時のデータのみ)ここまでのプログラミングを載せておきます。
理想的には上記のようなものを作成したいと考えております。
matファイルではなくcsvファイルにて保存の方法をご教授お願います。簡単な内容で申し訳ありませんがよろしくお願いします。
0 commentaires
Réponse acceptée
Kojiro Saito
le 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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Measurements and Spatial Audio dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!