在clojure泛音中捕获USB麦克风

时间:2016-11-28 03:28:21

标签: clojure usb microphone overtone

如何在Overtone中使用USB-mic? 以下是使用常规3.5mm麦克风的示例:

(ns insane-noises.vocoder)
(use 'overtone.live)

(def a (buffer 2048))
(def b (buffer 2048))

(demo 5
      (let [input  (sound-in 0); mic
            src    (white-noise) ; synth - try replacing this with other sound sources
            formed (pv-mul (fft a input) (fft b src))
            audio  (ifft formed)]
          (pan2 (* 0.1 audio))))

当我尝试进入时(声音输入0)将0改为1,2,3 ...... - 没有任何作用。 我的麦克风在skype等所有应用程序中都很好用。

1 个答案:

答案 0 :(得分:0)

我刚刚尝试重现它。它只是间歇性地工作。我跑了

(event-debug-on) 
在REPL中

,允许我看到Overtone和SuperCollider之间的OSC通信。

它会以两种不同的方式失败,具体取决于我是使用泛音。还是连接外部服务器,还是使用泛音.live。

使用overtone.live,我可以很好地分配缓冲区,但是当我运行demo函数时,我得到:

event:  [:overtone :osc-msg-received] (:msg {:path "/done", :type-tag "s", :args ("/d_recv")}) 

event:  "/done" (:path "/done" :args ("/d_recv")) 

event:  [:overtone :osc-msg-received] (:msg {:path "/synced", :type-tag "i", :args (18)}) 

event:  "/synced" (:path "/synced" :args (18)) 

zombified - calling shutdown handler
event:  [:overtone :osc-msg-received] (:msg {:path "/n_go", :type-tag "iiiii", :args (34 7 -1 -1 0)}) 

event:  "/n_go" (:path "/n_go" :args (34 7 -1 -1 0)) 

event:  [:overtone :node-created 34] ({:node #<synth-node[live]: beatboxchad-l394/audition-synth 34>}) 

...接着是一系列与Overtone清理其默认节点和组相关的事件,例如关闭的一部分。如果你没有从泛音中获得相同的输出,我会知道我有什么东西要对我的JACK设置进行故障排除。

使用连接到外部服务器的overtone.core,它会间歇性地工作。

当它工作时,我会收到以下事件:

event:  [:overtone :osc-msg-received] (:msg {:path "/d_removed", :type-tag "s", :args ("beatboxchad-l394/audition-synth"), :src-host "localhost.localdomain", :src-port 57110}) 

event:  "/d_removed" (:path "/d_removed" :args ("beatboxchad-l394/audition-synth")) 

event:  [:overtone :osc-msg-received] (:msg {:path "/done", :type-tag "s", :args ("/d_recv"), :src-host "localhost.localdomain", :src-port 57110}) 

event:  "/done" (:path "/done" :args ("/d_recv")) 

event:  [:overtone :osc-msg-received] (:msg {:path "/synced", :type-tag "i", :args (71), :src-host "localhost.localdomain", :src-port 57110}) 

event:  "/synced" (:path "/synced" :args (71)) 

event:  [:overtone :osc-msg-received] (:msg {:path "/n_go", :type-tag "iiiii", :args (114 7 -1 -1 0), :src-host "localhost.localdomain", :src-port 57110}) 

event:  "/n_go" (:path "/n_go" :args (114 7 -1 -1 0)) 

event:  [:overtone :node-created 114] ({:node #<synth-node[live]: beatboxchad-l394/audition-synth 114>}) 

event:  [:overtone :osc-msg-received] (:msg {:path "/n_end", :type-tag "iiiii", :args (114 7 -1 -1 0), :src-host "localhost.localdomain", :src-port 57110}) 

event:  "/n_end" (:path "/n_end" :args (114 7 -1 -1 0)) 

event:  [:overtone :node-destroyed 114] ({:node #<synth-node[destroyed]: beatboxchad-l394/audition-synth 114>}) 

当它失败时,我会得到这些:

event:  [:overtone :osc-msg-received] (:msg {:path "/d_removed", :type-tag "s", :args ("beatboxchad-l394/audition-synth"), :src-host "localhost.localdomain", :src-port 57110}) 

event:  "/d_removed" (:path "/d_removed" :args ("beatboxchad-l394/audition-synth")) 

event:  [:overtone :osc-msg-received] (:msg {:path "/done", :type-tag "s", :args ("/d_recv"), :src-host "localhost.localdomain", :src-port 57110}) 

event:  "/done" (:path "/done" :args ("/d_recv")) 

event:  [:overtone :osc-msg-received] (:msg {:path "/synced", :type-tag "i", :args (72), :src-host "localhost.localdomain", :src-port 57110}) 

event:  "/synced" (:path "/synced" :args (72)) 

event:  [:overtone :osc-msg-received] (:msg {:path "/fail", :type-tag "ss", :args ("/s_new" "duplicate node ID"), :src-host "localhost.localdomain", :src-port 57110}) 

event:  "/fail" (:path "/fail" :args ("/s_new" "duplicate node ID")) 

这看起来像OSC与服务器通信中的故障 - 某处节点ID没有正确递增。

当你尝试时,你会在事件方面得到什么?