How do I perform clustering of audio signal?
7 次查看(过去 30 天)
显示 更早的评论
<<
<<
<<
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/159560/image.jpeg)
>>
>>
>>
I want to perform clustering of audio signal in matlab. If I use the matlab function of spectrogram it results in 3D data. How do I perform clustering on such data? So far I have generated spectrograms from my noise (reference) and original audio signal. The code is below:
%clear, clc, close all
glas=audioread('glas-11025.wav');
noise=audioread('noise-11025.wav');
windowSize=1024;
% get a section of the sound file
[x1, fs1] = audioread('glas-11025.wav'); % read the file
x1 = x1(:, 1); % get the first channel
N = length(x1); % signal length
t1 = (0:N-1)/fs1; % time vector
% plot the signal spectrogram
figure()
[S,F,T]=spectrogram(x1, windowSize, 3/4*windowSize, [], fs1, 'yaxis');
spectrogram(x1, windowSize, 3/4*windowSize, [], fs1, 'yaxis');
grid on
set(gca, 'FontName', 'Times New Roman', 'FontSize', 14)
xlabel('Time, s')
ylabel('Frequency, Hz')
title(['Spectrogram of the signal glas (' num2str(windowSize) ' window)']);
h = colorbar;
set(h, 'FontName', 'Times New Roman', 'FontSize', 14)
ylabel(h, 'Magnitude, dB')
% Noise
[x2, fs2] = audioread('noise-11025.wav'); % read the file
x2 = x2(:, 1); % get the first channel
N = length(x2); % signal length
t2 = (0:N-1)/fs2; % time vector
% plot the signal spectrogram
figure()
[S2,F2,T2]=spectrogram(x2, windowSize, 3/4*windowSize, [], fs2, 'yaxis');
spectrogram(x2, windowSize, 3/4*windowSize, [], fs2, 'yaxis');
grid on
set(gca, 'FontName', 'Times New Roman', 'FontSize', 14)
xlabel('Time, s')
ylabel('Frequency, Hz')
title(['Spectrogram of the signal noise (' num2str(windowSize) ' window)']);
h = colorbar;
set(h, 'FontName', 'Times New Roman', 'FontSize', 14)
ylabel(h, 'Magnitude, dB')
5 个评论
Image Analyst
2017-1-8
I have no idea what you'd want to cluster in that spectrum. If you want to separate noise from signal then why not use a weiner filter or ICA http://research.ics.aalto.fi/ica/icademo/ ?
回答(1 个)
Image Analyst
2017-1-8
That's what ICA and BSS were made for. If you know the spectrum of the noise though, you can use a wiener filter. Or if you know the noise and signal occur in different regions of the spectrum, you can do a high pass, low pass, or band pass filter. Perhaps you can figure it out by examining the spectra with and without noise, like maybe subtract the spectra to see which frequencies are different.
2 个评论
Edward Oakeley
2017-12-6
Hi, I actually have almost exactly the same problem.
As you seem to have answered your own question, I was wondering if you could share the solution for how you solved the clustering problem.
Also, as you are using an FFT, I assume that the time component is lost so you will not be able to determine the order of the sound clusters only the frequency of clusters within your data. Are you doing a sliding window? Have you considered some kind of wavelet analysis rather than FFT?
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spectral Estimation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!