title: Conflicting results when computing an FFT using ARM DSP libraries and in MatLab
body: <p>I'm trying compute an FFT using an STM32L4 microprocessor but am getting strange results.
  I read in a .wav file from an SD card, remove the padding and store 1024 bytes of data in an array.
  I have confirmed that this data is correct by way of opening the same wav file in a hex editor on my pc.
  When i compute the FFT in MatLab and take the magnitude of it the frequency bin corresponding to the frequency of the input sine wave matches up. This is not the case in my C code (as seen in the Keil debugger i am using). 
  There is barely any correlation between the values given by the ARM DSP libraries and the values produced in MatLab, for an exmaple, bin[0] in MatLab = 5.2, bin[0] in C = 131246...Something's up! (See edit...)
  I've tried two different versions of the FFT and I'll include both of them below:</p>
  
  <pre><code>/* Carry out an FFT on the (correctly formatted) input data */
  arm_cfft_f32(&amp;arm_cfft_sR_f32_len1024, inputBuffer, IFFTFLAG, BRFLAG);
  /* Calculate the complex magnitude of the FFT */
  arm_cmplx_mag_f32(inputBuffer, outputBuffer, FFTSIZE);
  </code></pre>
  
  <p>The deprecated code:</p>
  
  <pre><code>arm_cfft_radix4_instance_f32 S;
  arm_cfft_radix4_init_f32(&amp;S, FFTSIZE, IFFTFLAG, BITREVERSEFLAG);
  arm_cfft_radix4_f32(&amp;S, inputBuffer);
  arm_cmplx_mag_f32(inputBuffer, outputBuffer, FFTSIZE);   
  </code></pre>
  
  <p>Both result in the same (wrong) values. All of the preprocessing done in C is correct, I form an array FFTSIZE * 2 in length arranged as:
  Re[0], Im[0], Re[1], Im[1],...,Re[1023], Im[1023].</p>
  
  <p>Any ideas or help would be much appreciated! 
  :)</p>
  
  <p>EDIT:
  I have realised that other than the DC bin, the values between the two computations are in fact correlated.
  i.e. for both computations bin 47 has the largest value (which makes sense since it's a 1kHz sine wave sampled at 22.05kHz). 
  Any ideas why the ARM DSP libraries are scaling the outputs of the bins so much?</p>