FTDI latency on Linux (w/ patch)

Bug #822129 reported by Angus Gratton
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ttyMIDI
Fix Released
Undecided
Unassigned

Bug Description

By default, it seems like the FTDI drivers on Linux can introduce perceptible amounts of latency. Running the example sketch on an Duemilanove, I found I could hear the 3 notes of the chord arpeggiated (briefly) each time the 3 note_on messages were sent.

I think this is because the FTDI accumulates individual bytes from the serial link, in order to send them in a single USB packet. It has an adjustable timer for this "Nagling".

The patch I've attached sets the ASYNC_LOW_LATENCY flag, which the FTDI driver interprets as a request to drop the timer to 1ms (ie send all accumulated bytes after 1ms.)

It seems you can also set the timer via the sysfs interface. I didn't realise that until after I wrote the patch! It still seems like it might be helpful if ttymidi does it automatically, though.

I haven't put #ifdef __linux__ around the linux-specific bits, because AFAIK ttymidi is Linux-only. This does add an additional dependency on the Linux userspace headers, though.

Hope the patch is useful. Ttymidi seems like a great package, by the way (we are planning to use it to run a "make your own MIDI controller" workshop at the Electrofringe electronic arts festival in Newcastle, Australia!)

Cheers

- Angus.

Revision history for this message
Angus Gratton (angusgr) wrote :
Revision history for this message
Thiago Teixeira (tvst) wrote :

Hi Angus, thanks for the bug report and for the patch! I love patches :)

At a glance your code looks good. I will give it a quick test and update trunk as soon as possible.

Cheers,

- T

Changed in ttymidi:
status: New → Triaged
Revision history for this message
Jari Suominen (jari-tasankokaiku) wrote :

Howdy Angus! I tested your patch and everything seems to work fine! I also updated the trunk! Thanks!

.j

Changed in ttymidi:
status: Triaged → Fix Released
Revision history for this message
Thiago Teixeira (tvst) wrote :

Thanks Jari! I will update the site in a bit.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.