function [span,jump]=windowparams(sz,frame,hop,width,opts)
% windowparams - compute windowing parameters to get buffers of a certain size
%
% windowparams :: 
%    [[1,2]]     ~ 'size of signal [channels,length]',
%    natural	 ~ 'desired frame length',
%    natural    ~ 'desired hop per frame',
%    natural|[] ~ 'desired number of frames per buffer or [] for all',
%    options {
%       natural : jump/[] ~'override window jump'
%    }
% -> natural    ~ 'recommended window span',
%    natural    ~ 'recommended window jump'.

	channels = sz(1);
	length   = sz(2);

	if isempty(width) 
		width=channels*(floor((length-frame)/hop)+1); 
	end

	span = (hop*(width-1)+frame)/channels;	
	jump = (hop*width)/channels;

	if nargin>4 && isfield(opts,'jump'), jump = channels*hop*opts.jump; end


