; Beat-synced video recipe with lambda reducer (recipe "beat-sync-lambda" :version "1.0" :encoding (:codec "libx264" :crf 22 :preset "fast" :audio-codec "aac") ; Declare analyzers and effects (analyzer beats :path "../artdag-analyzers/beats/analyzer.py") (effect invert :path "../artdag-effects/invert/effect.py") ; Sources (def video (source :path "new.webm" :description "Video input")) (def audio (-> (source :path "dizzy.mp3" :description "Audio input") (segment :start 0 :duration 10))) ; Analyze audio for beats (def analysis (-> audio (analyze beats))) ; Slice video at beat times using lambda reducer (def synced-video (slice-on video analysis :times times :init 0 :fn (fn [acc i start end] {:source video :effects (if (odd? i) (list invert) (list)) :acc (inc acc)}))) ; Mux video with audio (mux synced-video audio))