overtone

Dan 2024-12-05T11:35:42.474109Z

Hey everyone. I played around with Overtone and SC. I want to now actually use this. Do you have setup ideas? What would work best for me, for example, would be using the overtone instruments in a DAW. I will probably use MIDI through a DAW. Maybe even directly connecting USB instruments to Overtone.

Joakim Verona 2024-12-15T19:55:05.008579Z

is there some way of having casa.jack.midi, feed the java midi event system? because i found java midi to not work great, and casa.jack.midi in contrast worked great. This is on my hacky linux system so other people might of course have much better experiences with ajva midi

plexus 2024-12-17T07:42:19.728039Z

I'm fairly sure it's possible to have custom providers for java midi, it would probably make more sense to do that as a java lib though directly based on jni-jack

Dan 2024-12-07T11:46:36.155739Z

I'm currently using the casa.squid.jack library (the one mentioned by Joakim's thread). I think, in the future, it will be easier for me to have live sessions with real midi controllers than programatically creating patterns. I set up hydrogen with overtone for the moment, very basic setup. After I'll be able to comfortably control instruments, I'll have multiple channels with effects.

Joakim Verona 2024-12-17T10:42:37.933489Z

tnx

plexus 2024-12-17T15:06:28.887799Z

basically you create a subclass of MidiDeviceProvider, and then add some files on the classpath under META-INF/services that allow javax.midi to discover your provider

plexus 2024-12-05T16:51:36.194819Z

Depends what you want to get out of it, but I would start with just overtone and get comfortable with it before bringing in a DAW. it's already a lot, and you may find you don't really need the DAW. You can definitely connect midi instruments to overtone. It's actually gotten easier thanks to the new event handlers. I'll see if I can point you at an example.

plexus 2024-12-08T10:52:53.800019Z

Overtone has midi handling built-in. It's based on Java's midi support, which does have some limitations, but I would start with that, since using casa.squid.jack directly is quite low-level.

plexus 2024-12-08T10:54:27.174209Z

Here's an example of hooking up something like a midi keyboard that sends both note-on and note-off messages.

(require '[overtone.core :as o])

(defn midi-preview
  ([synth-key synth]
   (midi-preview nil synth-key synth))
  ([ch synth-key synth]
   (let [voices (atom {})]
     (o/on-event [:midi :note-on]
                 (fn [{:keys [note channel]}]
                   (when (or (nil? ch) (= ch channel))
                     (swap! voices assoc note (synth :note note))))
                 [synth-key :on])
     (o/on-event [:midi :note-off]
                 (fn [{:keys [note channel]}]
                   (when (or (nil? ch) (= ch channel))
                     (o/ctl (get @voices note) :gate 0)
                     (swap! voices dissoc note)))
                 [synth-key :off]))))

(defn midi-preview-off [synth-key]
  (o/remove-event-handler [synth-key :on])
  (o/remove-event-handler [synth-key :off]))

plexus 2024-12-08T10:54:58.145699Z

(definst foo ,,,,,,) (midi-preview foo foo)

plexus 2024-12-08T10:55:35.329689Z

to remove the event handlers: (midi-preview-off ::foo)

plexus 2024-12-08T10:57:14.036019Z

here's an alternative version that uses (event :note ,,,) instead of calling the synth directly

(defn keyboard-insts [& insts]
  (on-event [:midi :note-on]
            (fn [{:keys [note channel velocity] :as e}]
              (when-let [inst (get (vec insts) channel)]
                (event :note :instrument inst :midinote note
                       :overtone.studio.event/key note
                       :end-time nil
                       :amp (* 1.5 (/ velocity 128) @(:value (param inst "amp"))))))
            ::midi-on)

  (on-event [:midi :note-off]
            (fn [{:keys [note channel] :as e}]
              (when-let [inst (get (vec insts) channel)]
                (event :note-end :instrument inst :midinote note
                       :overtone.studio.event/key note
                       :end-time (now))))
            ::midi-off))

plexus 2024-12-08T10:57:33.331669Z

this one works a bit differently, you pass it a bunch of synths, and it will bind them to separate midi-channels