-
Notifications
You must be signed in to change notification settings - Fork 260
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
Solve the sample-rate-change problem #608
Comments
Actual code in
|
The totally required memory increases with the sample-rate, correct? Would it be possible for the reverb to allocate a delay line for the highest sample-rate supported (96kHz) so that no matter how the sample-rate changes, we would always have enough memory for the delay line already allocated? |
Yes, for sample-rate > 44100Hz, the required memory increases with sample-rate.
Yes it is possible and should be quite simple. I will do a PR. |
This PR allows the reverb to pre-allocate the memory needed for the maximum sample-rate of the synth. That means that on sample rate change there are no memory allocation and the function fluid_revmodel_samplerate_change() should always return FLUID_OK. The PR addresses discussion in #608.
Now reverb initially allocates as much memory needed for the highest sample-rate we support.
For people that want the reverb making use of the Example for an application that wants to run at sample-rate 44100Hz:
|
That doesn't work. |
Yes, this is comprehensible.
I will probably do that later. I feel very few people that could need a version that makes use of little memory. |
The synth exposes the function
fluid_synth_set_sample_rate()
which allows to change the synthesizers sample-rate in real-time. The actual change is not executed immediately. Instead, it is deferred to the next rendering call.With the implementation of #380 and #548, memory allocation in the reverb and chorus is now required when changing the sample-rate. This is still done while rendering. If the allocation fails, there is no way for the caller to know.
How is
fluid_synth_set_sample_rate()
used downstream?In fluidsynth 1.1.x,
fluid_synth_set_sample_rate()
had the following hint:http://www.fluidsynth.org/api-1.x/synth_8h.html#ab614bfeafc8b8b632cf1433f8dfce85a
And this is exactly what I find downstream: Create a synth with an incorrect sample-rate, followed by a call to
fluid_synth_set_sample_rate()
to fix the sample-rate. The real-time capability offluid_synth_set_sample_rate()
is not used. AFAIK it has never been documented as "real-time capable" either.Because of the misusage downstream and its broken concept (returning void, no error handling possible), JJC and I have deprecated
fluid_synth_set_sample_rate()
. Chaning the sample-rate of the synth in real-time is not what we consider to be a valid use-case.Yet, fluidsynth's jack audio driver may require to change the sample-rate of a synth on-the-fly. That's why we need an internal solution. Two approaches are coming to my mind:
Solution 1. would exactly fit the puropse required for the jack driver.
I'm not sure if 2. is possible. In any case, it would be a pessimization for people who use fluidsynth on low-resource-hardware. Although this proposal sounds charming, as it might serve as rescue for the public
fluid_synth_set_sample_rate()
function, keep in mind that an error handling is required, butfluid_synth_set_sample_rate()
returns void.Any opinion how to solve that sample-rate-change problem is highly welcome!
The text was updated successfully, but these errors were encountered: