How to time a midi note to external receiver?

51 views
Skip to first unread message

Nick Donohue

unread,
Aug 27, 2018, 2:24:03 AM8/27/18
to Overtone
I am trying to build a note generator that outputs midi to an external application, and I want to sequence the midi notes, similar to the
The expression:

(at (+ 1000 (now) (overtone.midi/midi-note receiver (note :A2) 80 100 3)))

plays a midi note to the external receiver immediately - I would expect it to play 1 second from now.

Additionally, the basic example of

(at (+ 1000 (now)) (println "hello world"))

also prints "hello world" immedately, instead of 1 second from now.

passing in the second argument to (at) does not appear to do anything at all, for "hello world" or midi-note
(at (+ 1000 (now)) #(println "hello world"))


However the following work just fine and do what I expect:
(def kick-d (freesound 41155))
(at (+ 1000 (now)) (kick-d))


(definst harpsichord [freq 440]
 
(string (* 2/1 freq) 1))
(at (+ 1000 (now)) (harpsichord 330))


What am I missing here? Does the event system only work with built-in instruments?
Are there docs that explain why?

How can I produce a midi note at a specific time? Is there a different function or way to sequence midi that I am not aware of? Playing around with the functions in overtone.music.time didn't yield any results.

Johnny Brown

unread,
May 14, 2019, 11:50:53 PM5/14/19
to Overtone
In the first expression, you are missing a closing parents after (now)

Johnny Brown

unread,
Oct 3, 2019, 6:29:57 PM10/3/19
to Overtone
I recently learned, the at macro is only for scheduling server communication: https://github.com/overtone/overtone/blob/master/src/overtone/sc/server.clj#L53

The difference in your examples is that playing a sample or instrument are accomplished by sending messages to the supercollider server, unlike sending midi or printing output. For scheduling midi events, you may want to use at-at
Reply all
Reply to author
Forward
0 new messages