mag_spectrum   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/examples/contrib/spectral_meter.xtm

Implementation

;; take the time_domain signal (time_buffer) and return the spectrum
(bind-func mag_spectrum
  (let ((nbins 512) ; number of bins for spectrogram
        (spectrum:double* (zalloc nbins))
        (i:i64 0))
    (lambda (audio:double* fft_window_size time_buffer freq_buffer)
      (dotimes (i fft_window_size)
        ;; add sum of L and R channels into real component
        ;; of time_buffer (which is a buffer of complex values
        (tset! (pref-ptr time_buffer i) 0
               (+ (pref audio (* 2 i)) ; L channel
                  (pref audio (+ 1 (* 2 i)))))) ; R channel
      ;; take DFT, store results in freq_buffer
      (fft_cpxd time_buffer freq_buffer fft_window_size)
      (bin_spectrum spectrum freq_buffer fft_window_size nbins))))


Back to Index

Similar Entries

  • Cimag    xtlang
  • Cmag    xtlang
  • Complex_mag    xtlang
  • Complex_mag    xtlang
  • GSL_IMAG    xtlang
  • GSL_SET_IMAG    xtlang
  • Texture_bind_image    xtlang
  • biSizeImage    xtlang
  • bin_spectrum    xtlang
  • cairo_draw_image    xtlang
  • draw_spectrum_key    xtlang
  • fits-image-data-R32    xtlang
  • fits-image-data-R32    xtlang
  • fits-image-data-RGBA32    xtlang
  • fits-image-data-RGBA32    xtlang
  • fits-image-data-RGBA32-false    xtlang
  • fits-image-data-RGBA32-false    xtlang
  • fits-image-x    xtlang
  • fits-image-x    xtlang
  • fits-image-y    xtlang
  • fits-image-y    xtlang
  • fits-image-z    xtlang
  • fits-image-z    xtlang
  • free_image    xtlang
  • gl_load_image    xtlang
  • gl_load_image_rect    xtlang
  • magnitude    xtlang
  • spectrum-animation    scheme
  • spectrum_visualiser    xtlang
  • vmag    xtlang
  • vmag    xtlang
  • xtm_create_vgimage    xtlang
  • xtm_destroy_vgimage    xtlang
  • xtm_draw_vgimage    xtlang
  • xtm_load_vgimage    xtlang
  • xtm_scale_and_draw_vgimage    xtlang
  • xtm_scale_and_draw_vgimaged    xtlang
  • xtm_set_vgimage_subdata    xtlang
  • xtm_vgimage_rotate    xtlang
  • xtm_vgimage_rotated    xtlang
  • xtm_vgimage_scale    xtlang
  • xtm_vgimage_scaled    xtlang
  • xtm_vgimage_shear    xtlang
  • xtm_vgimage_sheard    xtlang
  • xtm_vgimage_translate    xtlang
  • xtm_vgimage_translated    xtlang