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    /digego/extempore/tree/v0.8.9/libs/contrib/gsl.xtm
  • Cmag    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/gsl.xtm
  • Complex_mag    xtlang    /digego/extempore/tree/v0.8.9/libs/core/math.xtm
  • Complex_mag    xtlang    /digego/extempore/tree/v0.8.9/libs/core/math.xtm
  • GSL_IMAG    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/gsl.xtm
  • GSL_SET_IMAG    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/gsl.xtm
  • Texture_bind_image    xtlang    /digego/extempore/tree/v0.8.9/libs/external/gl/gl-objects.xtm
  • biSizeImage    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/win32.xtm
  • bin_spectrum    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/spectral_meter.xtm
  • cairo_draw_image    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/drawing.xtm
  • draw_spectrum_key    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/spectral_meter.xtm
  • fits-image-data-R32    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/fitslib.xtm
  • fits-image-data-R32    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/fits.xtm
  • fits-image-data-RGBA32    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/fitslib.xtm
  • fits-image-data-RGBA32    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/fits.xtm
  • fits-image-data-RGBA32-false    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/fitslib.xtm
  • fits-image-data-RGBA32-false    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/fits.xtm
  • fits-image-x    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/fitslib.xtm
  • fits-image-x    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/fits.xtm
  • fits-image-y    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/fitslib.xtm
  • fits-image-y    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/fits.xtm
  • fits-image-z    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/fitslib.xtm
  • fits-image-z    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/fits.xtm
  • free_image    xtlang    /digego/extempore/tree/v0.8.9/libs/external/gl/gl-objects2.xtm
  • gl_load_image    xtlang    /digego/extempore/tree/v0.8.9/libs/external/soil.xtm
  • gl_load_image_rect    xtlang    /digego/extempore/tree/v0.8.9/libs/external/soil.xtm
  • magnitude    xtlang    /digego/extempore/tree/v0.8.9/libs/core/math_ext.xtm
  • spectrum-animation    scheme    /digego/extempore/tree/v0.8.9/examples/contrib/spectral_meter.xtm
  • spectrum_visualiser    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/spectral_meter.xtm
  • vmag    xtlang    /digego/extempore/tree/v0.8.9/libs/core/math.xtm
  • vmag    xtlang    /digego/extempore/tree/v0.8.9/libs/core/math.xtm
  • xtm_create_vgimage    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/openvg.xtm
  • xtm_destroy_vgimage    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/openvg.xtm
  • xtm_draw_vgimage    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/openvg.xtm
  • xtm_load_vgimage    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/openvg.xtm
  • xtm_scale_and_draw_vgimage    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/openvg.xtm
  • xtm_scale_and_draw_vgimaged    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/openvg.xtm
  • xtm_set_vgimage_subdata    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/openvg.xtm
  • xtm_vgimage_rotate    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/openvg.xtm
  • xtm_vgimage_rotated    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/openvg.xtm
  • xtm_vgimage_scale    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/openvg.xtm
  • xtm_vgimage_scaled    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/openvg.xtm
  • xtm_vgimage_shear    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/openvg.xtm
  • xtm_vgimage_sheard    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/openvg.xtm
  • xtm_vgimage_translate    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/openvg.xtm
  • xtm_vgimage_translated    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/openvg.xtm