function out_signal = fix_melody(signal);
%function out_signal = fix_melody(signal);
%
%  FIX_MELODY  --  Uses the DFT to removes the corrupting note from the "melody"
%
%  Input Parameters:
%    signal      --  the "melody" signal
%
%  Output Parameters:
%    out_signal  --  the "fixed" melody signal
%


% Make sure the input signal is a column vector
signal = signal(:);

% "zc" should contain the DFT coefficient numbers that we wish to zero out
zc = [ ? ];

% Intialize the output signal
out_signal = [];

% For each note...
for i=1:12
    
    % Compute the DFT
    dft = fft(signal((i-1)*4096 + (1:4096)))/4096;

    % Zero out the appropriate coefficients
    dft(1+zc) = 0;
    
    % Build the output signal 
    out_signal = [out_signal; ifft(dft)*4096];
end

% Make sure the resulting signal is real
out_signal = real(out_signal);
