MIDI piano - soft pedal support in LS?

You're new to the LinuxSampler world? You don't know where to start and nothing works? Here's the place to ask for help.
Post Reply
User avatar
patrice_stg
Newbie
Posts: 4
Joined: Sun Jan 24, 2021 11:13 pm

MIDI piano - soft pedal support in LS?

Post by patrice_stg » Mon Jan 25, 2021 4:56 am

Hi
I am using LS with jackd2 to play with high-quality soundfonts on a Roland FP30.
Presently I use the Salamander Grand Piano v3 sfz.
The sustain pedal (right - CC64) and sostenuto pedal (middle - CC66) are working, but not the soft one (left - CC67).
I also tried a GIG soundfont, there is no soft pedal either.
"aseqdump" shows that the codes are received.
I have read in the linuxsampler-devel mail list something about a bug related to the soft-pedal support, implying that the support depends on the sfz samples, or at least, on some instructions in the sfz script.
I am not sure I understand. So the soft pedal support must be in the sfz samples (plus the script processing the MIDI control codes)? The softening is never approximated by the program when no specific "soft" samples are available?
If it's the case, and if I want to continue to use the Salamander sfz, is there a workaround?
Some chords are harder to play pp, this narrows the dynamic range.
Thanks
Patrice

User avatar
cuse
Developer
Posts: 338
Joined: Wed Jan 23, 2008 10:07 pm
Location: Germany

Re: MIDI piano - soft pedal support in LS?

Post by cuse » Thu Feb 04, 2021 1:26 pm

Yes, soft pedal is not a hard coded sound feature unlike e.g. sustain pedal so it needs to be defined in the instrument (no matter if sfz or gig) what shall happen exactly if the soft pedal is pressed down. That's because for other things like sustain pedal the common intended behaviour is clear, it should hold the sound, period (even though you still have options to override that in instruments if needed). However for the soft pedal things are not that clear, because how exactly shall the sound be "softened"? Should it just reduce volume, and if so by how much dB exactly? Should it also apply a filter and if so which one and what filter options shall be used precisely? Or should a different sample set be used? Any combinations of that or more?

User avatar
patrice_stg
Newbie
Posts: 4
Joined: Sun Jan 24, 2021 11:13 pm

Re: MIDI piano - soft pedal support in LS?

Post by patrice_stg » Fri Mar 05, 2021 4:05 am

Thanks a lot for your answer, cuse, I totally missed it, I'm very sorry I'm so late to answer. I've updated my profile to get notified in the future.
"[the soft pedal] needs to be defined in the instrument" - so, for instance, in the sfz script?
When I was a kid, I lifted the font panel of an upright piano to see what was going on inside while using the pedal which softened the sound. A felt was pressed on the strings.
So why not a "virtual felt"?
Well, according to the Wikipedia page about the piano pedals, it seems that it was a practice pedal, not a soft pedal.
Now I don't have access to an upright piano, even less to a grand piano, except in a key ring format.
According to the same Wikipedia page and also the page specific to the soft pedal, most upright pianos implements the soft pedal by moving the hammers closer to the strings. Less kinetic energy = a lower sound volume. The timbre is not modified. In this case decreasing the volume of a sample set recorded without the pedal could give a good approximation.
For grand pianos, the soft pedal shifts the hammers laterally, so that only two of the three strings is hit. The timbre is modified, but it seems the effect is less audible with modern pianos.
If one absolutely wants to reproduce the sound of a specific vintage grand piano with a MIDI setup, I suppose that a distinct sample set recorded with the soft pedal active would be required.
But decreasing the volume of a standard sample set may be good enough in both cases.
Your concern about how it should translate in volume level is relevant. I hesitate to speak in dB/dBa. If you try to reproduce the dynamic of a grand piano you should get FF at 84-103 dB according to what I've found (cf https://music.eku.edu/sites/music.eku.e ... safety.pdf). I clearly don't want this range at home (my son either). The volume is set at the output device depending on the listening requirements.
So adjusting the input MIDI note velocity may be a better strategy. This is what qmidiroute is supposed to do, but unfortunately it's stateless. I used it to remap the velocity output of a cheapo chinese keyboard with some success, but I saw nothing to adjust a velocity depending on a previous control code.
I'll check what can be done in a sfz script with existing sound samples and I'll post back my findings, even if there aren't any.
Thanks again!
Patrice

User avatar
patrice_stg
Newbie
Posts: 4
Joined: Sun Jan 24, 2021 11:13 pm

Re: MIDI piano - soft pedal support in LS?

Post by patrice_stg » Sat Mar 06, 2021 4:11 am

I got my workaround!
Adding the SFZ v2 opcode volume_oncc67=-6 in relevant group sections of the sfz script does the job.
I mean by relevant: not the samples of the pedal mechanism noise :)
The SFZ v1 alias gain_cc , which I tried first, is not recognized by linuxsampler.
The effect varies depending on the extent to which the pedal is pressed. I'm not sure this represents the behaviour of any analog piano... anyway.
-6dB is an arbitrary choice, for now. -8dB was too much. I'll try to compare how the Roland integrated FP30 implementation sounds in the next days to tune it further.

User avatar
cuse
Developer
Posts: 338
Joined: Wed Jan 23, 2008 10:07 pm
Location: Germany

Re: MIDI piano - soft pedal support in LS?

Post by cuse » Sat Mar 06, 2021 2:10 pm

Yes, gain_ccN is not supported by LS yet. Here is the full list of SFZ opcodes supported by LS:
http://linuxsampler.org/sfz/

I would recommend defining two separate SFZ regions and using SFZ opcode on_loccN to define which region shall be used if the pedal is down or up. This way you can fine tune the sound as much as you want. E.g. not only can you simply reduce the volume for the pedal down case, you can also add a low pass filter in case you want to replicate timbre changes.

In large piano sample libraries there are actually separate samples for the soft pedal down case, because it does sound differently. Otherwise this would always be solved by just reducing the input MIDI velocity value. With the solution described (i.e. defining separate SFZ regions) you can also do that and play different samples if needed.

User avatar
patrice_stg
Newbie
Posts: 4
Joined: Sun Jan 24, 2021 11:13 pm

Re: MIDI piano - soft pedal support in LS?

Post by patrice_stg » Sun Mar 07, 2021 6:34 am

Thanks for your reply.
I've found the reference when I saw that gain_cc was not supported by linuxsampler. I was testing the script with liquidsfz, which supports both aliases. I also digged in sfz.h to be sure of what was supported.
About defining multiple regions with distinct processing for the cc#66 code, sure, I will if it's required.
But for now, I am trying to stick to the KISS principle. I'm just beginning to dig in the sfz language. After removing the samples I consider non essential for my needs (hammer noise, release string resonance and pedal action - KISS!), there are still close to 500 samples in the bank. In the current script version, 1 region <-> 1 sample. With N regions <-> 1 sample, the script can rapidly become a mess to edit if some inheritance is not used with groups.
Also some pianists are able to reach a wide dynamic without using the soft pedal. And using this pedal requires coordination to play seamless. It's a tradeoff, with a learning curve and practice in both choices.
Not sure which way I will follow. I'm experimenting. I've already changed my compression factor from -6dB to -4dB.
And as said, I don't have access to a non-digital piano to compare. Furthermore I don't have a formal training in music to refer to.
Thanks
Patrice

Post Reply