Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

96/192 kHz models are severely high passed #62

Closed
38github opened this issue Apr 9, 2024 · 19 comments
Closed

96/192 kHz models are severely high passed #62

38github opened this issue Apr 9, 2024 · 19 comments

Comments

@38github
Copy link

38github commented Apr 9, 2024

I noticed that models that are 96/192 kHz are severely high passed compared to the official NAM VST3. The attached files was rendered at 192kHz and then resampled down to 48 kHz AAC/MP4.

First half is VST3 and second one is LV2 (win64):

vst_vs_lv2.mp4

Model used:
lstm-192khz.nam.zip

Update: No model is needed to be loaded to achieve the high pass.

@mikeoliphant
Copy link
Owner

That's likely the DC blocker (which correct the model's DC offset). The coefficient should be based on the sample rate.

@mikeoliphant
Copy link
Owner

Can you try the latest version? I just made a change to adjust the dc blocker coefficient based on sample rate. It should be mostly the same (actually a bit less aggressive) at 48k, but much less aggressive at higher rates.

@38github
Copy link
Author

Can you try the latest version? I just made a change to adjust the dc blocker coefficient based on sample rate. It should be mostly the same (actually a bit less aggressive) at 48k, but much less aggressive at higher rates.

Great job! Is it possible to lower it somewhat more without dc happening? I feel pretty certain that I hear the very lowest of lows are taken out at 96/192 when I use EQ models.

@38github
Copy link
Author

I don't know how to properly measure or visualize these very low frequencies so all I can do is listen and do changes. This might lead to placebo effect but I believe that float dcBlockCoefficient = 1 - (55.0 / sampleRate);retains most of the very lows at 192 kHz. At 48 kHz I feel certain that I do not hear a difference.If this value is effective against DC I don't know.

Please correct my assumptions and possible placebos.

@mikeoliphant
Copy link
Owner

There are a couple of things that can be done to actually measure things.

To compare the lv2 with the official NAM plugin, you can run the same audio through both and null test them. To do that, you subtract one from the other and then look at the frequency spectrum of the diff.

To measure the impact of the lv2 dc blocker, you would want to run full spectrum noise through the plugin with no model loaded and see what effect it has. If the impacted low frequency range is larger at higher sample rates, then my coefficient scaling isn't working correctly.

@38github
Copy link
Author

There are a couple of things that can be done to actually measure things.

To compare the lv2 with the official NAM plugin, you can run the same audio through both and null test them. To do that, you subtract one from the other and then look at the frequency spectrum of the diff.

To measure the impact of the lv2 dc blocker, you would want to run full spectrum noise through the plugin with no model loaded and see what effect it has. If the impacted low frequency range is larger at higher sample rates, then my coefficient scaling isn't working correctly.

I will probably do a null test soon and in the mean time I will continue using the value 55.0 and see if I get any DC issues. I will let you know when I have done any comparisons. Regards.

@mikeoliphant
Copy link
Owner

Btw, checking for DC offset is easy. Just look at the resulting waveform and see if it is centered on zero or not.

@mikeoliphant
Copy link
Owner

I did some frequency analysis, and the dc blocker is definitely cutting out more low end than I'd like. I'll look into alternatives.

@mikeoliphant
Copy link
Owner

Strangely, I'm not seeing DC offsets now even with the DC blocker code completely removed.

It definitely used to be a problem:

#41

@38github
Copy link
Author

Strangely, I'm not seeing DC offsets now even with the DC blocker code completely removed.

It definitely used to be a problem:

#41

Interesting! I will try it with many different LSTM settings (num_layers_, hidden_size, etc) and see if I get any issues.

@mikeoliphant
Copy link
Owner

I'm seeing the same behavior (no DC offset even with DC offset correction code removed) in the official NAM plugin.

@mikeoliphant
Copy link
Owner

I tried with a really old version of the lv2 plugin, and I still couldn't get a DC offset to happen. Maybe I'm just not trying the right models (although I recall the issue being pretty pervasive). If you can get a DC offset, please share the model.

@38github
Copy link
Author

I tried with a really old version of the lv2 plugin, and I still couldn't get a DC offset to happen. Maybe I'm just not trying the right models (although I recall the issue being pretty pervasive). If you can get a DC offset, please share the model.

I will do that!

@38github
Copy link
Author

I haven't experienced any DC issues yet with a value of 25.0. I am interested though in what I need to change to disable it completely like you mentioned.

@mikeoliphant
Copy link
Owner

You just need to comment out the whole DC blocker loop:

for (unsigned int i = 0; i < n_samples; i++)
{
float dcInput = ports.audio_out[i];
// dc blocker
ports.audio_out[i] = ports.audio_out[i] - prevDCInput + dcBlockCoefficient * prevDCOutput;
prevDCInput = dcInput;
prevDCOutput = ports.audio_out[i];
}

@38github
Copy link
Author

You just need to comment out the whole DC blocker loop:

for (unsigned int i = 0; i < n_samples; i++)
{
float dcInput = ports.audio_out[i];
// dc blocker
ports.audio_out[i] = ports.audio_out[i] - prevDCInput + dcBlockCoefficient * prevDCOutput;
prevDCInput = dcInput;
prevDCOutput = ports.audio_out[i];
}

Thank you once again!

@38github
Copy link
Author

38github commented Sep 3, 2024

The current settings affect the low frequencies too much in my opinion. Try nulling a model loaded in neural-amp-modeler-lv2 against the captured file. Now also try the same model with with e.g. Ratatouille lv2 or the official plugin.

@mikeoliphant
Copy link
Owner

I'd been planning to revisit this once I had a model that was showing dc offset issues so that I could see what (if any) trade-off a subtler high pass has. I haven't been able to find a model that has dc offset issues, though.

I may just remove the dc blocker all together.

@mikeoliphant
Copy link
Owner

I went ahead and removed the dc blocker, since it seemed to be doing more harm than good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants