This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-02-16
Channels
- # admin-announcements (14)
- # announcements (1)
- # aws (1)
- # beginners (105)
- # boot (609)
- # braid-chat (4)
- # braveandtrue (3)
- # cider (24)
- # cljs-dev (13)
- # cljsrn (2)
- # clojure (142)
- # clojure-berlin (7)
- # clojure-ireland (7)
- # clojure-japan (10)
- # clojure-nl (4)
- # clojure-poland (76)
- # clojure-russia (198)
- # clojure-sg (4)
- # clojure-taiwan (1)
- # clojurebridge (1)
- # clojured (4)
- # clojurescript (73)
- # conf-proposals (11)
- # cursive (10)
- # datomic (32)
- # devcards (1)
- # dirac (22)
- # editors (5)
- # emacs (3)
- # events (4)
- # funcool (19)
- # hoplon (18)
- # job (1)
- # jobs (3)
- # jobs-rus (16)
- # keechma (25)
- # ldnclj (33)
- # lein-figwheel (10)
- # leiningen (4)
- # luminus (1)
- # off-topic (19)
- # om (255)
- # onyx (51)
- # overtone (1)
- # parinfer (206)
- # perun (5)
- # proton (2)
- # re-frame (3)
- # reagent (2)
- # remote-jobs (13)
- # ring-swagger (7)
- # slack-help (4)
- # yada (7)
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?