Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] Using Sustain Pedal like Soft Pedal #1276

Closed
wants to merge 2 commits into from
Closed

Conversation

derselbst
Copy link
Member

This attempt to implement the method described in #1271.

Unfortunately, it doesn't work. In my tests I've found that manipulating the release time does not affect voices already playing in release phase.

I currently have no time for a deeper investigation.

@derselbst
Copy link
Member Author

@RobsonFBP FYI

@sonarcloud
Copy link

sonarcloud bot commented Sep 8, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

45.0% 45.0% Coverage
0.0% 0.0% Duplication

@RobsonFBP
Copy link

The effect could be more noticeable if the initial volEnvRelease is 1s and I add 6400 to the modulator parameter.

However, my intention is not just a vibration effect, but primarily to have string, organ and flute sounds that do not ring out indefinitely when the pedal is pressed, but have a smooth pitch with a size.
This implies activating the pedal before Release.

Thank you in advance and we await the update.

@RobsonFBP
Copy link

RobsonFBP commented Sep 17, 2023

Thanks for this PR.

I liked the name of the created variable ignore_sutain because it is more intuitive than cancel_default_hold in your PR

I think if (mod->src1 == SUSTAIN_SWITCH) is true, mod->flags1 & (FLUID_MOD_CC | FLUID_MOD_SWITCH) will always be true because its index is 64, so only FLUID_MOD_CC have index 64 and it could be simplified to:

    if ((mod->src1 == SUSTAIN_SWITCH || mod->src2 == SUSTAIN_SWITCH) && mod->dest == GEN_VOLENVRELEASE)
    {
        voice->ignore_sustain = 1;
    }

I would be even more restrictive using both SUSTAIN_SWITCH sources

    if (mod->src1 == SUSTAIN_SWITCH && mod->src2 == SUSTAIN_SWITCH && mod->dest == GEN_VOLENVRELEASE)
    {
        voice->ignore_sustain = 1;
    }

But if you want to keep the code without simplifying, you could fix the parentheses like this.

    if(((mod->src1 == SUSTAIN_SWITCH && mod->flags1 & (FLUID_MOD_CC | FLUID_MOD_SWITCH))
        || (mod->src2 == SUSTAIN_SWITCH && mod->flags2 & (FLUID_MOD_CC | FLUID_MOD_SWITCH)))
        && mod->dest == GEN_VOLENVRELEASE)
    {
        voice->ignore_sustain = 1;
    }

Copy link

@RobsonFBP RobsonFBP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These proposed changes are to create a smooth fit when releasing the key with the sustain pedal depressed. Useful for smooth tuning on instruments that sound indefinitely while the sustain pedal is depressed.

src/synth/fluid_voice.c Outdated Show resolved Hide resolved
src/synth/fluid_voice.c Outdated Show resolved Hide resolved
src/synth/fluid_voice.h Outdated Show resolved Hide resolved
src/synth/fluid_voice.c Outdated Show resolved Hide resolved
@derselbst
Copy link
Member Author

Ok, I applied your suggestions, thanks. However, I'm currently unable to test this. It may take me a few weeks before coming back to this.

Copy link

sonarcloud bot commented Nov 19, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

29.4% 29.4% Coverage
0.0% 0.0% Duplication

@derselbst
Copy link
Member Author

I found some time to look into this again. I can confirm that the current change results in an audible manipulation of the sustain and release phases for new voices only (i.e. not for already playing voices). The most noticeable effect is that notes which were played while the sustain pedal was depressed, keep playing even when releasing the pedal afterwards and playing further notes. I'm not quite sure if this is supposed to be the effect intended by the original discussion.

One problem I observed is that fluidsynth easily runs out of polyphone, when playing notes while the pedal is depressed:
fluidsynth: debug: Polyphony exceeded, trying to kill a voice

This doesn't happen when playing with the regular sustain pedal behavior and is probably due to decay and release phases being both expanded by the current implementation.

Honestly, I don't really find this behavior intuitive or comprehensive. But I would like to hear what others think about it?

@derselbst derselbst changed the title Using Sustain Pedal like Soft Pedal [RFC] Using Sustain Pedal like Soft Pedal Jan 2, 2024
@RobsonFBP
Copy link

I would also like to be able to test each change, but I don't know how to do it. If you could send me a compiler with all the settings and all the necessary files and dependencies, so that I could just make the changes and compile, I could perhaps deliver the finished result.

Eu também gostaria de poder testar cada mudança, mas não sei como fazer. Se você pudesse me mandar um compilador com todas as configurações e todos os arquivos e dependências necessários de modo que eu apenas fizesse as mudanças e compilasse, poderia entregar o resultado pronto.

@derselbst
Copy link
Member Author

The process of compiling is explained in our wiki:
https://github.com/FluidSynth/fluidsynth/wiki/BuildingWithCMake

@RobsonFBP
Copy link

RobsonFBP commented Sep 19, 2024 via email

@derselbst
Copy link
Member Author

Sorry, but this PR stayed open for over a year without a working solution in mind, without activity over the past 8 months. I currently don't see this PR will reach a shape where it can be accepted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants