How to extract information from sound files
조회 수: 9 (최근 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!