synth.audio-groups and LADSPA effects

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

synth.audio-groups and LADSPA effects

Bill Peterson
Is it possible to have LADSPA effects be active on some MIDI channels and not others? The description in fluidsettings of 'synth.audio-groups' seems to imply this is possible (i.e. " In case of LADSPA unit, think of it as subgroups on a mixer."). I can get LADSPA plugins to work (e.g. TAP Echo) on all channels, but experimenting with various combinations of values synth.audio-channels and synth.audio-groups either gets me effects on all channels or none. I'm using ALSA audio on Raspberry Pi, so if this is a jack-only capability that might make sense.

Bill

_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev
Reply | Threaded
Open this post in threaded view
|

Re: synth.audio-groups and LADSPA effects

fluid-dev mailing list
> experimenting with various combinations of values synth.audio-channels and synth.audio-groups either gets me effects on all channels or none

Seems like you created the Ladspa effects on the Main:L and Main:R
ports. Have you tried explicitly specifying the subgroups as described
here?

https://github.com/FluidSynth/fluidsynth/blob/master/doc/ladspa.md#multi-channel-output


Tom

_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev
Reply | Threaded
Open this post in threaded view
|

Re: synth.audio-groups and LADSPA effects

Bill Peterson
Hi Tom - thanks for the reply. I tried to follow the LADSPA documentation's advice, but maybe I'm not understanding how synth.audio-channels and synth.audio-groups interact. Here's the command line I'm using:

sudo fluidsynth -a alsa -o midi.autoconnect=1 -o synth.ladspa.active=1 -o synth.audio-channels=1 -o synth.audio-groups=2 -f effects.txt

and effects.txt:
load /usr/share/sounds/sf2/FluidR3_GM.sf2
select 0 1 0 0 # piano
select 1 1 0 4 # rhodes
select 2 1 0 6 # harpsichord
select 3 1 0 11 # vibes
ladspa_effect dL /usr/lib/ladspa/delay.so
ladspa_effect dR /usr/lib/ladspa/delay.so
ladspa_link dL Inp Main:L1
ladspa_link dR Inp Main:R1
ladspa_link dL Out Main:L1
ladspa_link dR Out Main:R1
ladspa_start

My intent is for the delay effect to only apply to some channels (e.g. piano and harpsichord), but I hear the delay effect on all channels. Oddly, channels 1 and 3 (rhodes and harpsichord), also sound quiet, as if they're coming through the Reverb/Chorus channels only. I get the same result with synth.audio-channels=2. What am I doing wrong?

Thanks!
Bill

On Sat, Jul 25, 2020 at 8:03 AM Tom M. <[hidden email]> wrote:
> experimenting with various combinations of values synth.audio-channels and synth.audio-groups either gets me effects on all channels or none

Seems like you created the Ladspa effects on the Main:L and Main:R
ports. Have you tried explicitly specifying the subgroups as described
here?

https://github.com/FluidSynth/fluidsynth/blob/master/doc/ladspa.md#multi-channel-output


Tom

_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev
Reply | Threaded
Open this post in threaded view
|

Re: synth.audio-groups and LADSPA effects

Marcus Weseloh
Hi Bill,

FluidSynth does not seem to mix the internal group channels back into
the main output if you are using audio-groups=2 and audio-channels=1.
That means that only the audio that gets written to Main:L1/Main:R1
can actually be heard via your soundcard.
Not sure if this is a feature or a bug... Tom, do you know anything
about the design decisions here?

Please also bear in mind that when you are using the internal reverb
and chorus effects, they get rendered to the first output channel
(L1/R1 in your setup). So even if the rhodes gets rendered to L2/R2
due to --audio-groups=2, it's reverb is rendered to L1/R1. That is why
you hear rhodes and harpsichord so quiet (it's only the wet reverb
sound) and also with the delay effect (The internal reverb and chorus
run *before* any LADSPA effects).

To achieve your goal of having the delay only on piano and
harpsichord, you could use a zero-gain amp effect to mix the audio
from rhodes and vibes (both on L2/R2) into L1/R2. Sadly you can't use
the default LADSPA "amp.so" for this, as it doesn't support --mix (the
run_adding interface). But amp_1181.so works quite well and has a
default zero-gain. So your effects.txt could look like this:

ladspa_effect dL /usr/lib/ladspa/delay.so
ladspa_effect dR /usr/lib/ladspa/delay.so
ladspa_link dL Inp Main:L1
ladspa_link dR Inp Main:R1
ladspa_link dL Out Main:L1
ladspa_link dR Out Main:R1

# Route L2 -> L1 with zero gain
ladspa_effect AmpL /usr/lib/ladspa/amp_1181.so --mix
ladspa_link AmpL Inp Main:L2
ladspa_link AmpL Out Main:L1

# Route R2 -> R1 with zero gain
ladspa_effect AmpR /usr/lib/ladspa/amp_1181.so --mix
ladspa_link AmpR Inp Main:R2
ladspa_link AmpR Out Main:R1

ladspa_start

And to get around the problem with the internal effects always being
rendered on L1/R1, you could simply disable them (-R0 -C0) and add
your own LADPSA effects. For example a tap_reverb:

# Use SoundFont reverb:send to add reverb to main output
ladspa_effect Rev /usr/lib/ladspa/tap_reverb.so --mix
ladspa_link Rev "Input Left" Reverb:Send
ladspa_link Rev "Input Right" Reverb:Send
ladspa_link Rev "Output Left" Main:L1
ladspa_link Rev "Output Right" Main:R1

Or ignore the SoundFont Reverb:Send channel and simply add a global
reverb to main out:

# Add reverb to main output
ladspa_effect Rev /usr/lib/ladspa/tap_reverb.so
ladspa_link Rev "Input Left" Main:L1
ladspa_link Rev "Input Right" Main:R1
ladspa_link Rev "Output Left" Main:L1
ladspa_link Rev "Output Right" Main:R1

Cheers
Marcus


Am Mo., 3. Aug. 2020 um 06:40 Uhr schrieb Bill Peterson <[hidden email]>:

>
> Hi Tom - thanks for the reply. I tried to follow the LADSPA documentation's advice, but maybe I'm not understanding how synth.audio-channels and synth.audio-groups interact. Here's the command line I'm using:
>
> sudo fluidsynth -a alsa -o midi.autoconnect=1 -o synth.ladspa.active=1 -o synth.audio-channels=1 -o synth.audio-groups=2 -f effects.txt
>
> and effects.txt:
> load /usr/share/sounds/sf2/FluidR3_GM.sf2
> select 0 1 0 0 # piano
> select 1 1 0 4 # rhodes
> select 2 1 0 6 # harpsichord
> select 3 1 0 11 # vibes
> ladspa_effect dL /usr/lib/ladspa/delay.so
> ladspa_effect dR /usr/lib/ladspa/delay.so
> ladspa_link dL Inp Main:L1
> ladspa_link dR Inp Main:R1
> ladspa_link dL Out Main:L1
> ladspa_link dR Out Main:R1
> ladspa_start
>
> My intent is for the delay effect to only apply to some channels (e.g. piano and harpsichord), but I hear the delay effect on all channels. Oddly, channels 1 and 3 (rhodes and harpsichord), also sound quiet, as if they're coming through the Reverb/Chorus channels only. I get the same result with synth.audio-channels=2. What am I doing wrong?
>
> Thanks!
> Bill
>
> On Sat, Jul 25, 2020 at 8:03 AM Tom M. <[hidden email]> wrote:
>>
>> > experimenting with various combinations of values synth.audio-channels and synth.audio-groups either gets me effects on all channels or none
>>
>> Seems like you created the Ladspa effects on the Main:L and Main:R
>> ports. Have you tried explicitly specifying the subgroups as described
>> here?
>>
>> https://github.com/FluidSynth/fluidsynth/blob/master/doc/ladspa.md#multi-channel-output
>>
>>
>> Tom
>
> _______________________________________________
> fluid-dev mailing list
> [hidden email]
> https://lists.nongnu.org/mailman/listinfo/fluid-dev

_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev
Reply | Threaded
Open this post in threaded view
|

Re: synth.audio-groups and LADSPA effects

Ceresa Jean-Jacques
In reply to this post by Bill Peterson

Hi,

>but maybe I'm not understanding how synth.audio-channels and synth.audio-groups interact

This is not obvious, here some general notes:

 

1)The number of rendered audio output (nbr_outputs) is dependant of synth.audio-channels and synth.audio-group:

nbr_outputs = max(synth.audio-channels, synth.audio-groups) (default is 1).

These audio outputs will be played by the sound card (if it is capable to play this nbr_outputs amount of course).

If LADSPA is not used, typically both synth.audio-channels and synth.audio-groups should be set to the same value (default 1).

 

2)synth.audio-groups is only used by LADSP.

 

3)Mapping between note played and audio output #:

Actually the way a note played on MIDI channel chan will be mapped to audio output j is rigid and depends on chan and nbr_outputs values.

The mapping is simple, MIDI channels number are distributed on available output amount.

For example with nbr_outputs = 1, the mapping is:

- All MIDI MIDI channel 0,1,2,...synth.midi-channels -1 will be rendered to the unique audio output 0.

With nbr_outputs = 2, the mapping is:

- MIDI channel 0(piano),2(harpsichord) ,4 ,6 ,8...  are rendered to audio output 0.

- MIDI channel 1 (rhodes) ,3(vibes) ,5 ,7 ,9... are rendered to audio output 1.

 

3)When using LADSPA :

In the later example (nbr_outputs = 2), piano and hapsichord are mixed on the same audio output (i.e 0). That means that any LADSPA input effect connected

to this node (output 0) should apply the same effect to both piano and hapsichord.

If we expect piano and hapsichord with distinct LADSPA effect, that means that respective MIDI channel need to be set so that

piano and hapsichord are mapped to distinct audio output (e.g MIDI channel 0(piano) to audio output 0,  MIDI channel 1(harpsichord) to audio output 1).

 

4) Which output, internal effects (reverb, chorus) are mapped on ?

As Marcus already said, both internal reverb and chorus are mapped only to output 0 (because "synth.effects-groups" has a default value of 1).

However, if "synth.effects-groups" is set to 2,  two distinct internal instances pair (reverb + chorus) should be available on each distinct audio output (0 et 1).

@Tom, please could you confirm the "synth.effects-groups" setting behaviour as described by the Wiki ?

jjc.

> Message du 03/08/20 06:40

> De : "Bill Peterson" <[hidden email]>
> A : "Tom M." <[hidden email]>
> Copie à : "FluidSynth mailing list" <[hidden email]>
> Objet : Re: [fluid-dev] synth.audio-groups and LADSPA effects
>
>
Hi Tom - thanks for the reply. I tried to follow the LADSPA documentation's advice, but maybe I'm not understanding how synth.audio-channels and synth.audio-groups interact. Here's the command line I'm using:

>
sudo fluidsynth -a alsa -o midi.autoconnect=1 -o synth.ladspa.active=1 -o synth.audio-channels=1 -o synth.audio-groups=2 -f effects.txt

>
and effects.txt:
load /usr/share/sounds/sf2/FluidR3_GM.sf2
> select 0 1 0 0 # piano
> select 1 1 0 4 # rhodes
> select 2 1 0 6 # harpsichord
> select 3 1 0 11 # vibes
> ladspa_effect dL /usr/lib/ladspa/delay.so
> ladspa_effect dR /usr/lib/ladspa/delay.so
> ladspa_link dL Inp Main:L1
> ladspa_link dR Inp Main:R1
> ladspa_link dL Out Main:L1
> ladspa_link dR Out Main:R1
> ladspa_start

>
My intent is for the delay effect to only apply to some channels (e.g. piano and harpsichord), but I hear the delay effect on all channels. Oddly, channels 1 and 3 (rhodes and harpsichord), also sound quiet, as if they're coming through the Reverb/Chorus channels only. I get the same result with synth.audio-channels=2. What am I doing wrong?

>
Thanks!
Bill
>

>
On Sat, Jul 25, 2020 at 8:03 AM Tom M. <[hidden email]> wrote:
>
> experimenting with various combinations of values synth.audio-channels and synth.audio-groups either gets me effects on all channels or none
>
> Seems like you created the Ladspa effects on the Main:L and Main:R
> ports. Have you tried explicitly specifying the subgroups as described
> here?
>
> https://github.com/FluidSynth/fluidsynth/blob/master/doc/ladspa.md#multi-channel-output
>
>
> Tom
>


_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev


_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev
Reply | Threaded
Open this post in threaded view
|

Re: synth.audio-groups and LADSPA effects

Marcus Weseloh
Hi,

Am Di., 4. Aug. 2020 um 02:16 Uhr schrieb Ceresa Jean-Jacques
<[hidden email]>:
> 1)The number of rendered audio output (nbr_outputs) is dependant of synth.audio-channels and synth.audio-group:
> nbr_outputs = max(synth.audio-channels, synth.audio-groups) (default is 1).
> These audio outputs will be played by the sound card (if it is capable to play this nbr_outputs amount of course).

Please note that this is highly dependent on the audio driver used.
AFAIK, only the jack driver supports multi-channel audio output. All
other drivers (including alsa) can only output a single stereo signal.

> [...]
> 4) Which output, internal effects (reverb, chorus) are mapped on ?
>
> As Marcus already said, both internal reverb and chorus are mapped only to output 0 (because "synth.effects-groups" has a default value of 1).
> However, if "synth.effects-groups" is set to 2,  two distinct internal instances pair (reverb + chorus) should be available on each distinct audio output (0 et 1).

This also only applies only to the jack driver. Again AFAIK, for all
other drivers (including alsa), the reverb and chorus signals are
always rendered to the first (and only) stereo output, regardless of
the setting of synth.effects-channels.

Cheers
Marcus

_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev
Reply | Threaded
Open this post in threaded view
|

Re: synth.audio-groups and LADSPA effects

Bill Peterson
Thanks for the clarifications, all! I thought the main issue was probably an ALSA limitation, but I think I can do what I want using JACK and the information you've given me.

On Tue, Aug 4, 2020 at 2:33 AM Marcus Weseloh <[hidden email]> wrote:
Hi,

Am Di., 4. Aug. 2020 um 02:16 Uhr schrieb Ceresa Jean-Jacques
<[hidden email]>:
> 1)The number of rendered audio output (nbr_outputs) is dependant of synth.audio-channels and synth.audio-group:
> nbr_outputs = max(synth.audio-channels, synth.audio-groups) (default is 1).
> These audio outputs will be played by the sound card (if it is capable to play this nbr_outputs amount of course).

Please note that this is highly dependent on the audio driver used.
AFAIK, only the jack driver supports multi-channel audio output. All
other drivers (including alsa) can only output a single stereo signal.

> [...]
> 4) Which output, internal effects (reverb, chorus) are mapped on ?
>
> As Marcus already said, both internal reverb and chorus are mapped only to output 0 (because "synth.effects-groups" has a default value of 1).
> However, if "synth.effects-groups" is set to 2,  two distinct internal instances pair (reverb + chorus) should be available on each distinct audio output (0 et 1).

This also only applies only to the jack driver. Again AFAIK, for all
other drivers (including alsa), the reverb and chorus signals are
always rendered to the first (and only) stereo output, regardless of
the setting of synth.effects-channels.

Cheers
Marcus

_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev

_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev
Reply | Threaded
Open this post in threaded view
|

Re: synth.audio-groups and LADSPA effects

Ceresa Jean-Jacques

Hi,

 

>Thanks for the clarifications, all! I thought the main issue was probably an ALSA limitation, but I think I can do what I want using JACK and the information you've given me.

 

Yes, Marcus has pointed an important limitation of most "Fluidsynth audio driver" in regard to synth.audio-channels. It seems that actually most "Fluidsynth audio driver" ignore "synth.audio-channels" setting. I don't think it is host device driver limitation (ALSA on linux,  or dsound on Windows).

On any system, as far the audio device card is multi channel capable, the host device driver should expose these capabilities. Then, it is up to the "fluidsynth audio driver" to follow and use these capabilities for "synth.audio-channels" value > 1. Be able to separate the audio rendered by MIDI Channel to distinct audio device card's audio port is a very useful feature. This should simplify

the architecture of the application making use of fluisdynth library. Because of this limitation many application could use a workaround relying to multiple instance pair (synth instance + audio driver instance) which is complicated, inefficient, not flexible. I will look, to see how we could suppress this limitation.

jjc

 

> Message du 04/08/20 21:43

> De : "Bill Peterson" <[hidden email]>
> A : "FluidSynth mailing list" <[hidden email]>
> Copie à : "Ceresa Jean-Jacques" <[hidden email]>, "TomM." <[hidden email]>
> Objet : Re: [fluid-dev] synth.audio-groups and LADSPA effects
>
>
Thanks for the clarifications, all! I thought the main issue was probably an ALSA limitation, but I think I can do what I want using JACK and the information you've given me.
>

>
On Tue, Aug 4, 2020 at 2:33 AM Marcus Weseloh <[hidden email]> wrote:
>
Hi,
>
> Am Di., 4. Aug. 2020 um 02:16 Uhr schrieb Ceresa Jean-Jacques
> <[hidden email]>:
> > 1)The number of rendered audio output (nbr_outputs) is dependant of synth.audio-channels and synth.audio-group:
> > nbr_outputs = max(synth.audio-channels, synth.audio-groups) (default is 1).
> > These audio outputs will be played by the sound card (if it is capable to play this nbr_outputs amount of course).
>
> Please note that this is highly dependent on the audio driver used.
> AFAIK, only the jack driver supports multi-channel audio output. All
> other drivers (including alsa) can only output a single stereo signal.
>
> > [...]
> > 4) Which output, internal effects (reverb, chorus) are mapped on ?
> >
> > As Marcus already said, both internal reverb and chorus are mapped only to output 0 (because "synth.effects-groups" has a default value of 1).
> > However, if "synth.effects-groups" is set to 2,  two distinct internal instances pair (reverb + chorus) should be available on each distinct audio output (0 et 1).
>
> This also only applies only to the jack driver. Again AFAIK, for all
> other drivers (including alsa), the reverb and chorus signals are
> always rendered to the first (and only) stereo output, regardless of
> the setting of synth.effects-channels.
>
> Cheers
> Marcus
>
> _______________________________________________
> fluid-dev mailing list
> [hidden email]
> https://lists.nongnu.org/mailman/listinfo/fluid-dev
>
_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev
Reply | Threaded
Open this post in threaded view
|

Re: synth.audio-groups and LADSPA effects

fluid-dev mailing list
In reply to this post by Marcus Weseloh
Sorry for the delay.

Marcus said:
> FluidSynth does not seem to mix the internal group channels back into
> the main output if you are using audio-groups=2 and audio-channels=1.
> Not sure if this is a feature or a bug... Tom, do you know anything
> about the design decisions here?

I'd say it's a feature of the respective audio rendering interface. The ALSA driver uses fluid_synth_write_float() or write_s16(). These functions are "single-stereo-channel-functions" and therefore only read from rvoice_mixer stereo buffer 1 (for performance reasons).

This "issue" has been addressed by the fluid_synth_process() function, which always mixes all internal stereo buffers, into the user provided ones. The e.g. JACK driver uses this interface if you specify audio-channels=2.

So, it's more like a limitation of the audio driver in use.


JJC said:
> 2)synth.audio-groups is only used by LADSP.

Sry, that's not quite correct. audio-groups is always used for buffer mapping of every voice:
https://github.com/FluidSynth/fluidsynth/blob/31c4e12ac9f2f4eadfb6f034845e51bff7faf223/src/synth/fluid_voice.c#L360

..so if we replace "nbr_outputs" by "nbr_groups" in your explanations, you are correct.


JJC said:
> However, if "synth.effects-groups" is set to 2,  two distinct internal instances pair (reverb + chorus) should be available on each distinct audio output (0 et 1).
> @Tom, please could you confirm the "synth.effects-groups" setting behaviour as described by the Wiki ?

Your explanation is correct. And yes, as Marcus said, behaviour depends on the audio driver.


Marcus said:
> for all other drivers (including alsa), the reverb and chorus signals are always rendered to the first (and only) stereo output, regardless of the setting of synth.effects-channels.

Correct, because of rvoice_mixer::mix_fx_to_out
https://github.com/FluidSynth/fluidsynth/blob/31c4e12ac9f2f4eadfb6f034845e51bff7faf223/src/rvoice/fluid_rvoice_mixer.c#L174-L175


Tom



_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev