store_frame_sPL   xtlang


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

Implementation

;This closure extracts a frame from the input buffer, and calls the TSM kernel
;This frame is then copied to the output buffer.
;Provided are 2 separate stereo versions of TSM processing.  The Mid side versions
;give the most accurate stereo image.  The standard LR version requires the least
;processing overhead, but quickly loses phase coherance between the channels.
(bind-func store_frame_sPL
  (lambda (window_size:i64)
  (let ((read_head:i64 0)
        (write_head:i64 0)
        ;(PV_left (phase_vocoder_sPL (/ window_size IN_CHANNELS)))
        ;(PV_right (phase_vocoder_sPL (/ window_size IN_CHANNELS)))
        (PV_mid (phase_vocoder_sPL (/ window_size 2))) ;replace 2 with IN_CHANNELS if using 0.7.0 release
        (PV_side (phase_vocoder_sPL (/ window_size 2)))) ;replace 2 with IN_CHANNELS if using 0.7.0 release
    (lambda (input_buffer:float* in_size:i64 output_buffer:float* out_size:i64 Sa:i64 Ss:i64)
      (let ((n:i64 0)
            (window_buffer_in:float* (salloc window_size))
            (window_buffer_out:float* (salloc window_size))
            (left_right_size:i64 (/ window_size 2)) ;replace 2 with IN_CHANNELS if using 0.7.0 release
            ;(left:float* (salloc left_right_size))
            ;(right:float* (salloc left_right_size))
            (mid:float* (salloc left_right_size))
            (side:float* (salloc left_right_size)))
        (dotimes (n window_size)
          (pset! window_buffer_in n (pref input_buffer (% (+ n read_head) in_size))))
        (set! read_head (% (+ read_head Sa ) in_size))   ;Advance the playhead by the Analysis hopsize
        ;;Standard Left Right processing
        ;(make_mono window_buffer_in window_size)
        ;(LR_split window_buffer_in left right window_size)
        ;(PV_left left (/ Sa IN_CHANNELS) (/ Ss IN_CHANNELS))
        ;(PV_right right (/ Sa IN_CHANNELS) (/ Ss IN_CHANNELS))
        ;(LR_combine window_buffer_out left right window_size)
        ;(make_mono window_buffer_out window_size)
        ;;Two channel MS Processing (best stereo image)
        (LR_to_MS_2_channels window_buffer_in window_size mid side)
        (PV_mid mid (/ Sa 2) (/ Ss 2)) ;replace 2 with IN_CHANNELS if using 0.7.0 release
        (PV_side side (/ Sa 2) (/ Ss 2)) ;replace 2 with IN_CHANNELS if using 0.7.0 release
        (MS_to_LR_2_channels window_buffer_out window_size mid side)
        (dotimes (n window_size)  ;Overlap-Add section
          (cond ((< n (- window_size Ss))
                  (pset! output_buffer (% (+ write_head n) out_size) (+ (pref window_buffer_out n)
                                                                     (pref output_buffer (% (+ write_head n) out_size)))))
                (else
                  (pset! output_buffer (% (+  write_head n) out_size) (pref window_buffer_out n)))))
        (set! write_head (% (+ write_head Ss ) out_size))
        (set! TSM_active 1)
        void
        )))))


Back to Index

Similar Entries

  • LR_split    xtlang
  • TSM_TIM_sPL    xtlang
  • Widget_set_split    xtlang
  • Widget_split    xtlang
  • Widget_split_horizontal_p    xtlang
  • Widget_split_vertical_p    xtlang
  • Widget_swap_split_orientation    xtlang
  • aiProcess_SplitByBoneCount    scheme
  • aiProcess_SplitLargeMeshes    scheme
  • 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_display_handler    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
  • impc:ir:split-and-decode-poly-adhoc-name    scheme
  • impc:ti:split-namedfunc    scheme
  • impc:ti:split-namedtype    scheme
  • phase_vocoder_sPL    xtlang
  • read_and_write_frame    xtlang
  • regex:type-split    scheme
  • regex_split    xtlang
  • regex_split    xtlang
  • sf_frames    xtlang
  • sf_frames_from_file    xtlang
  • sf_set_frames    xtlang
  • split-by    scheme
  • split-clock-time    scheme
  • splitjoin    xtlang
  • store_frame_OLA    xtlang
  • store_frame_PV    xtlang
  • store_frame_iPL    xtlang
  • vcframe    scheme
  • xtm_frame_data_to_tex    xtlang