title: Changing the inverse fast Fourier transform (ifft) to use an arbitrary waveform instead of sine waves to create a new signal
body: <p>I know that an inverse fast Fourier transform (ifft) sums multiple sine waves together from data obtain from doing an fft on a signal. <strong>Is there a way to create a signal using a new type of inverse fast Fourier transform (ifft) using an arbitrary waveform instead of just using sine waves?</strong></p>
  
  <p><strong>I'm not trying to re-create the original signal. I'm trying to create a new signal using a new type of inverse fast Fourier transform (ifft) using a given arbitrary waveform based on the (frequency, amplitude, phase) data calculated from the fft   from the source signal.</strong></p>
  
  <p>The arbitrary waveform is a sampled signal that will replace one period of the sine wave used in the fft. That is, the signal is to be scaled, repeated, and shifted according to the values given by the fft.</p>
  
  <p>See simple example below: the signals I will be applying FFT to are human audio signals about 60 seconds long at 44100 samples (large arrays) so <strong>I'm trying to see if I can use / alter the ifft command in some way to create a new signal using / based on an arbitrary waveform.</strong> </p>
  
  <p>PS: I'm using Octave 4.0 which is similar to Matlab and the arbitrary waveform signal used to create a new signal will be changed to create different signals.</p>
  
  <pre><code>clear all,clf reset, clc,tic
  
  fs=44100 % Sampling frequency
  len_of_sig=2; %length of signal in seconds
  t=linspace(0,2*pi*len_of_sig,fs*len_of_sig);
  afp=[.5,2.43,pi/9;.3,3,pi/2;.3,4.3,pi/3];  %represents Amplitude,frequency,phase data array
  
  %1 create source signal
  ya=0;
  for zz=1:size(afp,1)
    ya = ya+afp(zz,1)*sin(afp(zz,2)*t+afp(zz,3));
  end
  
  %2 create source frequency domain data
  ya_fft = fft(ya);
  
  %3 rebuild original source signal
  mag = abs(ya_fft);
  phase = unwrap(angle(ya_fft));
  ya_newifft=ifft(mag.*exp(i*phase));
  ifft_sig_combined_L1=ifft(mag.*exp(i*phase),length(ya_newifft)); 
  
  %4 %%%-----begin create arbitrary waveform to use ---- 
  gauss = @(t, t0, g) exp(-((t-t0)/g).^2); % a simple gaussian
  
  t_arbitrary=0:1:44100; % sampling
  t_arbitrary_1 = 10000; % pulses peak positions (s)
  t_arbitrary_2 = 30000; % pulses peak positions (s)
  
  g = 2000; % pulses width (at 1/e^2) (s)
  
  lilly = gauss(t_arbitrary, t_arbitrary_1, g) - (.57*gauss(t_arbitrary, t_arbitrary_2, g)); %different amplitude peaks
  %%%%-----End arbitrary waveform to use---- 
  
  %5 plot
  t_sec=t./(2*pi); %converts time in radians to seconds
  t_arbitrary_sec=t_arbitrary./length(lilly); %converts time in radians to seconds
  
  subplot(4,1,1);
  plot(t_sec,ya,'r')
  title('1) source signal')
  
  subplot(4,1,2);
  plot(t_sec,ifft_sig_combined_L1)
  title('2) rebuilt source signal using ifft')
  
  subplot(4,1,3);
  plot(t_arbitrary_sec,lilly,'r')
  title('3) arbitrary waveform used to create new signal')
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/cntek.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cntek.png" alt="Plot Updated"></a></p>
  
  <p>Added a work-flow chart below with simple signals to see if that explains it better:</p>
  
  <pre><code>Section 1) The audio signal is read into an array
  Section 2) FFT is done on the signal
  Section 3 Red) Normally Inverse FFT uses sin waves to rebuild the signal see signal in red
  Section 3 Blue) I want to use an arbitrary signal wave instead to rebuild the signal using the FFT data calculated in (Section 2)
  Section 4) New signals created using a new type of Inverse FFT (Section 3).
  Please note the new type of Inverse FFT final signal (in blue ) must use the FFT data taken from the original signal.
  The signal Sample rate tested should be 44100 and the length of the signal in seconds should be 57.3 seconds long.  I use these numbers to test that the array can handle large amounts and that the code can handle non even numbers in seconds.
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/OXXT3.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OXXT3.jpg" alt="Work-flow"></a></p>