MIDI Guitar MIDI Output IAC Bus Rate Limiting / Freezes

Hi Jam Origin team. New user here. Super cool product you have.

I’m using Midi Guitar 2 and experience what appears periodic freezes from the IAC Driver. I’m using Mac OS Monterey and a brand new download of Midi Guitar.

I currently stream the Midi Guitar output through the IAC Driver. I’m watching the output (and the issue) using the Midi Monitor App and a separate Python process that runs mido (a midi reading library) to count the number of messages (it’s also what I use to relay these note_ons) to my other tools.

The problem:

When I four-string strum (my six-string acoustic, mic’d through an M-Audio USB Interface). I can strum on and on and on, infinite note_ons no problem – everything looks good.

When I five-string or six-string strum. The Application emits somewhere between 5,000 and 5,500 note_ons, then at which point the system chokes up and doesn’t emit anything on the IAC Bus for 10-15 seconds. After those 10-15 seconds, notes are again emitted to the bus. It then freezes again after 5,000-5,500 more note_ons.

It is worth noting that the Midi Velocity wave-gram histogram level-meters still shows the velocities of my strums. The failure is not within the audio processing, it seems to only fail to emit MIDI to the IAC bus.

This choking up does not occur when I gradually six-strum (by tamping to stop all vibration for 1 second pauses between strums). This suggests to me that there is some rate limiting going on.

Any ideas what could be causing this?

This sounds very strange indeed. Im not sure what to suggest. I believe this must somehow be caused by the tracking and that it somehow get confused about your acoustic guitar sound. What kind of guitar do you play? Are you sure its not overdriven and completely dry?

I’m using a Godin 6 String Cedar CW–nothing too crazy.

The software continues to correctly identify notes while “frozen”-- the application’s MIDI velocity section reacts as I play. I’m fairly certain it’s nearer the software’s interface with the IAC Bus. Here is a screenshot of my setup while MIDI notes have ceased to fire (In that MIDI velocity section, there are 5 MIDI velocities active):

The problem you have described sounds like a loopback mode being activated which would create feedback, but this may be caused by something else.

This would have to be done by process of elimination:

  • disable the audio and midi outputs in MG2 and stop all other audio and midi applications.

  • Test only the audio input signal in MG2( without any other active audio or midi application) by playing and checking in the MG2 Midi Monitor window whether the result corresponds exactly to the notes played.

If the result is correct, assign and restart the midi outputs one at a time, checking the result until the problem reappears.

I have restarted devices, and used my Mac microphone [skipping my USB interface] (same issue). Is loopback mode specific to Midi Guitar 2? Or is that a dynamic in Mac OS X’s IAC Driver?

Again, even when the MIDI messages halt, the note readings on this “Midi Velocity” meter are never interrupted :
Screen Shot 2022-01-28 at 4.05.00 PM

This suggests to me that the application is detecting correctly, but the MIDI interface is failing.

And my outputs are as follows:
Output: IAC Driver IAC Bus 1
Control: IAC Driver IAC Bus 1
Channel: Channel 1

I have also tried Any/OMNI for channel. And Channel 2. Channel 2 doesn’t seem to send the midi messages that reflect the plucks’ decay, just initial note attacks.

Some further data, MIDI freezes after the following quantity of midi messages:
~7000 messages 64samples / 44.1k
~7000 messages 64samples / 48k
~5600 messages 128samples / 44.1k
~7300 messages 128samples / 48k
~4400 messages 256samples / 44.1k
~5200 messages 256samples / 48.1k

This part suggests to me that there is a time component affecting the trigger of no-midi-message failure state.

Aha, some more experimentation. I’m hammering the IAC bus with my own python script (that sends 6 notes every 6 milliseconds, I am getting MIDI hangups freezes at approximately the same ~5000 mark. This looks to be an OS X issue with MIDI, not on you guys.

I see two approaches forth–

First, can I slow down the rate at which MIDI messages are emitted? This would be a bit of a bummer, but even the 6ms buffer seems to be too great for a MIDI bus on my 2021 MacBook Pro.

Or even better, because OS X midi is a pretty severe limitation, do you think you could point me towards any means to directly hook the audio processing into my own software? Perhaps write the notes detected to a /dev, expose a command line (e.g. bash) utility, point me towards library (if that’s public anywhere?), or provide a plugin interface to run my own code?

I use Windows and I do not know the other OS.
In Windows, loopback is an audio capture mode that allows you to receive or send audio from one application to another. In some configurations, this mode can create audio feedback that endlessly multiplies a played note or sound.

I’m sorry I do not understand what you are explaining, I do not know anything about computer programming and related languages, plus English is not my first language.

Perhaps someone on this forum can help you with this.

Everything I proposed in my previous post is very simple and does not involve the IAC bus, a python application, midi output, etc.
To detect a problem, the best way is to start from scratch.
Without trying to listen to anything, with your OS booted up with no applications open except MG2, if you plug your guitar directly into your usb audio interface, with it selected in MG2 and WITHOUT any software or hardware either in or out (IAC, python, daw, etc) or controller plugged in, MG2’s Midi Monitor window should reflect exactly what you are playing.

If this does not work, the problem may be with the audio interface or the usb cable. A lot of weird things can be triggered by a faulty cable (I know this from experience). But this does not seem to be the case since you encountered the same problem without going through your audio interface.
It could also be a mic problem on your guitar (cable, capsule, preamp), but I assume it is working properly.

If it works correctly, the problem is with another application or the OS.
Reconnect your hardware or software devices one by one to identify the problem.

Hey Herold, thank you for replying on a Saturday. The software is working great-- it was an issue with Mac OS X’s IAC Bus (which is Mac OS’s version of loopback, it allows routing MIDI messages between applications).

I’ve found the Lua scripting / MIDI machine interface you provide. Exactly what I was looking for! I’ll share whatever I build.

2 Likes

Glad to hear it works :slightly_smiling_face:

Midi Machine slots offer many possibilities.
Do not hesitate to share your future scripts with the rest of us, poor ignorant in programming :grimacing:

Enjoy Midi Guitar.

For posterity’s sake, if anyone struggles with IAC throttling on a Mac. Here’s a simple workaround!

-- Documentation here:
-- https://www.jamorigin.com/products/midi-machine/

--[[
    
Getting started. On UNIX machines, you can side-step 
the (finicky) IAC MIDI Bus by directly piping MIDI data
to a named pipe. To create one, use the following command:

    mkfifo /tmp/midi_guitar_pipe

After which you might write some Python3 that looks like:

    with open("/tmp/midi_guitar_pipe") as f:
        os.set_blocking(f.fileno(), False)
        while True:
            time.sleep(0.001)
            for msg in f.readlines():
                ... 
--]]

function OnFrame(notes)
    
    -- Refers to global io
	for i, n in ipairs(notes) do
        fd:write(os.time(os.date("!*t")), ",", n.pitch, ",", n.velocity, "\n")
	end
	
	fd:flush()
end

function OnStart(info)
	-- assign a description to be displayed in the header
	info.description = "This machine will log the number of notes used."
	info.link = "http://jamorigin.com/midi-machine"
	
    -- Read Getting Started up to to see how to use this.
    fd = io.open("/tmp/midi_guitar_pipe", "a")
end

function OnStop()
    fd:close()
end
1 Like

One should never select the same MIDI port for control (which is an input) and output.
the control input will echo incoming notes to the output. it will freeze the midi port with buffer overflows.