How do I perform clustering of audio signal?

6 Ansichten (letzte 30 Tage)
Ahmad Adee
Ahmad Adee am 6 Jan. 2017
Kommentiert: Edward Oakeley am 6 Dez. 2017
<<
<<
<<
>>
>>
>>
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 Kommentare
Image Analyst
Image Analyst am 8 Jan. 2017
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/ ?
Ahmad Adee
Ahmad Adee am 8 Jan. 2017
This is my target: An audio signal is given that contains 2 types of noises: a constant factory noise and an occasional “useful” signal. Apply windowed FFT to the signal, analyze its spectrogram and make a clustering of Fourier-based features in a sufficient number of clusters, to differentiate between different signals.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Image Analyst
Image Analyst am 8 Jan. 2017
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 Kommentare
Ahmad Adee
Ahmad Adee am 12 Jan. 2017
Thanks a lot. but again, my problem is to perform clustering of a signal into different categories of noise and useful signal, not to separate the noise. Now that i have done some clustering, I have to decide on how to choose the number of clusters and how to define different kinds of noise and signals in my code. I am attaching a picture of clusters i generated so far. Note: In the clustering below i just chose the number of clusters randomly.
Edward Oakeley
Edward Oakeley am 6 Dez. 2017
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?

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by