Close

Performance: the best you can get!

A project log for eXaDrums

Electronic drums for Linux

jeremyJeremy 04/23/2017 at 19:340 Comments

Yeah that's true, it's probably the best you can get!

More than a year ago I managed to get the latency of eXaDrums (formerly RaspiDrums) below 10 ms: https://hackaday.io/project/7499-raspidrums/log/25077-latency-goes-below-10ms

Well actually, the latency was about 10ms... And I had to use nice to achieve that result...

A few days ago I optimized the code quite a bit. The threads are now running with high priority, and the Mixer is completely lock-free! The result of that is an average latency of 8ms (it goes from 6ms to 9ms), and it's always less than 10ms. Always! See for yourself:

The yellow curve is the output of the piezo of one of my drum pads. The blue curve is the output of the soundcard of eXaDrums. They are both connected to an oscilloscope, and as you can see, there's a 8ms delay between the peak of the yellow curve, and the beginning of the rise of the blue curve.

The best part is that it's very repeatable, and most of the time around 8 ms, sometimes under 7 ms (I even got 6 ms a few times), and very rarely longer than 9 ms.

That test was ran on a Raspberry Pi 2 (the old one), with two sensors connected to the module, and with a soundcard buffer set to 2 ms.

Discussions