Files
test/templates/scan-ripple-drops.sexp
gilesb 95fcc67dcc Add generic streaming interpreter with configurable sources/audio
- Add stream_sexp_generic.py: fully generic sexp interpreter
- Add streaming primitives for video sources and audio analysis
- Add config system for external sources and audio files
- Add templates for reusable scans and macros
- Fix video/audio stream mapping in file output
- Add dynamic source cycling based on sources array length
- Remove old Python effect files (migrated to sexp)
- Update sexp effects to use namespaced primitives

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 17:48:04 +00:00

42 lines
1.5 KiB
Common Lisp

;; Beat-Triggered Ripple Drops Scan
;;
;; Creates random ripple drops triggered by audio beats.
;; Each drop has a random center position and duration.
;;
;; Required context:
;; - music: audio analyzer from (streaming:make-audio-analyzer ...)
;; - core primitives loaded
;;
;; Provides scan: ripple-state
;; Bind with: (bind ripple-state :gate) ;; 0 or 1
;; (bind ripple-state :cx) ;; center x (0-1)
;; (bind ripple-state :cy) ;; center y (0-1)
;;
;; Parameters:
;; trigger-chance: probability per beat (default 0.15)
;; min-duration: minimum beats (default 1)
;; max-duration: maximum beats (default 15)
;;
;; Usage:
;; (include :path "../templates/scan-ripple-drops.sexp")
;; ;; Uses default: 15% chance, 1-15 beat duration
;;
;; In frame:
;; (let [rip-gate (bind ripple-state :gate)
;; rip-amp (* rip-gate (core:map-range e 0 1 5 50))]
;; (ripple frame
;; :amplitude rip-amp
;; :center_x (bind ripple-state :cx)
;; :center_y (bind ripple-state :cy)))
(scan ripple-state (streaming:audio-beat music t)
:init {:gate 0 :cx 0.5 :cy 0.5 :left 0}
:step (if (> left 0)
(dict :gate 1 :cx cx :cy cy :left (- left 1))
(if (< (core:rand) 0.15)
(dict :gate 1
:cx (+ 0.2 (* (core:rand) 0.6))
:cy (+ 0.2 (* (core:rand) 0.6))
:left (+ 1 (mod (streaming:audio-beat-count music t) 15)))
(dict :gate 0 :cx 0.5 :cy 0.5 :left 0))))