  function v = MakeCall(TeleNum,ButtonDuration,a,b,noiseVal)
% Generates a signal for the telephone number specified
%   by the array TeleNum. Thus, [1 6 0 7 1 2 3 4 5 6 7]
%   would be the input encoding for 1-607-123-4567.
% The tone for a given  button push will last ButtonDuration seconds.
% The gap (in seconds) between button pushes is randomly
%    selected from the interval [a,b].
% The "true" signal is contaminated with noise at the level
%    of noiseVal*randn 
% 
% Sampling rate. This many numbers/sec in the digital signal:  
  Fs = 32768;
  
% Duration of the tone is .10 sec. So these are the sample times...
  t = 0:(1/Fs):.10;
  
% The touchpad frequencies for the rows...
  fR = [ 697  770  852  941];
  
% The touchpad frequencies for the columns...
  fC = [ 1209  1336  1477];
 
  k = length(TeleNum);
 
% Silence for .05 seconds at the start...
  v =  zeros(1,floor(Fs*.05));;
  for j=1:k
%     "Add in" the signal for the k-th button push..
      [row,col] = FindButton(TeleNum(j));
      y = (sin(2*pi*fR(row)*t) + sin(2*pi*fC(col)*t) )/2;
      v = [v y];
%     The in-between button gap...
      gap = zeros(1,floor(  Fs*(a+(b-a)*rand)    )  );
      v = [v gap];
  end
% Contaminate the whole signal with noise...
  L = length(v);
  v = v + noiseVal*randn(1,L);


  function [row,col] = FindButton(i)
% Determines the row and column indices of the button for digit i
  if i==0
      row = 4; col = 2;
  else
      row = ceil(i/3);
      col = i-3*(row-1);
  end

