This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-02-05
Channels
- # aatree (2)
- # admin-announcements (15)
- # announcements (2)
- # aws (8)
- # beginners (160)
- # boot (290)
- # braid-chat (28)
- # cider (8)
- # clara (1)
- # cljsrn (3)
- # clojure (154)
- # clojure-czech (7)
- # clojure-russia (162)
- # clojurebridge (2)
- # clojurescript (128)
- # cursive (29)
- # datomic (30)
- # emacs (7)
- # events (1)
- # hoplon (5)
- # jobs (1)
- # ldnclj (7)
- # leiningen (3)
- # off-topic (11)
- # om (82)
- # onyx (68)
- # overtone (1)
- # parinfer (57)
- # portland-or (1)
- # proton (18)
- # re-frame (8)
- # reagent (32)
- # ring-swagger (3)
- # yada (5)
I have a problem getting Overtone to correctly play MIDI events. When I load Overtone and define play-note
it works as expected.
(use 'overtone.live)
(def piano-device
(first (midi-connected-receivers)))
(defn play-note [dev x]
(midi-note dev x 100 500))
(play-note piano-device 60)
However, if I want to schedule MIDI events into the future by defining play-melody
, it will play them immediately (all at once), instead of at the specified beats.
(def one-twenty (metronome 120))
(defn play-melody [m]
(let [beat (m)]
(at (m beat) (play-note piano-device 60))
(at (m (+ beat 1)) (play-note piano-device 63))
(at (m (+ beat 2)) (play-note piano-device 67))
(at (m (+ beat 3)) (play-note piano-device 58))))
(play-melody one-twenty)
I have tried to use anonymous functions (wrapping them in fn
) instead of calling play-note
within play-melody
, but I couldn't get it to work. Anyone care to help me out?