Continuous Spectrogram from multiple wav files.

Hello all,
I have been scouring the existing online help but cant seem to find exactly what I’m after. I have a folder with hundreds of 4 min wav files and want to produce a single spectrogram which contains them all. My initial thinking was to read in all wav files and somehow join them into one large file to later put into a spectrogram. Any help would be great appreciated!
Thanks,
Thomas

 採用された回答

Stijn Haenen
Stijn Haenen 2020 年 5 月 19 日

0 投票

Something like this:
data_tot=[];
>> for i=1:numel(files)
data=audioread(files(i));
data_tot=[data_tot ; data];
end
audiowrite('file.wav',data_tot,Fs);

3 件のコメント

Thomas Webber
Thomas Webber 2020 年 5 月 19 日
Hi Stijn,
Thanks for this, would you know of anyway to account for the length of files not being exactly equal? The exact number of samples in each wav file differ slightly, which is throwing up the error:
"Error using horzcat
Dimensions of arrays being concatenated are not consistent."
Thanks,
Stijn Haenen
Stijn Haenen 2020 年 5 月 19 日
編集済み: Stijn Haenen 2020 年 5 月 19 日
you have to make colomns from your data, you can add some lines to do this:
data_tot=[];
>> for i=1:numel(files)
data=audioread(files(i));
if size(data,1)<2
data=data';
end
data_tot=[data_tot ; data];
end
audiowrite('file.wav',data_tot,Fs);
and you have to check whether all your files are single audio files or double (left and right audio).
Thomas Webber
Thomas Webber 2020 年 5 月 19 日
Thats wonderful, thankyou for your help!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeTime-Frequency Analysis についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by