Mel-Scale Filterbank

MATLAB-specific help discussions.

Mel-Scale Filterbank

Postby Nightwingvyse » Wed Nov 03, 2010 8:06 pm

I need to code a Mel-Scale filterbank to display audio files as a spectrogram. It needs twenty filters, and will be applied to audio files of a 16kHz sample rate, so the highest frequency in them is ~8kHz. I understand and am familiar with the concepts and mathematics behind it all, but i'm just awful at coding. I'm ok at changing existing code to suit my needs, but am not too great at writing it from scratch. I'd just like some general help with it.

I had a short go at it earlier. This is what i got: (the comments are for you to read)

N = 20; %I've initiated the number of filters, N, to 20.

fs = 16000; %Set the sampling rate to match the audio files.
%Not sure if this is needed, or whether i could take this straight from where i've read in %the audio file.

Maxf = fs/2; %Maximum linear frequency half of the sampling rate due to sampling %theory.

Lin = Maxf/N;% Gives linear increment of the 20 filters.

MaxMelf = Lin-Mel(Maxf); %Uses function Lin-Mel to convert maximum linear frequency
%to maximum Mel frequency.
%Does Lin-Mel even need to be a separate function file, or should i just convert it here
%with 2595*log10(1+(Maxf/700)) ?

MelIncrement = MaxMelf/(N+1); %divides the maximum Mel frequency by 21 so the
%centre points of each of the 20 filters can be placed (not including the 21st increment
%at the top end of the frequency sectrum)

MelFilters = (1:N); %Makes a list of numbers from 1 to 20.

MelCentres = MelFilters .* MelIncrement; %This is MEANT to multiply each value in
%MelFilters by MelIncrement to give a list of the twenty filter centre points on the Mel
%scale (assuming this is the right way to do it). This is where it goes wrong. I can't
%remember what this actually returns, but it's not what was intended.

This was as far as i got. I'm sure i have it critically wrong somewhere, but is it on the right track? And can anyone help me finish it. I don't want anybody to code it for me, as i need to understand it for what i'm doing with it later, but i really need to be talked to like an idiot where coding is concerned.

Thanks in advance.
Nightwingvyse
 
Posts: 1
Joined: Wed Nov 03, 2010 8:03 pm

Return to MATLAB Help

Who is online

Users browsing this forum: No registered users and 2 guests