High latency >30ms

Hi folks! I’ve been playing Zynthian for a few weeks now and I’m having fun but I noticed latency. I thought that maybe I was just too sensitive to the latency since I’m used to playing hardware however I finally did a test and I can confirm high latency (if my methodology is ok). I have a hardware synth (Yamaha reface) with built in speakers and an aux input. Midi ran out from the usb of the reface and into the usb of the Zynthian. Audio ran out from the Zynthian headphone port into the aux in of the Yamaha. I placed a mic near the speakers of the Yamaha and recorded while I played a very short sound from the Yamaha and from the Zynthian. I compared the beginning of the Zynthian wave to the beginning of the Yamaha wave and got the following results:
Pianoteq 7 U4 - 46ms of latency
ZynSubAddFx white noise - 36 ms
Noizemaker white noise - 32 ms

I measured these numbers in Logic Pro X.

Can this latency be improved? Thanks!

1 Like

The pi headphone jack probably isn’t the best reference.
You probably want to trigger both devices from the same trigger, perhaps a 5 in din Midi port to ensure a consistent delay for each. You probably want to compare the responses in a similar fashion. The aux in may or may not be digital, it’s unlikely but you never know.
Try to ensure the signal chains are identical for both devices.

Feeding the zynth from a usb MIDI derived from the MIDI out of the yamaha will also add a couple of buffers of delay into the rig which will mean the zynth isn’t getting the same starting impulse that the yamaha is…

I know I showed a latency rig using speakers and a microphone but this was primarily fanciful and realistically the actually measurements are best done electronically as cutting down the number of elements and transitions will allow you to focus on what you are really measuring…

3 Likes

Yep! That is not quite like-for-like so take into consideration all that @wyleu says. The “headphone” output does have poor latency for several reasons. Test with a soundcard, even with your current test method and you should see much improved results.

1 Like

Wyleu, Riban, thank you for the responses. Based on your recommendations, I set up a test that better controlled the variables.

My Roland A70 has 4 MIDI DIN outs so I sent one to the computer through an interface, one to the MIDI IN of the Zynthian, and one to the MIDI in of the reface(a hardware synth as an experiment control). I sent audio out of my reface and audio out of the Zynthian (the actual audio out, NOT the headphone out) into the interface and into Logic. I hit notes on the A70, and recorded the MIDI event and the audio from the reface and the Zynthian. I then measured the difference between where Logic records the MIDI event and the audio. These are the results:
reface audio - 3ms
Zynthian setBfree - 23ms
Zynthian Pianoteq U4 - 17 ms
Zynthian Noize Mak3r - 15 ms
Zynthian SubAddFX - 17 ms

These results are much better and Im sure, much more accurate than my first results. I would still like to be able to bring these numbers down by a third. I don’t expect Zynthian to compete with my MacBook Pro but I think I read on this forum of people getting latency results significantly lower than mine. What would you folks recommend?

2 Likes

Do you run zynthian with the official kit or on some customised setup ?
You Can try to modify jackd sound server parameters (through webconf/hardware/audio/advanced view) but keep in mind that reducing jackd latency (wich is a part of the total latency) coule produce Xruns.

Hi le51, I use a Zynthian kit V4. I’ll try playing with the buffer. I don’t use a sustain pedal so I might be able to get along with a smaller buffer.

Hi folks, I changed the buffer to 128 and got interesting results:
Pianoteq - constant xruns
setBfree - 7ms
Noise mak3r - 6ms

There are a few xruns here and there with setBfree and Noisemaker but not bad. It’s worth the trade for such low latency. It feels good and snappy to play at this buffer. Although I would trade a couple ms for fewer x runs, the about 20ms I was getting at 256 was difficult to play.

At 128, I can’t use Pianoteq though. Is there any way to reduce latency at 256 so I can still use Pianoteq?
Thanks!

2 Likes

You could try increasing samplerate which reduces latency but may increase load / xruns. You can also access Pianoteq GUI and reduce internal sample rate but it is already fairly low so the frequency response may too poor for you.

Thanks for the reply, Riban. I might play with the sample rate. Since setBfree can run smooth and fast at 128, I might have enough to play with without getting Pianoteq going anyway.

About the headphone out: does having RPi headphone on/off effect anything other than the headphone out? What I mean is, would turning it off improve performance?

Turning headphone off has significant improvement effect. The option adds a samplerate converter to mirror main output to the built-in RPi audio interface which itself isn’t very efficient. Headphone output should only be used for testing and avoided where possible.

1 Like

I reckon we deserve a :face_with_monocle: at the very least here . . …

Thanks, Riban. Wyleu, could you clarify what :face_with_monocle: means?

I tried a new test with different configurations.

I first turned off the headphone out:
Pianoteq - 14ms
setBfree - 17ms

I then raised the sample rate to 48k:
Pianoteq - 12ms
setBfree - 15ms

I then raised it to 88.2k
Pianoteq - 6ms and frequent clicks

It seems to me that 256/48k with the headphone off is pretty decently low latency and has been very stable for me. I dont use a sustain pedal and I’m not a virtuoso so I’m fairly happy with this setting.

1 Like

Follow the link :face_with_monocle:. @wyleu is the master of cryptic messaging.

Good to hear you have a workable solution. I reckon you will still suffer xruns and I am (slowly, very slowly) trying to improve that because it is one thing I think we should eradicate - or at least have a method of identifying configurations that work without xruns. There are many causes and we inch ever-closer to utopia but with every improvement the horizon seems to move further away! (Blooming feature creep…)

2 Likes

Ah, I see what :face_with_monocle: means. Wyleu, I think you’re right. It’s the least I could do. Since, Noise Mak3r, setBfree and Pianoteq are the engines I’ve been using for these test, stand by for a funky sample featuring them. Do we post :face_with_monocle: here on the thread or another spot?

Most people attach them to a post in this forum.

@Jude put it here.
@wyleu as funny and esoteric / kitsch as :face_with_monocle: is, it is probably one of the most frequently misunderstood things on this forum with correspondingly highest support burden. How about adding some musical notes to a custom version of the emoji? You know very well that every time you post that request you will get a :confused: response. :stuck_out_tongue:


Alright folks, I put together a quick :face_with_monocle: featuring Noize Mak3r on bass, setBfree with a healthy amount of drive, Fluid Drums and finally, a Pianoteq Clavinet with an auto-wah. I recorded it into Logic pro X. Thanks for all the help and cheers to the Zynthian community! Enjoy the funk!

9 Likes