overtone 2024-10-23

One QQ, what would be the equivalent of poll, but for the real value(s) instead of them being printed out into the console? I've tried the naive with-out-str as a quick hack, but I just have a empty string instead

I use send-reply coupled with on-event:

(defn run-get-signal-analysis
  [& {:keys [freq input-bus analysis-path]
      :or {freq 60}}]
  (timbre/debug "Initializing signal analyzer on bus:" input-bus)
  ((o/synth
    (let [input (o/in input-bus)]
      (o/send-reply (o/impulse freq) analysis-path
                    ;; TODO Probably use PeakFollower instead of amplitude
                    [(o/amplitude:kr input) (o/pitch:kr input)]
                    1)))))

(defn run-receive-analysis
  "Gets analysis from `in` 0 in almost real time
  and `conj`es the data into`analysis-history.
  NOTE: `run-get-signal-pitches` must be running`"
  [& {:keys [freq input-bus-name-keyword analysis-path]}]
  (let [handler-name (keyword (str (str/replace analysis-path #"/" "")
                                   "-handler"))]
    (o/on-event analysis-path
                (fn [data] (do-receive-analysis input-bus-name-keyword data))
                handler-name)
    handler-name))

Nice, thanks o/

Thanks for sharing it, I’ve done something similar using poll, https://github.com/pfeodrippe/vybe/commit/53a0d02622f7725cde5cb19b6954d9ac5a696a6f, it’s just for testing, so it’s fine o/