Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question] syncing leipzig compositions with quil visuals #17

Open
soweliniko opened this issue Feb 11, 2019 · 4 comments
Open

[question] syncing leipzig compositions with quil visuals #17

soweliniko opened this issue Feb 11, 2019 · 4 comments

Comments

@soweliniko
Copy link

hello,
I have been making some music with leipzig and I'm loving the library, but I would like to sync some live visuals to my music with quil. Is there a way to do this with leipzig?

@ctford
Copy link
Owner

ctford commented Sep 15, 2019

This is a very good question. Right now, there is no good answer, because to actually synchronise means that your visuals would have to know what note is currently playing, and that's hidden away inside of play.

You could certainly synchronise a live-loop with visuals by doing (def melody ...) and (jam (var melody)) and watch melody in your Quil loop, but that would only give you the notes as one big data structure and not the current playing time.

@ctford
Copy link
Owner

ctford commented Sep 16, 2019

The proposal in #14 could help with this. At the very least, you could clone play in your codebase after @pjagielski's suggestion.

@ctford
Copy link
Owner

ctford commented Sep 16, 2019

You could also stash the note somewhere when your implementation of play-note is called. That is a bit annoying in that you have to do it once for each part, but it also makes it easier to do something different for each part.

@divisiondeariza
Copy link

Also, you could send an osc message calling at-at inside a play-note method for example I have something like this.

(ns my-space.core
    (:require
     [leipzig.live :as live]
     [leipzig.melody :refer :all]
     [overtone.live :as overtone]
     [overtone.osc :as osc]
     [overtone.at-at :as at-at]))

(def osc-client (osc/osc-client "localhost" 57120))

(defn send-note [note]
  (osc/osc-send-msg osc-client {:path "/note" :type-tag "i" :args [note]}))

(defmethod live/play-note :some-part [{pitch :pitch duration :duration instrument :instrument}] 
     (at-at/at 0 #(send-note pitch) my-pool))

In this way you can connect through osc internally and trigger events avoiding the "FAILURE IN SERVER: /path Command not found" error.

It's a suspicious hack, I know, but it's seems to work well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants