% FUNCTION Y = FRAME_START(N_SAMPLES, FRAME_LENGTH, [FRAME_SHIFT])
%
% default frame_shift = frame_length/2
%
% Returns vector of first sample index of each frame (starts at 1).

function y = frame_start(n_samples, frame_length, frame_shift)

if ~exist('frame_shift', 'var') | isempty(frame_shift)
  frame_shift = floor(frame_length / 2);
end

n_frames = 1 + floor((n_samples - frame_length) / frame_shift);
y = 1 + frame_shift * (0:n_frames-1);
