function y = bell(fc, fm, I0, tau, dur, fs);
% BELL FM Bell instrument
% Y = BELL(FC, FM, I0, TAU, DUR, FS) where 
%   FC is the carrier frequency, 
%   FM is the frequency of the modulator, 
%   IO is the index of modulation, 
%   TAU is the time constant (time to decay by 1/e), 
%   DUR is the duration of the note in seconds
%   FS is the sampling rate.
%   Example usage:
%   y = bell(110, 220, 10, 2, 6, 44100);
%   y = bell(220, 440 5, 2, 6, 44100);
%   y = bell(110, 220, 10, 12, 3, 44100);
%   y = bell(110, 220, 10, 0.3, 3, 44100);
%   y = bell(250, 350, 5, 2, 5, 44100);
%   y = bell(250, 350, 3, 1, 5, 44100);

if nargin < 6
disp('Too few arguments');
end

if nargin > 6
disp('Too many arguments');
end

nT = 0:1/fs:dur-1/fs;
phim = 0;
phic = 0;

A = exp(-nT./tau);
I = I0*exp(-nT./tau);

y = A.*cos(2*pi*fc*nT + I.*cos(2*pi*fm*nT + phim) + phic);

