         file-sample-rate     (.getSampleRate base-file-format)]
     file-sample-rate))
 
-(defn extract-fundemental-frequency [wave-data block-size sample-rate]
+(defn extract-fundemental-frequency
+  [wave-data block-size sample-rate]
     (let [r (double-array 1)]
       (xtract/xtract_wavelet_f0 wave-data block-size (xtract-args sample-rate) r)
       (first r)))
 
 (defn extract-spectrum
+  "Extract frequency domain spectrum from time domain signal"
   ([windowed-data block-size sample-ratio spectrum-type]
    (extract-spectrum windowed-data block-size sample-ratio spectrum-type 0.0 0.0))
   ([windowed-data block-size sample-ratio spectrum-type db-component normalised]

  (let [windowed (c-double block-size)]
    (xtract/xtract_windowed wave-data block-size (xtract/doublea_to_voidp full-window) windowed)
    (xtract/xtract_init_fft block-size xtract-spectrum)

    (let [spectrum (extract-spectrum windowed block-size (/ sample-rate block-size) xtract-spectrum-magnitude)]
      (xtract/xtract_free_fft)
      (xtract/delete_double_array windowed)

                                 peaks)
    peaks))

(defn extract-rms-amp
  "Extract the RMS amplitude"
  [wav-data block-size sample-ratio]
  (let [rms (double-array 1)]
    (xtract/xtract_rms_amplitude wav-data block-size (xtract-args sample-ratio) rms)
    rms))

(defn raise-errors [result]
    (cond
      (= result xtract-success)        true
