Latency question

I hope I understand your question and give a sensible answer… Thank you

Yamaha Arius ydp-144 → usb → Zynthian Perfect
Yamaha Arius → usb MacBook → usb Focusrite Scarlett 2i4 → Midi-5 → Zynthian Midi IN… latency

Okay - that looks quite like the mac/foucsrite adding latency. MIDI-5 should not add any more latency than a direct USB connection.

1 Like

Thanks Riban, today I’ll do the same thing with the iMac and the Focusrite 18i18 and then I’ll tell you how it went… :wink:

I suspect zynthian’s usb-gaget have high latency

1 Like

This workflow does not use usb-gadget. MIDI is coming in on DIN-5 which uses ttyMIDI. ttyMIDI isn’t perfect but I don’t think the latency is worse than USB MIDI.

1 Like

Since I was able to match the Nord Stage which I think runs at 96khz using the midi din I wonder how much more it can be optimised.
I did read this

https://bugs.launchpad.net/bugs/822129

Sean

AFAIK, no ftdi chips are used in the rbpi.

Regards

2 Likes

So much fun to be able to log in to a synth and also to be able to look at the source.
It’s working fine as it as and I doubt it’s going to do much probably just break the machine but in this file

I wondered if shrinking the size of the tinyosc buffer or restraining the number of max channels would make some negligble difference. I see a pretty largish usleep in eventThreadFn but don’t quite understand why that needs to be so long but I am just glancing at the code.
Looking at TOP in linux I did see Xorg pretty high up the priority list and usage of CPU time.
For fun I killed that process and crashed the machine. I hoped it might keep running without the screen.
That might be an interesting feature to disable the screen and wake it up with a button .
It’s probably making zero difference to the latency but I did see a bluetooth process running perhaps that’s a requirement but could potentially be disabled.
I am happy with the latency just kind of fascinated by such a cool open source box.

2 Likes

The sleep in the mixer is for control - not audio processing. It avoids a tight loop which consumes CPU rapidly. We only need to react to level, mute, solo, etc. control at a relatively low rate (milliseconds). The audio processing has its own thread of operation and runs at the audio samplerate.

Zyngui is a monolithic process that runs the UI and backend. It depends on X for its GUI so stopping that is not currently possible. We do sleep the display for power saving but do not stop the GUI. We are working on separating the UI from the core which would allow a truely headless device to run. This in itself does not change latency but may reduce the CPU load allowing configuration to provide more CPU to audio process.

Bluetooth service is also being worked on right now in dev. In stable and current testing branches it is not used although the service is still running. The development we are now doing will allow control of the bluetooth service. I am yet to test the imact of stopping the service (it is a small daemon) but will do so and if advantageous, allow it to be disabled from the UI.

2 Likes

Speaking of latency, I know that this isn’t precisely the same thing as the audio latency that is the main topic here, but I’ve run across another project, MiSTer, a “Retro gaming” emulator that also has issues with latency.

Here’s a little snippet from their website:
Controllers: MiSTer supports low-latency USB controllers and can essentially be a “zero lag” solution. I strongly recommend referencing the MiSTerAddons latency database to see which controllers work best, but here’s some cheap USB-based ones that are great… Snip

MiSTer As a Test Tool:
The MiSTer hardware can also be used as a tool for many different uses. My favorite so far, is using it to test the latency of 3rd part controllers. Porkchop Express has been maintaining a database of latency results – And once again, MiSTer is the tool, not the test subject. These latency numbers would apply regardless of where it’s used (although some 3rd part / clone consoles / properly emulated systems/compilations can add their own lag on top of this): RPubs - MiSTer FPGA Input Latency

And the link to an article about the project:

I’m looking at MiSTer for examples of connecting an FPGA, akin to the FAST-FAUST project, not to play Stampede on an Atari 2600, I swear!

2 Likes

thanks for the response very interesting !

I apologize to @Riban for the latency issue… I solved it by reinstalling MixBus on the MacBook (in fact, from tests carried out, I didn’t have any problems on the iMac). Now everything works perfectly… Thank you.

2 Likes

I’m replying to myself here… a further thought: In some ways Zynthian is like a game emulator, but for Synths-Sounds instead of Games-Screens&Sounds. Particularly in the case of ‘engines’ like Dexed that emulate specific hardware.