cerberus_fx   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus.xtm

Implementation

;; FX
(bind-func cerberus_fx
  (let ((MILLISEC (* .001 SRf))
        (CHANSF (i32tof CHANNELS)))
    (lambda ()
      (let ((notekernel:NOTE_KERNEL null)
            (name 'Cerberus')
            (mod_amp:|4,SAMPLE|* (array_ref 1.0 1.0 1.0 1.0))
            (mod_frq:|4,SAMPLE|* (array_ref 1.0 1.0 1.0 1.0))
            (mod_phase:|4,SAMPLE|* (array_ref 0.0 0.0 0.0 0.0))
            (mod_options:|4,i32|* (array_ref 0 0 0 0))
            (mod_attack:|4,SAMPLE|* (array_ref 10.0 10.0 10.0 10.0)) ;; in millis
            (mod_decay:|4,SAMPLE|* (array_ref 10.0 10.0 10.0 10.0))
            (mod_attack_slope:|4,SAMPLE|* (array_ref 0.0 0.0 0.0 0.0)) ;; between -1.0 log and 1.0 exp  (0.0 is linear)
            (mod_decay_slope:|4,SAMPLE|* (array_ref 0.0 0.0 0.0 0.0))
            (mods:|32,SAMPLE|* null) ;(alloc))
            (mod_matrix:|8,|32,SAMPLE||* null); (alloc))
            (tmpmod:|32,SAMPLE|* null)
            (tmpval:SAMPLE 0.0)
            (lfos:|4,|8,[SAMPLE,i64,i64]*||* (alloc))
            (lfo_types:|4,i32|* (alloc))
            (hpf (hpf_c))
            (hpfR (hpf_c))
            (hpf_frq 20001.0)
            (dly (comb_mc_c (i32toi64 CHANNELS) (* SR 120))) ;; max 120 sec delay
            (delay_time_left 50.0) ;; in ms
            (delay_time_right 50.0) ;; in ms
            (delay_in 1.0)
            (delay_mix 0.0)
            (delay_fb 0.5)
            (delay_frq:SAMPLE 12000.0)
            (delay_res:SAMPLE 0.0)
            (rev (reverb_st_c))
            (reverb_mix 0.0)
            (reverb_predelay 40.0) ;; in ms
            (reverb_size 0.3)
            (reverb_absorb 0.45)
            (pan (pan_c (i32toi64 CHANNELS)))
            (pan_pos 0.5)
            (pan_width 1.0)
            (flanger (flanger_st_c))
            (flanger_low 0.1) ;; in ms
            (flanger_high 4.0) ;; in ms
            (flanger_rate 0.127287)
            (flanger_fb 0.25)
            (flanger_mix 0.0)
            (overdrive (overdrive_c))
            (overdrive_amt 0.5) ;; always use some overdrive
            (out:SAMPLE 0.0)
            (i:i64 0) (j:i64 0)
            (tmp 0.0)
            (fxout 0.0)
            (gain 2.0))
        (dotimes (i 4)
          (aset! lfo_types i PARAM_SINE)
          (cerberus_create_lfos lfos i 0.0 0.0 mod_amp mod_frq mod_phase mod_options mod_attack mod_decay mod_attack_slope mod_decay_slope))
        (lambda (in:SAMPLE time:i64 chan:i64 dat:SAMPLE*)
          ;; calc mod matrix changes
          (begin
            (if (= mods null) (set! mods (notekernel.mods:|32,SAMPLE|*)))
            (if (= mod_matrix null) (set! mod_matrix (notekernel.mod_matrix:|8,|32,SAMPLE||*)))
            (memset (cast mods i8*) 0 128) ;(size_of mods))
            (dotimes (i 3)
              (set! tmp ((aref (aref-ptr lfos i) (aref lfo_types i)) chan i))
              (set! tmpmod (aref-ptr mod_matrix i))
              (dotimes (j 32) (aset! mods j (+ (aref mods j) (* tmp (aref tmpmod j)))))
              void)
            ;; the 4th lfo is a modulator!
            (set! tmp ((aref (aref-ptr lfos 3) (aref lfo_types 3)) chan 3))
            (set! tmpmod (aref-ptr mod_matrix 3))
            (dotimes (j 32) 
              (set! tmpval (aref tmpmod j))
              (if (> tmpval 0.0)
                  (aset! mods j (* (aref mods j) (* tmp (aref tmpmod j))))))
          )
          (set! out in)
          (set! out (overdrive out overdrive_amt))
          (if (< hpf_frq 20000.0)
              (set! out (hpf out hpf_frq 0.0)))
          ;; apply FX to both channels 1 and 2
          (set! tmp (+ pan_pos (aref mods PARAM_PAN_POS)))
          (if (> tmp CHANSF) (set! tmp (- tmp CHANSF)))
          ;; always with the panning!
          (set! fxout (pan chan out
                           (+ pan_width (aref mods PARAM_PAN_WIDTH))
                           tmp))
          (if (> flanger_mix 0.001)
              (set! fxout (flanger chan fxout
                                   1.0 flanger_mix
                                   (+ flanger_low 0.0) ;(aref mods PARAM_FLANGER_LOW)))
                                   (+ flanger_high 0.0) ;(aref mods PARAM_FLANGER_HIGH)))
                                   (+ flanger_rate 0.0) ;(aref mods PARAM_FLANGER_RATE))
                                   (+ flanger_fb 0.0)))) ;;(aref mods PARAM_FLANGER_FB)))))
          (if (> delay_mix 0.001)
              (set! fxout (dly chan fxout
                               (if (= chan 0)
                                   (* MILLISEC (+ delay_time_left (aref mods PARAM_DELAY_TIME_LEFT)))
                                   (* MILLISEC (+ delay_time_right (aref mods PARAM_DELAY_TIME_RIGHT))))
                               delay_in
                               delay_mix
                               (+ delay_fb (aref mods PARAM_DELAY_FB)))))
          (if (> reverb_mix 0.001)
              (set! fxout (rev chan fxout
                               (+ reverb_size (aref mods PARAM_REVERB_SIZE))
                               (+ reverb_predelay (aref mods PARAM_REVERB_PREDELAY))
                               (+ reverb_absorb (aref mods PARAM_REVERB_ABSORB))
                               (+ reverb_mix (aref mods PARAM_REVERB_MIX)))))
          (* gain fxout))))))


Back to Index

Similar Entries

  • analogueVec_fx    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/analogue.xtm
  • analogue_fx    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/analogue.xtm
  • cerberus-load-preset    scheme    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus_fileio-scm.xtm
  • cerberus-load-state    scheme    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus_fileio-scm.xtm
  • cerberus-reset    scheme    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus_fileio-scm.xtm
  • cerberus-save-preset    scheme    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus_fileio-scm.xtm
  • cerberus_amp_pitch_env_cc    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus_midi.xtm
  • cerberus_cc    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus_midi.xtm
  • cerberus_create_lfos    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus.xtm
  • cerberus_delay_cc    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus_midi.xtm
  • cerberus_extras_cc    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus_midi.xtm
  • cerberus_filter_cc    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus_midi.xtm
  • cerberus_filter_env_cc    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus_midi.xtm
  • cerberus_flanger_cc    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus_midi.xtm
  • cerberus_frq_from_val    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus_midi.xtm
  • cerberus_get_filtertype    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus_midi.xtm
  • cerberus_get_lfo_waveform    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus_midi.xtm
  • cerberus_get_mod_matrix    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/instrument_params.xtm
  • cerberus_get_noisetype    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus_midi.xtm
  • cerberus_get_waveform    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus_midi.xtm
  • cerberus_get_wt_expr    scheme    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus_fileio-scm.xtm
  • cerberus_lfo1_cc    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus_midi.xtm
  • cerberus_lfo2_cc    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus_midi.xtm
  • cerberus_lfo3_cc    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus_midi.xtm
  • cerberus_lfo4_cc    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus_midi.xtm
  • cerberus_logRamp    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus_midi.xtm
  • cerberus_main_cc    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus_midi.xtm
  • cerberus_matrix_cc    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus_midi.xtm
  • cerberus_moog_ladder_inlined    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus.xtm
  • cerberus_note    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus.xtm
  • cerberus_octave_from_val    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus_midi.xtm
  • cerberus_osc1_cc    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus_midi.xtm
  • cerberus_osc2_cc    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus_midi.xtm
  • cerberus_osc3_cc    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus_midi.xtm
  • cerberus_osc4_cc    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus_midi.xtm
  • cerberus_remove_file    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus.xtm
  • cerberus_reset    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus.xtm
  • cerberus_reset_lfos    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus.xtm
  • cerberus_reverb_cc    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus_midi.xtm
  • cerberus_set_mod_matrix    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/instrument_params.xtm
  • cerberus_sub_noise_cc    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus_midi.xtm
  • dlogue_fx    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/dlogue.xtm
  • sampler_fx    xtlang    /digego/extempore/tree/v0.8.9/libs/external/instruments_ext.xtm
  • vector_gfx:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/external/xtmrender5.xtm
  • xtm_dof_fx    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm
  • xtm_dof_fx    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm
  • xtm_dof_fx    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm
  • xtm_dof_fx    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm
  • xtm_dof_fx    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm
  • xtm_skybox_fx    xtlang    /digego/extempore/tree/v0.8.9/libs/external/graphics-pipeline.xtm