Hi all,

I've added a test MIDI file and soundfont to the ticket:
https://sourceforge.net/p/fluidsynth/tickets/50/#b976

And Kjetil: if you really want to use the key pressure as volume control by
default in a non-standard way, you could always hack the modulator into
your fluidsynth copy. A patch is attached. It gives you Poly Pressure to
Initial Modulation, in a positive concave unipolar mapping. That means that
positive key pressure values reduce the initial volume of the sound (based
on the velocity of the note on). So it's basically an inversed Expression
controller, just on a single note. But I think something like that should
really only be a hack and not part of FluidSynth... not even as a
configuration option.

Cheers,

   Marcus

2017-05-23 18:18 GMT+02:00 Marcus Weseloh <mar...@weseloh.cc>:

> Hi Aere,
>
> 2017-05-23 16:47 GMT+02:00 Aere Greenway <a...@dvorak-keyboards.com>:
>
>> > I have been using FluidSynth for years, by way of the Qsynth GUI
>> interface, with a synthesizer having aftertouch (which it actually does by
>> sending Channel Pressure MIDI control messages).
>> > It has always had the same effect as the modulation control message.
>> > With the FluidR3_GM soundfont (which comes with Qsynth as a
>> dependency), the Modulation control often produces a non-pleasing sound, so
>> I actually removed the Channel Pressure messages from my MIDI sequences.
>> > With other soundfonts, the Modulation messages (and therefore the
>> Channel Pressure messages) are useful.
>> > It has had this behavior for over 10 years.
>> > Polyphonic Aftertouch may be different from Channel Pressure.  I am
>> talking about Channel Pressure, which my synthesizer uses.
>
>
> Thank you very much for your feedback! Yes, most synthesizers implement
> only Channel Pressure for aftertouch (probably because Polyphonic
> aftertouch can generate an awful lot of messages on a keyboard). And the
> soundfont default for Channel Pressure messages is to affect the Vibrato
> LFO pitch depth, same as the modulation wheel. I can understand why you
> remove those messages when using the FluidR3 soundfont.
>
> Polyphonic aftertouch is a completely different message, though. It's not
> mapped to a modulator by default and has the unique property that it
> affects single notes, not the whole channel. So with the right MIDI
> controller and soundfont, it can give you a lot of expressive power.
>
> Cheers,
>
> Marcus
>
diff --git a/fluidsynth/src/synth/fluid_synth.c b/fluidsynth/src/synth/fluid_synth.c
index 5af8236..6ac6667 100644
--- a/fluidsynth/src/synth/fluid_synth.c
+++ b/fluidsynth/src/synth/fluid_synth.c
@@ -139,6 +139,7 @@ fluid_mod_t default_expr_mod;           /* SF2.01 section 8.4.7  */
 fluid_mod_t default_reverb_mod;         /* SF2.01 section 8.4.8  */
 fluid_mod_t default_chorus_mod;         /* SF2.01 section 8.4.9  */
 fluid_mod_t default_pitch_bend_mod;     /* SF2.01 section 8.4.10 */
+fluid_mod_t additional_pat2att_mod;       /* Addition non-standard mod for poly pressure to initial attenuation*/
 
 /* reverb presets */
 static fluid_revmodel_presets_t revmodel_preset[] = {
@@ -437,6 +438,18 @@ fluid_synth_init(void)
 		       );
   fluid_mod_set_dest(&default_pitch_bend_mod, GEN_PITCH);                 /* Destination: Initial pitch */
   fluid_mod_set_amount(&default_pitch_bend_mod, 12700.0);                 /* Amount: 12700 cents */
+
+
+  /* Additional non-standard Key Pressure to Initial Attenuation */
+  fluid_mod_set_source1(&additional_pat2att_mod, FLUID_MOD_KEYPRESSURE,
+		       FLUID_MOD_GC
+		       | FLUID_MOD_CONCAVE
+		       | FLUID_MOD_UNIPOLAR
+		       | FLUID_MOD_POSITIVE
+		       );
+  fluid_mod_set_source2(&additional_pat2att_mod, 0,0);
+  fluid_mod_set_dest(&additional_pat2att_mod, GEN_ATTENUATION);
+  fluid_mod_set_amount(&additional_pat2att_mod, 960.0);
 }
 
 static FLUID_INLINE unsigned int fluid_synth_get_ticks(fluid_synth_t* synth)
@@ -3065,6 +3078,8 @@ fluid_synth_alloc_voice(fluid_synth_t* synth, fluid_sample_t* sample, int chan,
   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_add_mod(voice, &optional_pat2att_mod, FLUID_VOICE_DEFAULT);
+
   FLUID_API_RETURN(voice);
 }
 
_______________________________________________
fluid-dev mailing list
fluid-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/fluid-dev

Reply via email to