% cqedges - Audio Spectrum linear to log frequency map (no checking)
%
% cqedges ::
%    real     ~ 'sampling rate',
%    [[2]]    ~ 'requested lower and upper cut-off frequencies',
%    real     ~ 'resolution in octaves',
%    real     ~ 'origin of frequency grid in Hz (defaut=1kHz)'
% -> [[L-1]]  ~ 'frequency bin edges'.
% 
% Converts a constant-Q filterbank specification into a list of band edges.

function edges=cqedges(fs,range,res,F0)
	% origin of frequnecy grid defaults to 1kHz
	if nargin<4, F0=1000; end

	% quantise requested edges and represent them in
	% in units of res on a log frequency scale.
	limits = round(log2(range/F0)/res);

	% convert to normalised frequencies (fs=1)
	edges = (F0/fs)*2.^(res*(limits(1):limits(2)));
keyboard

	% remove any edges above Nyquist rate
	if edges(end)>=0.5, edges = edges(edges<0.5); end
end
