Overview Clamps Packages CM Dictionary Clamps Dictionary Fomus
Next: vbap-azi , Previous: vbap , Up: V , Home: Overview

Clamps Dictionary

vbap

Function

(vbap &rest optional-keywords &aux (#:lambda-list '((in 0 (vbap (incudine-missing-arg 'vbap)) (azi 0) (ele 0) (spread 0) ugen-node))))

Incudine Ugen for vbap/mdap. Returns a foreign array of amplitude values for the speakers of the vbap struct with azi, ele and spread applied.

Examples

(dsp! pnoise-vbap-test ((vbap vbap) freq amp azi ele spread)
  (:defaults (incudine-missing-arg 'vbap) 10 0.1 0 0 0)
  (with ((numoutchannels (vbap-data-num-speakers (vbap-vbap-data vbap))))
    (foreach-frame
      (with ((frame (vbap (white-noise (* amp (decay-2 (impulse freq) 0 (/ 0.5 freq))))
                           vbap azi ele spread)))
        (maybe-expand frame)
        (dochannels (current-channel numoutchannels)
          (setf (audio-out current-channel)
                (frame-ref frame current-channel)))))))

(let* ((ls-directions '(-30 30 70 110 150 -150 -110 -70))
       (vbap (init-vbap ls-directions))
       (time -0.5))
  (pnoise-vbap-test vbap :azi -30 :id 10 :head 200)
  (dolist (azi ls-directions)
    (let ((azi azi))
      (at (+ (now) (clamps:time->samps (incf time 0.5)))
          (lambda () (set-control 10 :azi azi))))))

;;; DSP for an automated circular movement of noise pulses in 5 degree steps

(dsp! pnoise-circle-vbap-test ((vbap vbap) pulse-freq circle-freq amp spread)
  (:defaults (incudine-missing-arg 'vbap) 10 0.5 0.1 0)
  (with ((numoutchannels (vbap-data-num-speakers (vbap-vbap-data vbap)))
         (first-speaker-angle (reduce-warnings (/ (first (vbap-ls-directions vbap)) 5))))
    (foreach-frame
      (reduce-warnings
        (with ((azi (* 5.0d0 (round (+ (* 72 (phasor circle-freq 0)) first-speaker-angle))))
               (frame (vbap (white-noise (* amp (decay-2 (impulse pulse-freq) 0 (/ 0.5 pulse-freq))))
                            vbap azi 0 spread)))
          (maybe-expand azi)
          (maybe-expand frame)
          (dochannels (current-channel numoutchannels)
            (incf (audio-out current-channel)
                  (frame-ref frame current-channel))))))))

;;; Use MIDI Controllers with ccnum 0-3 to control the spread,
;;; circle-freq, pulse-freq and amplitude:

(defparameter *vbap-ctl-unwatch* nil)

(progn ;; init controllers
  (setf (ccin 0) 0)
  (setf (ccin 1) 64)
  (setf (ccin 2) 64)
  (setf (ccin 3) 64))

(pnoise-circle-vbap-test
    (init-vbap '(-30 30 70 110 150 -150 -110 -70))
    :action
    (lambda (node)
      (let ((id (node-id node)))
        (add-watch
         *vbap-ctl-unwatch*
         (set-control id :spread (m-lin (ccin 0) 0 100))
         (set-control id :circle-freq (m-exp (ccin 1) 0.1 1))
         (set-control id :pulse-freq (m-exp (ccin 2) 5 20))
         (set-control id :amp (m-exp-zero (ccin 3) 0.01 1)))))
    :free-hook (list (lambda (node) node (unwatch-all *vbap-ctl-unwatch*)))
    :head 200)

Author: Orm Finnendahl

Created: 2025-08-05 Di 20:46

Validate