Latency and MIDI



  • Hello,

    Im using piezo-sensors on my drums which is sent to max/msp and converted to MIDI for controlling external hardware synths.
    Im sending the same MIDI to isadora to trigger visual events in sync with my playing. 
    Im having a little trouble with latency in the images. Its not much generally speaking, but in this situation its quite a lot. Ive tried both video and live feed, all in 320x240, with and without effects. And just to be clear, the "image source" doesnt have to be in sync with anything, its whats done to the image that needs to be.. (changing color/zoom/pan/on/off, etc..
    My question is what can I do to reduce the latency in the MIDI-to-image responce? Is it even possible?
    Ill gladly try anything...!!
    I have a show coming up in two weeks at a technology exhibition, so Im hoping for some good advice..


  • Dear @Rabalder,

    In any case, since this is a topic useful to all, I created a special post about it. You can read it here:
    http://troikatronix.com/troikatronixforum/discussion/1807/latency-when-interactively-loading-movies-information-tips-from-mark
    Best Wishes,
    Mark
    P.S. You did not indicate whether you are on Mac or PC. It would be good to know, but the principles in my post should work on both platforms.


  • Thanks for the quick response!

    My specs:
    Macbook pro (2009)
    2.26 GHz Intel core 2 duo
    4 GB ram.
    (All my videoes are photo jpeg 320x240).
    I read the post regarding latency and tried the latency.izz file. It varried between 0,02 to 0,17 seconds.
    Even though the result was different from time to time, the projected image(the stage) didnt follow this change. It showed changes at a steady "slow" rate. (this is happening both with the stage open in my window and when I connect a projector through vga connections).
    The problem is not related to preloading videos, but changing an effect --> to seeing the result. If I use a live feed the latency is exactly the same as with a movie player.. 
    With livefeeds I tried usb webcams, the internal webcam and a firewire DV cam. All with the same result.
    I did however try to set up a video patch in Jitter(max). It had ok latency but is ate up a lot more cpu.
    Is there nothing I can do in isadora to deal with this issue??


  • Dear @Rabalder,

    I don't understand this comment of yours:
    "Even though the result was different from time to time, the projected image(the stage) didnt follow this change. It showed changes at a steady "slow" rate."
    I guess you are saying that the movies are always playing – is that right? Instead, the problem is that there is a noticeable lag between the MIDI message arriving and seeing a visible change of the effect at the output?
    Maybe you need to send me your patch so I can examine it. If you file a bug report you can send it to me as an attachment. (To submit a bug report, go to http://troikatronix.com/support/isadora/ and choose "Bug Report" from the topic menu/dropdown.) If you send me the patch it will help me to understand your specific problem.
    As for this comment "With livefeeds I tried usb webcams, the internal webcam and a firewire DV cam. All with the same result."
    Cameras always introduce a delay; DV is usually worse than webcams. If you want to see the "best case scenario," open QuickTime Player and choose "New Movie Recording" and then select your video device using the little white triangle. I'm pretty confident you'll find that the delay in QT Player is very similar to Isadora. (If not, then do let me know -- and include information about the camera you're using.)
    As far as I know, the lowest latency you can get will be with Blackmagic hardware. (There are others on this forum that might have other advice.) As you probably know, Isadora 2.0 offers direct capture from Blackmagic hardware. You can also try Black Syphon (http://vdmx.vidvox.net/blog/black-syphon) to grab video from a Blackmagic device and route it into Isadora if, for some reason, that offers less latency.
    If others have better ideas about reducing latency with cameras, please chime in.
    But do get back to me about your patch as described above. That would be the fastest way to find a solution.
    Best Wishes,
    Mark



  • Sorry about the bad explanation, but yes, you are right about this: "the problem is that there is a noticeable lag between the MIDI message arriving and seeing a visible change of the effect at the output?"

    It doesnt matter whether I use the movie player or the video in watcher. The change in color(see image below) has an equal amount of lag either way. This is the case with ALL parameters inside ALL actors!!
    It could simply be that it takes this much time for MIDI to travel between programs or something. Its probably not a bug, but maybe just a limitation?
    (Ive been using two Logitech HD c270 webcams scaled down to 320x240 for live feeds. Same result when trying the built in iSight)

    2f5968-midicolorizer.png



  • Hello,

    by chance I was also testing midi today, driven from a MAudio 49E.
    I've being trying to put in practice an idea I've being playing in my head from some time.
    I notice that the latency in Isadora (2.01) is much greater (not only with an open scene and some actors, but also with no scene and just the monitor open) than Midi Monitor, OSCulator or SimpleSynth.
    Why is this happening?

    thanks for any information



  • Dear @Rabadler + @bruper,

    Well, there were have been no modifications at all to the MIDI code in ages, but I will investigate this to see if I can find something. I don't have a MIDI controller with me at the moment, but I will check this evening.
    I just checked with a virtual MIDI connection and response was nearly instantaneous, as I would expect it to be.
    But to be clear, when you all say latency, what are we talking about here? 1mS? 5mS? 100mS? It would be good to have some notion of what you mean.
    Best,
    Mark


  • For me its about 150ms.



  • OK. That definitely doesn't match what I'm getting here. Are you connected to a video projector? Or just outputting to your screen?



  • Same result either way.

    (the latency test file you attached showed responses down to 2ms though)
    But I do have a max/msp patch running at the same time that converts piezo inputs to MIDI along with som other stuff. No image processing or anything heavy on the cpu.
    I need the max patch running to convert drum strokes to midi, so Im not really able to test without max... The idea is that all audio(external hardware) and visuals change when I hit the drum.


  • And drums, of course, being the worst case scenario when it comes to noticing latency. ;-) Anyway... will check.



  • haha.. yes. They are definitely an enemy of latency :)



  • @Mark

    in my case the latency in Isadora 2 is quite noticeable (I have not tried with previous versions), i don't know how I would possibly measure the difference with Midi Monitor, OSCulator or SimpleSynth... but visually it looks like a second...(?) maybe i should video-record the monitor?



  • Let me look into all of this you guys. I'll be back with more information today.

    -- Mark


  • Dear @bruper + @Rabalder,

    Well, I guess I don't know what the problem is. Please view the movie at http://troikatronix.com/files/latency-test.mov
    This was captured with a screen capture app. I'm capturing video from the FaceTime internal web cam at 640x360\. This is then fed to a duplicate of Rabalder's patch illustrated above. I am using a Korg nanoKontroller with a Control Watcher to trigger Random actors via MIDI.
    I pressed the button really hard so that the microphone would pick it up -- so that sound is your reference for the trigger. As you can see, there is very, very little latency. 
    Are you guys feeding the virtual MIDI input with the output of, let's say, Ableton or some other software else that's producing millions of MIDI messages? Maybe I could see the delay then -- if you were just completely overloading the MIDI input buffer with data.
    And also: what's the frame rate and cycle rate, shown in the bottom left corner of the main Isadora window?
    There's got to be something else going on that's causing this.
    Best Wishes,
    Mark


  • First of all, thanks A LOT for all your responses. Youre really a great guy Mark!!

    I dont have my rig fully set up right now, but I will in a couple of days. Then Ill do a propper test with a stripped down version of my max/msp patch with MIDI being sent only to isadora on various channels.(and other things I might think of..).
    (My frame rate is 25, and cycle rate +/- 230.)
    Ill post here when Ive done some testing.


  • @Rabalder,

    I try, I try. ;-)
    But listen: the best thing you can do is to connect your Max patch into MIDI Monitor. (Free from snoize I think... search Google.)  Just make sure there isn't some flood of data coming out that would clog Isaodra's pipes.
    Your frame rate and cycles are good... so that's not the issue.
    OK. Let me know what you find out.


  • Dear @Mark,

    thanks for following this, totally agree with Rabalder !!
    My fps 24.5 to 25 (25 in my preferences), my cycle rate between 190 to 225
    Today I received my new Korg nanoKontrol2 and I just tried it:
    Must say that it is spot on, no visible latency with Isadora.
    PS: Actually doing additional tests, I notice that turning on the output port of Communication/Midi Setup did for a while somehow slow down the Midi input signal but went back to unnoticeable.
    Connecting again the keyboard I fund that tonight there is no latency any longer.
    Don't know what to say... Will have to do more tests
    Best regards



  • Well, both of your experiences were obviously real. Let's see if we can get to the bottom of it. Again, check the MIDI you are sending into Isadora with MIDI Monitor. Make sure there is not some surprising amount of messages coming from somewhere you didn't expect.



  • Hello I have the same problem

    Mac OS X 10.10.3 - Isadora 2.0.5.
    My patch is a Picture player into a Kaleidoscope into a Projector
    I use a JazzMutant Lemur in midi mode via control watcher to control the Kaleidoscope.
    When I move a parameter nothing happen until more than on minute and after that the information appear in the monitor status and the change take effect with freeze.
    My patch was create on Isadora 1, and work great on it.
    What can I do.
    Thnaks

Log in to reply
 

Looks like your connection to TroikaTronix Community Forum was lost, please wait while we try to reconnect.