Chorus enhancement. (#548)

This adds new LFO modulators:
 - these modulators are computed on the fly, instead of using lfo lookup table. Advantages:
      - Avoiding a lost of 608272 memory bytes when lfo speed is low (0.3Hz).
      - Allows to diminish the lfo speed lower limit to 0.1Hz instead of 0.3Hz.
        A speed of 0.1 is interesting for chorus. Using a lookup table for 0.1Hz
        would require too much memory (1824816 bytes).
      - Make use of first-order all-pass interpolator instead of bandlimited interpolation.
      - Although lfo modulator is computed on the fly, cpu load is lower than using
        lfo lookup table with bandlimited interpolator.

Also adds a stereo unit controlled by WIDTH macro. WIDTH [0..10] value define a stereo separation between left and right.
 - When 0, the output is monophonic.
 - When > 0 , the output is stereophonic.

 WIDTH is currently fixed to maximum value to provide maximum stereo effect.
This commit is contained in:
jjceresa 2019-10-23 16:41:13 +02:00 committed by Tom M
parent f2b7438511
commit 0288466f40
5 changed files with 752 additions and 352 deletions

View File

@ -73,7 +73,7 @@ Developers: Settings can be deprecated by adding: <deprecated>SOME TEXT</depreca
<name>chorus.speed</name> <name>chorus.speed</name>
<type>num</type> <type>num</type>
<def>0.3</def> <def>0.3</def>
<min>0.29</min> <min>0.1</min>
<max>5</max> <max>5</max>
<desc> <desc>
Sets the modulation speed in Hz.</desc> Sets the modulation speed in Hz.</desc>

View File

@ -21,6 +21,7 @@ All the source code examples in this document are in the public domain; you can
- \ref Disclaimer - \ref Disclaimer
- \ref Introduction - \ref Introduction
- \ref NewIn2_1_0
- \ref NewIn2_0_7 - \ref NewIn2_0_7
- \ref NewIn2_0_6 - \ref NewIn2_0_6
- \ref NewIn2_0_5 - \ref NewIn2_0_5
@ -65,6 +66,9 @@ What is FluidSynth?
- FluidSynth is open source, in active development. For more details, take a look at http://www.fluidsynth.org - FluidSynth is open source, in active development. For more details, take a look at http://www.fluidsynth.org
\section NewIn2_1_0 Whats new in 2.1.0?
- smallest allowed chorus speed is now 0.1 Hz (previously 0.29 Hz)
\section NewIn2_0_7 Whats new in 2.0.7? \section NewIn2_0_7 Whats new in 2.0.7?

File diff suppressed because it is too large Load Diff

View File

@ -49,7 +49,6 @@ typedef enum
*/ */
fluid_chorus_t *new_fluid_chorus(fluid_real_t sample_rate); fluid_chorus_t *new_fluid_chorus(fluid_real_t sample_rate);
void delete_fluid_chorus(fluid_chorus_t *chorus); void delete_fluid_chorus(fluid_chorus_t *chorus);
int fluid_chorus_init(fluid_chorus_t *chorus);
void fluid_chorus_reset(fluid_chorus_t *chorus); void fluid_chorus_reset(fluid_chorus_t *chorus);
void fluid_chorus_set(fluid_chorus_t *chorus, int set, int nr, fluid_real_t level, void fluid_chorus_set(fluid_chorus_t *chorus, int set, int nr, fluid_real_t level,

View File

@ -198,7 +198,7 @@ void fluid_synth_settings(fluid_settings_t *settings)
fluid_settings_register_int(settings, "synth.chorus.active", 1, 0, 1, FLUID_HINT_TOGGLED); fluid_settings_register_int(settings, "synth.chorus.active", 1, 0, 1, FLUID_HINT_TOGGLED);
fluid_settings_register_int(settings, "synth.chorus.nr", FLUID_CHORUS_DEFAULT_N, 0, 99, 0); fluid_settings_register_int(settings, "synth.chorus.nr", FLUID_CHORUS_DEFAULT_N, 0, 99, 0);
fluid_settings_register_num(settings, "synth.chorus.level", FLUID_CHORUS_DEFAULT_LEVEL, 0.0f, 10.0f, 0); fluid_settings_register_num(settings, "synth.chorus.level", FLUID_CHORUS_DEFAULT_LEVEL, 0.0f, 10.0f, 0);
fluid_settings_register_num(settings, "synth.chorus.speed", FLUID_CHORUS_DEFAULT_SPEED, 0.29f, 5.0f, 0); fluid_settings_register_num(settings, "synth.chorus.speed", FLUID_CHORUS_DEFAULT_SPEED, 0.1f, 5.0f, 0);
fluid_settings_register_num(settings, "synth.chorus.depth", FLUID_CHORUS_DEFAULT_DEPTH, 0.0f, 256.0f, 0); fluid_settings_register_num(settings, "synth.chorus.depth", FLUID_CHORUS_DEFAULT_DEPTH, 0.0f, 256.0f, 0);
fluid_settings_register_int(settings, "synth.ladspa.active", 0, 0, 1, FLUID_HINT_TOGGLED); fluid_settings_register_int(settings, "synth.ladspa.active", 0, 0, 1, FLUID_HINT_TOGGLED);
@ -5272,7 +5272,7 @@ fluid_synth_set_chorus_on(fluid_synth_t *synth, int on)
* @param nr Chorus voice count (0-99, CPU time consumption proportional to * @param nr Chorus voice count (0-99, CPU time consumption proportional to
* this value) * this value)
* @param level Chorus level (0.0-10.0) * @param level Chorus level (0.0-10.0)
* @param speed Chorus speed in Hz (0.29-5.0) * @param speed Chorus speed in Hz (0.1-5.0)
* @param depth_ms Chorus depth (max value depends on synth sample rate, * @param depth_ms Chorus depth (max value depends on synth sample rate,
* 0.0-21.0 is safe for sample rate values up to 96KHz) * 0.0-21.0 is safe for sample rate values up to 96KHz)
* @param type Chorus waveform type (#fluid_chorus_mod) * @param type Chorus waveform type (#fluid_chorus_mod)
@ -5330,19 +5330,6 @@ int fluid_synth_set_chorus_type(fluid_synth_t *synth, int type)
return fluid_synth_set_chorus_full(synth, FLUID_CHORUS_SET_TYPE, 0, 0, 0, 0, type); return fluid_synth_set_chorus_full(synth, FLUID_CHORUS_SET_TYPE, 0, 0, 0, 0, type);
} }
/**
* Set one or more chorus parameters.
* @param synth FluidSynth instance
* @param set Flags indicating which chorus parameters to set (#fluid_chorus_set_t)
* @param nr Chorus voice count (0-99, CPU time consumption proportional to
* this value)
* @param level Chorus level (0.0-10.0)
* @param speed Chorus speed in Hz (0.29-5.0)
* @param depth_ms Chorus depth (max value depends on synth sample rate,
* 0.0-21.0 is safe for sample rate values up to 96KHz)
* @param type Chorus waveform type (#fluid_chorus_mod)
* @return #FLUID_OK on success, #FLUID_FAILED otherwise
*/
int int
fluid_synth_set_chorus_full(fluid_synth_t *synth, int set, int nr, double level, fluid_synth_set_chorus_full(fluid_synth_t *synth, int set, int nr, double level,
double speed, double depth_ms, int type) double speed, double depth_ms, int type)
@ -5399,7 +5386,7 @@ fluid_synth_set_chorus_full(fluid_synth_t *synth, int set, int nr, double level,
/** /**
* Get chorus voice number (delay line count) value. * Get chorus voice number (delay line count) value.
* @param synth FluidSynth instance * @param synth FluidSynth instance
* @return Chorus voice count (0-99) * @return Chorus voice count
*/ */
int int
fluid_synth_get_chorus_nr(fluid_synth_t *synth) fluid_synth_get_chorus_nr(fluid_synth_t *synth)
@ -5415,7 +5402,7 @@ fluid_synth_get_chorus_nr(fluid_synth_t *synth)
/** /**
* Get chorus level. * Get chorus level.
* @param synth FluidSynth instance * @param synth FluidSynth instance
* @return Chorus level value (0.0-10.0) * @return Chorus level value
*/ */
double double
fluid_synth_get_chorus_level(fluid_synth_t *synth) fluid_synth_get_chorus_level(fluid_synth_t *synth)
@ -5431,7 +5418,7 @@ fluid_synth_get_chorus_level(fluid_synth_t *synth)
/** /**
* Get chorus speed in Hz. * Get chorus speed in Hz.
* @param synth FluidSynth instance * @param synth FluidSynth instance
* @return Chorus speed in Hz (0.29-5.0) * @return Chorus speed in Hz
*/ */
double double
fluid_synth_get_chorus_speed(fluid_synth_t *synth) fluid_synth_get_chorus_speed(fluid_synth_t *synth)