function seg = dilate_seg( seg, dilation_sec, t_min, t_max, small_time )

  if nargin < 2
    error( [ mfilename ' needs at least 2 input argument.' ] );
  end

  % Something to do?

  if isempty( seg )
    return;
  end
  
  if size( seg, 1 ) ~= 2
    error( [ mfilename ' needs a 2-row matrix for "seg" (speech segments only, row 1: start times, row 2: finish times).' ] );
  end

  if ~exist( 't_min', 'var' )
    t_min = -Inf;
  end

  if ~exist( 't_max', 'var' )
    t_max = +Inf;
  end
  
  if ~exist( 'small_time', 'var' )
    small_time = 1e-10;
  end

  % Do it!

  % Dilate towards the past
  seg( 1,: ) = max( t_min, max( seg( 1,: ) - dilation_sec, [ -Inf seg( 2, 1:end-1 ) ] ) );

  % Dilate towards the future
  seg( 2,: ) = min( t_max, min( seg( 2,: ) + dilation_sec, [ seg( 1, 2:end ) +Inf ] ) );

  % Simplify
  seg = simplify_seg( seg, small_time );
  