I am trying to find out at what sample rate the Zynthian is working. The HiFiBerry DAC+ supports up to 192000Hz, which is nice.
I found the /zynthian/zynthian-sys/etc/zynaddsubfxXML.cfg
The sample rate was set to 48.000 and I was able to increase to 192000 - and it still works - but I am not sure that this is all. Maybe the sound card itself must be set up to use the higher sample rate. What software/driver architecture is working inside the zythian? Can someone point me in the right direction?
The reason for this test: A friend told me that a higher sample rate affects (besides the sound quallity) the latency of a sound card in a positve way. So I will try to do a latancy test as well (not sure if this will work out as planned ).
Setup
Device: Zynthian with RPi 3 / Hifiberry
Software: Mod-Ui + ZynAddSubFX (Preset Hyper Organ 1)
Input Chain: PC with Ableton -USB> Sound Card (Steinberg UR22) -MIDI> Zynthian
Output Chain: Zynthian -Jack> Sound Card (UR22) -USB> PC with Ableton
Thats quite a long input chain but I wanted to use Ableton for MIDI input in order to make sure that the input does not depend on Human timing. On the other Hand we have now to keep in mind, that the latency shown in the data below is the result of the whole input and output chain.
50.3% and going into red alert mode. I have tried other patches and reached higher CPU load values but reached only in rare cases the red alert.
Uh whats that! ~33ms - lets try again -> OK its repeatable. Too bad that it is too hard for the Pi`s CPU.
For now I will stick to the 48000Hz. There seems to be no advantage for the latency but it is just increasing a little bit the CPU-load and according to Wikipedia: 48000Hz: The standard audio sampling rate used by professional digital video equipment ...
Thanks for testing and reporting! Hm… what you also can try is the following:
Buffer size, sometimes called frames/period
In a nutshell - Smaller buffer sizes produce less monitoring latency.
More in-depth details - A lower setting will make the computer work faster, which will allow for lower latency, but at
the expense of increased CPU usage. Higher (larger) settings are more stable but you won't get low monitoring
latency with them. If you are looking to achieve low latency monitoring, a setting between 64 – 256 will give you
usable results.
(from http://libremusicproduction.com/articles/demystifying-jack-%E2%80%93-beginners-guide-getting-started-jack)
For jack there are two parameters -p, --period int and -n, --nperiods int. The last is already set to 2 and cannot be lowered. But --period is currently set to 256. You can change this parameter to something with a power of 2… lower means more CPU usage and faster getting xruns. Try 128 or 64 in combination with a higher samplerate - perhaps this can minimize the latency a little bit - perhaps with xruns.
You can set these values in /etc/systemd/system/jack2.service. Don’t forget the following after changing:
I don’t think that this will help very much… the CPU power is limited and minimizing the latency means raising the posibility of xruns - this depends hardly on your setup (number of plugins, complexity of plugins).
I understand you are using an instrument from Ableton as reference, is it correct?
In theory, the latency difference when using 96000 and 44100, maintaining the other parameters (periods=256, nperiods=2) should be easy to calculate:
jack latency=(nperiodsperiod)/(nchansfreq) freq=44100 =>(2256)/(244100)=5.8ms freq=96200 =>(2256)/(296000)=2.9ms
So, the difference should be 2.9 ms. Your measure is slighty more, about twice. Probably it’s a preccission matter. Your “external” latency it too high and it’s difficult to appreciate the difference. What do you think?
Regarding the sampling frecuency (48000 vs 44100):
44100 (and 88200) is the standard for audio
48000 (and 96000) is used for video.
As Zynthian is an audio machine, it uses 44100 by default
I have measured how long it takes until a Midi-Note send by Ableton comes back into Ableton as an audio signal from the Zynthian. But I am using an external USB sound card (Steinberg UR22) for sending the MIDI and recording the audio.
Yes I guess that is the thing I learned doing the test - most of the lantency comes from the USB sound card. (output latency + input latency = too much latency). My buffer settings for the USB soundcard are already low. If they where set to even lower values clips and pops are staring to emerge. So I tryed to minimize the Zynthians latency:
But it is just a try - I think the original parameters are better in most cases because they are less CPU intensive and it is very likely that I will revert back to them.
Is this still valid? I saw that several standard interface configurations come with a samplerate of 48000 by default in the jackd options (example of the UCA222). I’m trying to find the best configuration for my focusrite solo… that’s why the question…