TSM_TIM_OLA   xtlang


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

Implementation

(bind-func TSM_TIM_OLA
  (lambda ()
  (let ((in_offset_ptr:i64 0)
        (out_offset_ptr:i64 0)
        (output_sample:float 0.0)
        (in_size:i64 (bitwise-shift-left 2 20)) ;increase the second argument if audio is wrapping around circular buffer to soon
        (window_size:i64 1024) ;This is split between the number of input channels.  FFT size is window_size/IN_CHANNELS
        (out_size:i64 (* window_size 2))
        (input_buffer:float* (zalloc in_size))
        (output_buffer:float* (zalloc out_size))
        (window_buffer:float* (zalloc window_size))
        (framing (store_frame_OLA window_size))
        (first:i64 1))
  (lambda (in:float)
    (let ((overlap_factor:i64 4)
          (sample_Ss:i64 (/ window_size overlap_factor))
          (sample_Sa:i64 (ftoi64 (+ (% (round (* (i64tof sample_Ss) speed)) 2.0)(round (* (i64tof sample_Ss) speed)))))) ;speed is a global variable adding the modulus ensure even number
    (pset! input_buffer in_offset_ptr in) ;Set 'in' to whatever you want to be time stretched
    (if (= (% in_offset_ptr sample_Ss) 0)
      (if (= first 0)
          (framing input_buffer in_size output_buffer out_size sample_Sa sample_Ss)))
    (if (= in_offset_ptr window_size) ;Start the TSM process after window_size number of samples
          (set! first 0))
    (set! in_offset_ptr (% (+ in_offset_ptr 1) in_size))
    (cond ((= TSM_active 0)
            (set! output_sample 0.0))
          (else (set! output_sample (pref output_buffer out_offset_ptr))
                (set! out_offset_ptr (% (+ out_offset_ptr 1) out_size))
                output_sample)))))))


Back to Index

Similar Entries

  • Complex_multiplication_polar    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/TSM_library.xtm
  • Cpolar    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/gsl.xtm
  • PARAM_DELAY_TIME    scheme    /digego/extempore/tree/v0.8.9/libs/core/instruments-scm.xtm
  • PARAM_DELAY_TIME_LEFT    scheme    /digego/extempore/tree/v0.8.9/libs/core/instruments-scm.xtm
  • PARAM_DELAY_TIME_LEFT    scheme    /digego/extempore/tree/v0.8.9/examples/sharedsystem/audiosetup.xtm
  • PARAM_DELAY_TIME_RIGHT    scheme    /digego/extempore/tree/v0.8.9/libs/core/instruments-scm.xtm
  • PARAM_DELAY_TIME_RIGHT    scheme    /digego/extempore/tree/v0.8.9/examples/sharedsystem/audiosetup.xtm
  • PaStreamCallbackTimeInfo_print    xtlang    /digego/extempore/tree/v0.8.9/libs/external/portaudio.xtm
  • PaStreamCallbackTimeInfo_toString    xtlang    /digego/extempore/tree/v0.8.9/libs/external/portaudio.xtm
  • Pm_Event_Timestamp    xtlang    /digego/extempore/tree/v0.8.9/libs/external/portmidi.xtm
  • TSM_TIM_PV    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/TSM_library.xtm
  • TSM_TIM_iPL    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/TSM_library.xtm
  • TSM_TIM_sPL    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/TSM_library.xtm
  • aiProcess_OptimizeGraph    scheme    /digego/extempore/tree/v0.8.9/libs/external/assimp.xtm
  • aiProcess_OptimizeMeshes    scheme    /digego/extempore/tree/v0.8.9/libs/external/assimp.xtm
  • cond-expand-runtime    scheme    /digego/extempore/tree/v0.8.9/runtime/init.xtm
  • dotimes    macro    /digego/extempore/tree/v0.8.9/runtime/scheme.xtm
  • get_midi_evt_clocktime    xtlang    /digego/extempore/tree/v0.8.9/libs/external/midi.xtm
  • get_midi_evt_timestamp    xtlang    /digego/extempore/tree/v0.8.9/libs/external/midi.xtm
  • impc:aot:do-at-runtime    macro    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:ti:dotimes    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:ti:dotimes-check    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • is_TSM_active    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/TSM_library.xtm
  • join-clock-time    scheme    /digego/extempore/tree/v0.8.9/libs/core/toplap_clock.xtm
  • make-timeline    scheme    /digego/extempore/tree/v0.8.9/runtime/scheme.xtm
  • ndiff_extrapolated    xtlang    /digego/extempore/tree/v0.8.9/libs/core/math.xtm
  • nnsock_set_recv_timeout    xtlang    /digego/extempore/tree/v0.8.9/libs/external/nanomsg.xtm
  • nnsock_set_send_timeout    xtlang    /digego/extempore/tree/v0.8.9/libs/external/nanomsg.xtm
  • nnsock_set_timeout    xtlang    /digego/extempore/tree/v0.8.9/libs/external/nanomsg.xtm
  • pm_current_time_in_ms    xtlang    /digego/extempore/tree/v0.8.9/libs/external/portmidi.xtm
  • split-clock-time    scheme    /digego/extempore/tree/v0.8.9/libs/core/toplap_clock.xtm
  • store_frame_OLA    xtlang    /digego/extempore/tree/v0.8.9/libs/contrib/TSM_library.xtm
  • times-5    scheme    /digego/extempore/tree/v0.8.9/tests/core/system.xtm