store_frame_OLA   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/libs/contrib/TSM_library.xtm

Implementation

;--------------------------------------------------------------------------------------------------------------------
;Overlap-Add
;This is only included for demonstration purposes, and whacky effects.
;This is the most basic of algorithms for time stretching, and modifies the pitch as well as time.
;Could include applying a window function.
;If the sample_Sa calculation is set to be the same as every other method, the stereo field signal will flip back and forth.
;--------------------------------------------------------------------------------------------------------------------
(bind-func store_frame_OLA
  (lambda (window_size:i64)
  (let ((read_head:i64 0)
        (write_head:i64 0))
    (lambda (input_buffer:float* in_size:i64 output_buffer:float* out_size:i64 Sa:i64 Ss:i64)
      (let ((n:i64 0)
            (window_buffer:float* (salloc window_size)))
        (dotimes (n window_size)
          (pset! window_buffer n (* 0.5 (pref input_buffer (% (+ n read_head) in_size)))))
        (set! read_head (% (+ read_head Sa ) in_size))   ;Advance the playhead by the Analysis hopsize
        (dotimes (n window_size)  ;Overlap-Add section
          (cond ((< n (- window_size Ss))
                  (pset! output_buffer (% (+ write_head n) out_size) (+ (pref window_buffer n)
                                                                     (pref output_buffer (% (+ write_head n) out_size)))))
                (else
                  (pset! output_buffer (% (+  write_head n) out_size) (pref window_buffer n)))))
        (set! write_head (% (+ write_head Ss ) out_size))
        (set! TSM_active 1)
        void
        )))))


Back to Index

Similar Entries

  • Complex_multiplication_polar    xtlang
  • Cpolar    xtlang
  • TSM_TIM_OLA    xtlang
  • draw_color_body_frame    xtlang
  • draw_color_body_frame_with_hands    xtlang
  • draw_frame    xtlang
  • draw_frame    xtlang
  • draw_frame    xtlang
  • draw_rgb_frame    xtlang
  • get_focused_frame    xtlang
  • get_frame    xtlang
  • get_frame_byident    xtlang
  • get_frame_count    xtlang
  • get_frame_identifiers    xtlang
  • get_frame_names    xtlang
  • get_main_frame    xtlang
  • glfw_get_framebuffer_height    xtlang
  • glfw_get_framebuffer_width    xtlang
  • ndiff_extrapolated    xtlang
  • read_and_write_frame    xtlang
  • sf_frames    xtlang
  • sf_frames_from_file    xtlang
  • sf_set_frames    xtlang
  • store_frame_PV    xtlang
  • store_frame_iPL    xtlang
  • store_frame_sPL    xtlang
  • vcframe    scheme
  • xtm_frame_data_to_tex    xtlang