Incorrect note values with large buffer size and high latency

Official support for: zynaddsubfx.sourceforge.net
RELATED
PRODUCTS

Post

Hello again, whoever reads this.

I have a problem which doesn't seem to have been discussed here earlier. It's probably rather unique.

Sometimes when I use my old desktop computer, I use rather large buffer size. The latency (for example 100 ms) is no problem when I “wright” notes on a midi track, rather then play live.

The funny thing is that Zyn (but no other plugin) starts to “misunderstand” the note values, when the latency is considerable high. For example: a long row of eighth notes – in the midi track – could be played by the computer as a dotted eighth note followed by a sixteenth note, over and over again.

I have to use large buffers when I use this old computer (which has a very good sound card inside, but not very much RAM and a Pentium 4).

Does anybody know if there is any kind of settings I can change that might solve this problem?
To be is to do — Socrates.
To do is to be — Jean-Paul Sartre.
Do be do be do — Frank Sinatra.

Post

Can you kindly clarify what you mean?

Incorrect notes is incorrect pitches? or incorrect timing but correct pitches?
What is note value? is it the length of the note or the pitch of the note?

I can't think of anything now affected by the large buffer size.
I can think of a problem if the sample rate is different than 44.1kHz. (Are you running at 48k by any chance?)

The problem appears only when playing your instrument and does not appear in a midi track? or is it vice-versa?

But then I don't see how you could actually play live with a latency of 100ms (at least it would be a nightmare for me).

Post

The issue makes sense to me as note on times are synchronized to the start of the audio frame where the audio frame length is the buffer size. So with a very large buffer size quick notes will all happen at the same quantized time.
One of the developers on the ZynAddSubFX open source synth
The author of the Zyn-Fusion UI for ZynAddSubFX

Post

OK, I'll clarify, although I think I was rather clear (but “note value” might not be correct English).

It's the timing that's affected. (Perhaps the length as well – it's hard to tell.) But definitely not the pitch.

There is an example with eighth notes in my previous post (or 'message', maybe – English is not my native language).

And as I mentioned, I don't play live with this kind of latency. It's all in the previous message. You can compose using notes (or a midi track). I press Play maybe every second minute and listen if it sounds OK. And at the moment I'm running at 44.1 kHz (and a latency of only 20 ms, since one of the Zyn's Rhodes is one of the instruments; I have modified it a little, though).

Best regards
To be is to do — Socrates.
To do is to be — Jean-Paul Sartre.
Do be do be do — Frank Sinatra.

Post

fundamental wrote:The issue makes sense to me as note on times are synchronized to the start of the audio frame where the audio frame length is the buffer size. So with a very large buffer size quick notes will all happen at the same quantized time.
I have to think about this a little. It sounds complicated. But thanks!
To be is to do — Socrates.
To do is to be — Jean-Paul Sartre.
Do be do be do — Frank Sinatra.

Post

Hi Per,

Sorry, your post was quite clear, but the problem was my poor understanding of musical notation :)

Fundamental's view makes sense to me, it may be the cause of your issues.

I don't have a direct solution, but I do have a question: does your soundcard have ASIO drivers?
100ms latency seems quite a lot to me, even for an old Pentium 4. What version of windows are you using?

Are you using a lot of VST instruments, or just Zyn alone?

If you are using ASIO, What is the ASIO buffer size? Is the ASIO buffer size the same as the internal Zyn buffer size?

The amount of RAM has very little influence on latency.

EDIT: I think it would make sense for your issue, to make the internal Zyn buffer double the real ASIO size buffer.

Cheers!

Post

Dear jackoo!

My sound card is an internal E-MU 0404 from Creative Professional. I use the ASIO drivers that belongs to this specific card. My antique desktop has Windows XP Professional 32 bit installed, SP3. (I also have a laptop with Windows 10, but that machine sounds like a vacuum cleaner when it gets warm.)

I have tried to change the settings according to your suggestions, but with a buffer size bigger than 1024 frames on my sound card, the Zyn's timing gets weird, regardless of what buffer size I choose for Zyn. On the other hand: if I use 1024 (I guess E-MU means 1024 frames but the actual option to choose is 20 ms) everything is fine. There is no step between 20 ms and 50 ms.

Maybe I should mention that I noticed the possibility to swap stereo/pan in Zyn's settings window. Since right and left have been switched all the time, I clicked the button and the light turned yellow (although one would expect the opposite). But noting happened! I closed Cubase and opened again, with the same result, and I even restarted the whole computer. (And then I went back to non-yellow.)

Now – it's really a minor problem that left and right is switched, and Zynaddsubfx is a wonderful piece of software. But I can't help wondering if the other changes I made – the buffer size settings (doubled and many other kind of experiments) – never took place... Or weren't executed – I don't no how you put it in English. Could that be the case? I mean – in the same way as the stereo swap function?

To answer your question: right now I use Zyn together with maybe three other plugins, and I don't experience clicks or other noises to often. But soon I will probably add two or three plugins, and in the end convolution reverb and true stereo (IR). But of course the possibility is always there to render / export one or more tracks. I will never stop using the Zyn's DX Rhodes 1 (with a few edited settings).

According to some forum a number of years ago, I have ticked the box for 'background services' in my XP, which is said to lower latency and CPU load if you use the version of windows that I do.

Cheers!
You do not have the required permissions to view the files attached to this post.
To be is to do — Socrates.
To do is to be — Jean-Paul Sartre.
Do be do be do — Frank Sinatra.

Post

Hi Per,

You are correct! The stereo is wrong in 496beta and the swap_stereo option does not work.
I've recompiled the dll and fixed this issue:

ZynAddSubFX VST v2.4.1.505beta (direct dropbox link)
Now by default the left and right channels are correct, but you can also switch them.
There are also some new banks gathered from a lot of places, and some sound trials I did myself (in the VDX, VDX2, VDX3 banks). Unfortunately, I can't just make a 64bit version easily.

Some Zyn settings you can find also in the configuration file: zynaddsubfx.cfg
This file should be located in the same folder where the plugin dll is.

You can even edit some lines manually.

Code: Select all

<par name="sound_buffer_size" value="256"/>
<par name="oscil_size" value="1024"/>
<par name="swap_stereo" value="0"/>
Now latency calculated from ASIO buffer size and Sample rate is as follows:

Latency [ms] = ASIO Buffer Size [samples] / Sampling Rate [kHz]
Alternatively: ASIO Buffer Size = Latency [ms] * Sampling Rate [kHz]

So for 512 samples at 44.1 kHz the latency is about 11.6 ms (if no extra buffers for audio input are considered).

You seem to have a really nice soundcard, BTW :)
Now suppose you set your soundcard says 50ms (where you experience issues). This would mean that the Asio Buffer size is 2205 samples. I would suggest that you put the same value in the cfg file: <par name="sound_buffer_size" value="2205" and see if there is any improvement.

You could also try with the closest power of 2: 4096 samples
I can try to replicate the bug with the very long buffer... but it may take some time.

LATE EDIT: Disregard what I've said; use

Code: Select all

<par name="sound_buffer_size" value="256"/>
<par name="oscil_size" value="512"/>
I've managed to replicate the effect. The smaller the numbers, the better (regardless of the real ASIO buffer). But, indeed, if the ASIO buffer is really large it doesn't work anymore.

I don't know how to fix this now. Sorry. Will think over...
Seems to me that the max buffer supported by Zyn is 2^13=8192 samples or about 185ms
== VDX == One Man can make a difference!
My music is on https://soundcloud.com/vdxi | Info | More Info

Post

Hello there, how's the weather in the US?

In the VST_README in the folder where the the new .dll file is – .505 – (thanks for all extra stuff!) there is one thing I don't understand:

- To sync to host tempo use this:
- Delay param = 5080 / HOST BPM => synced to 1 beat
- If you want to sync to a quarter note divide upper calculation by 4

I've looked through the cfg-file, but I can't see any parameter with a name like that. May I ask, if it's not in the cfg – where is it? It can hardly be something in the host (?)

Also, I thought that 1 beat is equal to a quarter note. For example, 120 BPM means 120 quarter notes per minute (not 120 bars, as far as I know).

Regarding the mysterious timing problems we have discussed earlier: I'd appreciate if there is a real solution to the problem. But I realized earlier today that the stereo reverb that's a part of my sound card is real great. If I use that one instead of IR:s etc I'll be fine anyway (that reverb doesn't require any CPU at all).

But maybe the solution to “strange timing” will turn out to be useful, somehow, in some other way?

Best regards
To be is to do — Socrates.
To do is to be — Jean-Paul Sartre.
Do be do be do — Frank Sinatra.

Post

You're right. Seems 1 quarter note is usually one beat.
My bad.

This is intended to sync the echo effect to some BPM.
It is not a setting.
Just divide the number 5080 by the BPM. You now have a real number between 1 and 127. (if BPM above 40).

Go to the delay knob of the echo effect window, ctrl+left click on delay knob, enter manually the calculated value with 2 decimal points precision.
Now the delay time is precisely 1beat.
Divide to 2, or 4 or 8 as it would be appropriate, to sync for fractions of a beat.

Post

The strange timing is related to what fundamental said.

It is in my opinion an architecture issue and difficult to fix. I managed to replicate the issue, but found no solution. I'm sorry for that.

Perhaps Zyn-Fusion deals better with this issue.

Post

Well, the solution is to use a smaller buffer size which the Zyn-fusion plugin will do by default. Fundamentally, larger buffer sizes are more efficient and they result in more quantization. There's some workarounds which can be done to mitigate some of the quantization, but they've been low priority, so programmatically they haven't been implemented so far.
One of the developers on the ZynAddSubFX open source synth
The author of the Zyn-Fusion UI for ZynAddSubFX

Post

fundamental wrote:Well, the solution is to use a smaller buffer size which the Zyn-fusion plugin will do by default. Fundamentally, larger buffer sizes are more efficient and they result in more quantization. There's some workarounds which can be done to mitigate some of the quantization, but they've been low priority, so programmatically they haven't been implemented so far.
Don't take it I'm disappointed or anything. I will probably stick to classic Zynaddsubfx for a while (discovered it just a few month ago). It's amazing.

And once I've understood how those unlimited number of oscillators work (and if they're all sine or not) I will definitely try to create sounds / instruments on my own.
To be is to do — Socrates.
To do is to be — Jean-Paul Sartre.
Do be do be do — Frank Sinatra.

Post

This should be now fixed in 512beta.

Post

jackoo wrote: Fri Jun 05, 2020 9:51 am This should be now fixed in 512beta.
That's great! So how did you manage to fix this? (Don't care to wright a very long explanation, as I will probably understand nothing.)

A couple of months ago I switched DAW from Cubase to REAPER. And now I can't hear the tones when I place new notes, one by one, in the midi editor. When I press the play button everything works as usual, but not when I double click to create new notes. As I remember it this problem didn't occur in Cubase. Have you heard about it before?
To be is to do — Socrates.
To do is to be — Jean-Paul Sartre.
Do be do be do — Frank Sinatra.

Post Reply

Return to “ZynAddSubFX”