function filterBasis = createBPFilters(maxFreq,nbBandPassFilters,fftSize,factor)
melfreq = linspace(0,2595*log10(1 + maxFreq/700),nbBandPassFilters);
hertzfreq = 700*(10.^(melfreq/2595)-1);

filterBasis = zeros(fftSize/2+1,nbBandPassFilters);
mid = floor(hertzfreq(1)*factor+1);
last = floor(hertzfreq(2)*factor+1);
if (mid~=last)
    
    filterBasis(mid:last,1) = 1:-1/(last-mid):0;
    for ind = 1:length(hertzfreq) -2
        first = floor(hertzfreq(ind)*factor+1);
        mid = floor(hertzfreq(ind+1)*factor+1);
        last = floor(hertzfreq(ind +2)*factor+1);
        filterBasis(first:mid,ind+1) = 0:1/(mid-first):1;
        filterBasis(mid:last,ind+1) = 1:-1/(last-mid):0;
    end
    first = floor(hertzfreq(end-1)*factor+1);
    mid = floor(hertzfreq(end)*factor+1);
    filterBasis(first:mid,end) = 0:1/(mid-first):1;
% else
%     error('myApp:filterSize', 'Too many filters for parameters')
end