[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [fluid-dev] [PATCH] Effect level clip
From: |
Josh Green |
Subject: |
Re: [fluid-dev] [PATCH] Effect level clip |
Date: |
Mon, 17 Sep 2007 00:43:30 -0700 |
Hello David,
This patch also doesn't seem right, although I admit I'm not yet fully
informed on the Reverb/Chorus settings within FluidSynth. Perhaps you
could describe what you are trying to accomplish with the Reverb and
Chorus level per voice updating, since that is something I did not
understand with your patch.
Notes on Reverb/Chorus levels (for reference):
The Reverb and Chorus level parameters are defined as generators (Reverb
and Chorus send) which also allow for real-time modulation control.
The level is then defined globally with the Reverb and Chorus effect
levels.
I don't currently see the need to do per-voice assignment of the global
Reverb and Chorus levels (any updates will be reflected when new voices
are created). Reverb/Chorus send level modulation on the other hand, is
handled by fluid_voice_update_param().
I think I need to get a better idea of how your patch is helping to keep
Reverb and Chorus at a more constant output level, regardless of the
synth.gain setting.
Best regards,
Josh
On Mon, 2007-09-03 at 18:46 -0500, David Hilvert wrote:
> On Sun, 02 Sep 2007 20:40:35 -0700
> Josh Green <address@hidden> wrote:
>
> > I was hoping you might be able to comment on why the calls to
> > fluid_voice_set_param occurs within the fluid_synth_one_block() function
> > (in other words, it gets assigned every 64 output samples for each
> > voice, whether the value has changed or not). It seems like these calls
> > could instead occur when the chorus or reverb levels are assigned?
>
> Something like this?
>
> Index: src/fluid_cmd.c
> ===================================================================
> --- src/fluid_cmd.c (revision 117)
> +++ src/fluid_cmd.c (working copy)
> @@ -746,7 +746,7 @@
> fluid_ostream_printf(out, "rev_setlevel: Value too high! (Value of 10
> =+20 dB)\n");
> return 0;
> }
> - fluid_revmodel_setlevel(synth->reverb, level);
> + fluid_synth_set_reverb_level(synth, level);
> return 0;
> }
>
> @@ -800,7 +800,7 @@
> return -1;
> }
> level = atof(av[0]);
> - fluid_chorus_set_level(synth->chorus, level);
> + fluid_synth_set_chorus_level(synth, level);
> return fluid_chorus_update(synth->chorus);
>
> }
> Index: src/fluid_voice.c
> ===================================================================
> --- src/fluid_voice.c (revision 117)
> +++ src/fluid_voice.c (working copy)
> @@ -1969,6 +1969,24 @@
> return FLUID_OK;
> }
>
> +int fluid_voice_set_reverb(fluid_voice_t* voice, fluid_real_t level)
> +{
> + fluid_voice_set_param(voice, GEN_REVERBSEND,
> + 1000.0
> + * (level - FLUID_REVERB_DEFAULT_LEVEL)
> + / FLUID_REVERB_DEFAULT_LEVEL, 1 /* ? */);
> + return FLUID_OK;
> +}
> +
> +int fluid_voice_set_chorus(fluid_voice_t* voice, fluid_real_t level)
> +{
> + fluid_voice_set_param(voice, GEN_CHORUSSEND,
> + 1000.0
> + * (level - FLUID_CHORUS_DEFAULT_LEVEL)
> + / FLUID_CHORUS_DEFAULT_LEVEL, 1 /* ? */);
> + return FLUID_OK;
> +}
> +
> /* - Scan the loop
> * - determine the peak level
> * - Calculate, what factor will make the loop inaudible
> Index: src/fluid_voice.h
> ===================================================================
> --- src/fluid_voice.h (revision 117)
> +++ src/fluid_voice.h (working copy)
> @@ -235,7 +235,13 @@
> /** Set the gain. */
> int fluid_voice_set_gain(fluid_voice_t* voice, fluid_real_t gain);
>
> +/** Set reverb effect. */
> +int fluid_voice_set_reverb(fluid_voice_t* voice, fluid_real_t level);
>
> +/** Set chorus effect. */
> +int fluid_voice_set_chorus(fluid_voice_t* voice, fluid_real_t level);
> +
> +
> /** Update all the synthesis parameters, which depend on generator
> 'gen'. This is only necessary after changing a generator of an
> already operating voice. Most applications will not need this
> Index: src/fluid_synth.c
> ===================================================================
> --- src/fluid_synth.c (revision 117)
> +++ src/fluid_synth.c (working copy)
> @@ -1513,6 +1513,22 @@
> }
>
> /*
> + * fluid_synth_set_reverb_level
> + */
> +void fluid_synth_set_reverb_level(fluid_synth_t* synth, double level)
> +{
> + int i;
> +
> + fluid_revmodel_setlevel(synth->reverb, level);
> + for (i = 0; i < synth->polyphony; i++) {
> + fluid_voice_t* voice = synth->voice[i];
> + if (_PLAYING(voice)) {
> + fluid_voice_set_reverb(voice, level);
> + }
> + }
> +}
> +
> +/*
> * fluid_synth_set_chorus
> */
> void fluid_synth_set_chorus(fluid_synth_t* synth, int nr, double level,
> @@ -1529,6 +1545,22 @@
> fluid_chorus_update(synth->chorus);
> }
>
> +/*
> + * fluid_synth_set_chorus_level
> + */
> +void fluid_synth_set_chorus_level(fluid_synth_t* synth, double level)
> +{
> + int i;
> +
> + fluid_chorus_set_level(synth->chorus, level);
> + for (i = 0; i < synth->polyphony; i++) {
> + fluid_voice_t* voice = synth->voice[i];
> + if (_PLAYING(voice)) {
> + fluid_voice_set_chorus(voice, level);
> + }
> + }
> +}
> +
> /******************************************************
>
> #define COMPRESS 1
> @@ -1866,8 +1898,6 @@
> fluid_real_t* chorus_buf;
> int byte_size = FLUID_BUFSIZE * sizeof(fluid_real_t);
> double prof_ref = fluid_profile_ref();
> - fluid_real_t chorus_level = fluid_chorus_get_level(synth->chorus);
> - fluid_real_t reverb_level = fluid_revmodel_getlevel(synth->reverb);
>
> /* fluid_mutex_lock(synth->busy); /\* Here comes the audio thread. Lock
> the synth. *\/ */
>
> @@ -1926,14 +1956,6 @@
> left_buf = synth->left_buf[auchan];
> right_buf = synth->right_buf[auchan];
>
> - fluid_voice_set_param(voice, GEN_CHORUSSEND,
> - 1000.0
> - * (chorus_level - FLUID_CHORUS_DEFAULT_LEVEL)
> - / FLUID_CHORUS_DEFAULT_LEVEL, 1 /* ? */);
> - fluid_voice_set_param(voice, GEN_REVERBSEND,
> - 1000.0
> - * (reverb_level - FLUID_REVERB_DEFAULT_LEVEL)
> - / FLUID_REVERB_DEFAULT_LEVEL, 1 /* ? */);
> fluid_voice_write(voice, left_buf, right_buf, reverb_buf, chorus_buf);
>
> fluid_profile(FLUID_PROF_ONE_BLOCK_VOICE, prof_ref_voice);
> @@ -2102,6 +2124,8 @@
> int i, k;
> fluid_voice_t* voice = NULL;
> fluid_channel_t* channel = NULL;
> + fluid_real_t chorus_level = fluid_chorus_get_level(synth->chorus);
> + fluid_real_t reverb_level = fluid_revmodel_getlevel(synth->reverb);
>
> /* fluid_mutex_lock(synth->busy); /\* Don't interfere with the audio
> thread *\/ */
> /* fluid_mutex_unlock(synth->busy); */
> @@ -2162,6 +2186,9 @@
> fluid_voice_add_mod(voice, &default_chorus_mod, FLUID_VOICE_DEFAULT);
> /* SF2.01 $8.4.9 */
> fluid_voice_add_mod(voice, &default_pitch_bend_mod, FLUID_VOICE_DEFAULT);
> /* SF2.01 $8.4.10 */
>
> + fluid_voice_set_reverb(voice, reverb_level);
> + fluid_voice_set_chorus(voice, chorus_level);
> +
> return voice;
> }
>
> Index: src/fluid_synth.h
> ===================================================================
> --- src/fluid_synth.h (revision 117)
> +++ src/fluid_synth.h (working copy)
> @@ -176,6 +176,10 @@
>
> int fluid_synth_set_reverb_preset(fluid_synth_t* synth, int num);
>
> +void fluid_synth_set_reverb_level(fluid_synth_t* synth, double level);
> +
> +void fluid_synth_set_chorus_level(fluid_synth_t* synth, double level);
> +
> int fluid_synth_one_block(fluid_synth_t* synth, int do_not_mix_fx_to_out);
>
> fluid_preset_t* fluid_synth_get_preset(fluid_synth_t* synth,
>
- Re: [fluid-dev] [PATCH] Effect level clip, Josh Green, 2007/09/02
- Re: [fluid-dev] [PATCH] Effect level clip, David Hilvert, 2007/09/03
- Re: [fluid-dev] [PATCH] Effect level clip,
Josh Green <=
- Re: [fluid-dev] [PATCH] Effect level clip, David Hilvert, 2007/09/17
- Re: [fluid-dev] [PATCH] Effect level clip, Josh Green, 2007/09/17
- Re: [fluid-dev] [PATCH] Effect level clip, Rui Nuno Capela, 2007/09/17
- Re: [fluid-dev] [PATCH] Effect level clip, Josh Green, 2007/09/17
- Re: [fluid-dev] [PATCH] Effect level clip, David Hilvert, 2007/09/17
- Re: [fluid-dev] [PATCH] Effect level clip, Josh Green, 2007/09/17
- Re: [fluid-dev] [PATCH] Effect level clip, David Hilvert, 2007/09/17
- Re: [fluid-dev] [PATCH] Effect level clip, Josh Green, 2007/09/17
- Re: [fluid-dev] [PATCH] Effect level clip, David Hilvert, 2007/09/17
- Re: [fluid-dev] [PATCH] Effect level clip, David Hilvert, 2007/09/17