bin_spectrum   xtlang


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

Implementation

;; take a frequency domain signal (freq_buffer) of length N, and return the
;; average magnitude in n bins (with n < N)
(bind-func bin_spectrum
  (let ((i:i64 0)
        (j:i64 0)
        (total 0.0))
    (lambda (spectrum:double* freq_buffer fft_window_size nbins)
      (let ((bin_width (/ (/ fft_window_size nbins) 2)))
        (dotimes (i nbins)
          (set! total 0.0)
          (dotimes (j (* i bin_width) bin_width)
            (set! total (+ total (magnitude_cpxd (pref-ptr freq_buffer j)))))
          (pset! spectrum i (* 1.0 (/ total (i64tod bin_width)))))))))


Back to Index

Similar Entries

  • LR_combine    xtlang
  • Texture_bind_data    xtlang
  • Texture_bind_data    xtlang
  • Texture_bind_image    xtlang
  • VAO_bind_and_draw_arrays    xtlang
  • VAO_bind_attribute    xtlang
  • VAO_bind_attribute    xtlang
  • _playbin_bus_call:GstBusFunc    xtlang
  • bind    xtlang
  • bind    xtlang
  • bind    xtlang
  • bind-alias    macro
  • bind-closure    macro
  • bind-data    macro
  • bind-data-constructors    scheme
  • bind-data-deconstructors    scheme
  • bind-data-deconstructors-macros    scheme
  • bind-data-getters    scheme
  • bind-data-type    scheme
  • bind-data-type-constructor    scheme
  • bind-data-types    scheme
  • bind-dylib    macro
  • bind-ext-val    macro
  • bind-external-dylib-declarations    scheme
  • bind-func    macro
  • bind-func-ipc    scheme
  • bind-gl-proc    macro
  • bind-glew    macro
  • bind-lib    macro
  • bind-lib-func    macro
  • bind-lib-type    macro
  • bind-lib-val    macro
  • bind-lib-xtm-get-string    macro
  • bind-macro    macro
  • bind-method    macro
  • bind-object    macro
  • bind-poly    macro
  • bind-static    macro
  • bind-type    macro
  • bind-val    macro
  • bind-wrapper    macro
  • bind_cube    xtlang
  • bindfunc    xtlang
  • bindfunc_with_docstring    xtlang
  • bindfunc_with_zone_size    xtlang
  • bindfunc_with_zone_size_and_docstring    xtlang
  • binomial    macro
  • combinations    scheme
  • combinations    scheme
  • cpBBIntersects    xtlang
  • cpBBIntersectsSegment    xtlang
  • draw_spectrum_key    xtlang
  • godot_method_bind_call    xtlang
  • godot_method_bind_get_method    xtlang
  • godot_method_bind_ptrcall    xtlang
  • impc:aot:insert-closure-binding-details    scheme
  • impc:aot:insert-ext-globalvar-binding-details    scheme
  • impc:aot:insert-gl-proc-binding-details    scheme
  • impc:aot:insert-globalvar-binding-details    scheme
  • impc:aot:insert-namedtype-binding-details    scheme
  • impc:aot:insert-nativefunc-binding-details    scheme
  • impc:aot:insert-polyfunc-binding-details    scheme
  • impc:aot:insert-static-binding-details    scheme
  • impc:aot:insert-typealias-binding-details    scheme
  • impc:aot:insert-xtmacro-binding-details    scheme
  • impc:compiler:print-bind-func-details-to-log    scheme
  • impc:compiler:print-binding-details-to-log    scheme
  • impc:compiler:print-lib-binding-details-to-log    scheme
  • impc:ti:binary-arity    scheme
  • impc:ti:binary-arity    scheme
  • impc:ti:bind-dylib    scheme
  • impc:ti:bind-lib    scheme
  • ipc:bind-func    scheme
  • ipc:bind-xtmrender-vars    scheme
  • mag_spectrum    xtlang
  • match-result:bind    scheme
  • multi-list-combination    scheme
  • multi-list-combination-2    scheme
  • nnsock_bind    xtlang
  • playbin_bus_call    xtlang
  • playbin_bus_call:GstBusFunc    xtlang
  • plet-make-bindings    scheme
  • spectrum-animation    scheme
  • spectrum_visualiser    xtlang
  • unbind    xtlang
  • unbind    xtlang
  • unbind    xtlang
  • unbind-func    macro
  • unbind_cube    xtlang
  • unbind_cube    xtlang