How to extract information from sound files
5 ビュー (過去 30 日間)
古いコメントを表示
I have a .wav file. When listening to this file, I can hear a tone then a beep then a tone and this repeats over 1000 times (tone1 - beep1 - tone2 -beep2.....) I want to get separate these. So I want to create separate .wav files for each tone-beep pair such that file1= tone1-beep1, file2 = tone2-beep2 etc. I have no idea where to even begin. Any help will be greatly appreciated
0 件のコメント
採用された回答
Image Analyst
2014 年 12 月 7 日
If the beep-tone pairs always take the same number of elements, can't you just use reshape() to put each stretch into its own row of a 2D matrix?
% Open standard demo sound that ships with MATLAB.
[theSound, freq] = audioread('guitartune.wav');
numberOfElements = length(theSound);
shortLength = numberOfElements/5;
fprintf('The sound has %d elements.\n', length(theSound));
promptMessage = sprintf('Do you want to play the original sound?');
titleBarCaption = 'Continue?';
button = questdlg(promptMessage, titleBarCaption, 'Yes', 'No', 'Yes');
if strcmpi(button, 'Yes')
% Play the original sound of 661,500 elements.
soundsc(theSound, freq);
end
promptMessage = sprintf('Do you want to play the short sound?');
titleBarCaption = 'Continue?';
button = questdlg(promptMessage, titleBarCaption, 'Yes', 'No', 'Yes');
if strcmpi(button, 'No')
return;
end
% Reshape into 5 rows of 132,300 elements.
soundSegments2D = reshape(theSound, [5, shortLength]);
% Play the sound from row #1
soundsc(soundSegments2D(1, :), freq/5);
0 件のコメント
その他の回答 (1 件)
Star Strider
2014 年 12 月 6 日
I would begin with the Signal Processing Toolbox spectrogram function. That will give you a visual representation of the frequencies and the times they occur. You may have to adjust its parameters to get the resolution you want, considering the number and time density of the tones and beeps, but it should give you some idea.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Audio and Video Data についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!