Performance & host sampling rate

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

Hi,

I'm developing a VST instrument (duh) and so far so good, but I'm at the stage where some optimization is due.

Obviously the first thing that explodes is an upsampling stage I've built in, but given there's enough headroom in the signal to begin width I dont, or only partially, need to do so. So that's #1.

But what if someone decides to set his/her Focusrite (or at least that's what I use) to 192Khz: what would be preferred, sluggish rendering or something like an internal sampling rate (fixed) at let us say 48Khz?

When rendering to disk I would never opt for the latter option so maybe it's a dumb question, but this is my first VST, and I ain't got no clue as to what the norm is ;-)

Thanks,
- Niels

Post

Our mantra is to never change what the user has set up purposely (no matter if we think it makes sense or not). I've seen some synths or convolution reverbs downsample everything to 44.1kHz for performance reasons which is a total no-go and fail imo. Make the upsamling factor/target samplerate optional is surely an option.

What do you mean by sluggish rendering? Is it just some sort of delay for audio data or is it a complete fps dropdown. The latter one should not happen because the UI gets updated/rendered in a separate thread.

Post

Why not have the user decide it with a button on the GUI?

There are plenty of instruments with a "high quality" switch that lets it run at 4x the project sampling rate.
We are the KVR collective. Resistance is futile. You will be assimilated. Image
My MusicCalc is served over https!!

Post

BlueprintInc wrote: Wed Apr 08, 2020 11:57 am Our mantra is to never change what the user has set up purposely (no matter if we think it makes sense or not). I've seen some synths or convolution reverbs downsample everything to 44.1kHz for performance reasons which is a total no-go and fail imo. Make the upsamling factor/target samplerate optional is surely an option.
I feel like the question of internal processing rate is actually a bit more complicate than that, even though I generally agree when it comes to basic plugins like EQs and such. If someone is recording at 192kHz, they might or might not have a reason for that (eg. maybe they intend to slow the recoding down a lot or something; this is not that uncommon in sound effect design and such) and nothing is worse than plugin's losing the extra spectrum you specifically wanted to preserve.

That said, for something like a convolution reverb using 44.1kHz IRs you'll end up having to resampling something anyway and the results are theoretically (assuming perfect resampling filters) the same either way. With non-uniform partitioning with expected approximate O(logN) scaling the CPU hit of higher rate convolution is unlikely to be serious, but you'll end up having to use proportionally more memory (and memory usage of an efficient algorithm can get somewhat non-trivial for long impulses).

For other plugins, say an algorithmic reverb that intentionally takes advantage of BLT frequency warping (eg. for damping filters), you might always want to process at the exact same sampling rate, because the sound would change too much if the sampling rate was allowed to vary. For yet other plugins (eg. a synth) the exact sampling rate might not be critical, but you might need a certain minimum internal sampling rate to avoid obvious aliasing, yet using the same amount of oversampling with higher host sampling rates might not be necessary [though in this case, if you're going to vary the oversampling at run-time anyway, it would likely be easy to provide an option].

That said, I generally agree with the basic premise that one should not use such strategies for CPU performance alone; most users are quite capable of understanding that increasing the sampling rate is likely to increase the CPU cost by the same amount and if they choose to do so and there are no other obvious problems, then really it's the user's choice.

Post

BlueprintInc wrote: Wed Apr 08, 2020 11:57 am Our mantra is to never change what the user has set up purposely (no matter if we think it makes sense or not). I've seen some synths or convolution reverbs downsample everything to 44.1kHz for performance reasons which is a total no-go and fail imo.
Yes in terms of audio quality: change something for the good (higher samplerate, more parameter smoothing, ...) and it's okay, change something for the bad (downsampling, less accurate filters, ...) make it optional. I hate to be belittled by companies telling me higher sample rates are useless and that's why they use a fixed 44.1 sample rate bla bla. That's only close minded.

To the op: some DAWs need to explicitely enable to notify the plugin about realtime/offline processing. So in the worst case you end up using a fixed 48khz all the time if the user doesn't know about that.

Performance is important but many companies have shown you don't need to compromise between performance and quality.

Post

Thank you all for your replies. What I know of my synth. (an instrument) is that higher rates means higher overall 'smoothness'; though obviously it comes at a cost if the host tells me to do so at a (very) high rate. I had this idea of offering an option to internally process everything at 48KHz and sampling it back up but of course in that case: the user should just set it to 48Khz, right?

But one thing I do need to address is specific oversampling I do in my post processing chain; I can check if I have the headroom I need and if so, upsample less or not at all.

That said I'll give all answers another read!

Thank you all.

Post

njdewit wrote: Thu Apr 09, 2020 10:58 am Thank you all for your replies. What I know of my synth. (an instrument) is that higher rates means higher overall 'smoothness'; though obviously it comes at a cost if the host tells me to do so at a (very) high rate. I had this idea of offering an option to internally process everything at 48KHz and sampling it back up but of course in that case: the user should just set it to 48Khz, right?
Keep in mind that the sampling rate might not be a multiple of 48kHz. In theory it could be anything, but multiples of 44.1kHz are actually common. For example, if the host is running at 88.2kHz, you'd need to upsample with a fractional rate. If the host was running at 44.1kHz you would then need to downsample instead with a fractional rate. This is almost certainly a bad idea and a pretty big can of worms when it comes to correct implementation.

Post

Yeah, that it would be a can of worms is something I realized as well :) So nah, I'll keep it as is and let the user make a sane choice depending on his or her situation and needs.

Post

Just go with a 32khz sampling rate and call it 'Vintage Vibe'! :D

Your best bet is to settle on an algorithm that allows you to downsample to any rate. Usually, upsampling shouldn't cost you an arm and a leg and you just target a specific internal rate that you think gives you the best sound for CPU usage. The upsample rate can also easily be made user selectable. Then, downsample to the DAW selected sample rate.

Regarding "sluggishness", the only issue here (other than CPU usage, which the user will already know is a trade off) is with latency. With a synth, this may or may not be an issue, but if your VST needs to process a number of samples before it starts outputting, then it should just report the latency to the DAW and let the DAW handle it.
I started on Logic 5 with a PowerBook G4 550Mhz. I now have a MacBook Air M1 and it's ~165x faster! So, why is my music not proportionally better? :(

Post Reply

Return to “DSP and Plugin Development”