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

Add support for loop mode release #1400

Merged
merged 4 commits into from
Oct 26, 2024

Conversation

spessasus
Copy link
Contributor

Adds support for the new "sample mode release" introduced by Polyphone 2.4

Resolves #1398

@spessasus spessasus changed the title Add support for soop mode release Add support for loop mode release Oct 8, 2024
Copy link
Member

@derselbst derselbst left a comment

Choose a reason for hiding this comment

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

Disclaimer: This is only my personal static code analysis - I haven't tested this yet.

IMO, the change is inaccurate because for two reasons:

  • You're not implementing the 0.02s attack phase.
  • Polyphone claims that the "playback begins with the release phase". But you implemented it in such a way that the voice plays back silently until the release phase begins (because of the dsp updates happening just before that). This behavior would be pretty equivalent to the delay phase, but I don't think this is the intended behavior by Polyphone.

@spessasus
Copy link
Contributor Author

spessasus commented Oct 14, 2024

Polyphone claims that the "playback begins with the release phase". But you implemented it in such a way that the voice plays back silently until the release phase begins (because of the dsp updates happening just before that). This behavior would be pretty equivalent to the delay phase, but I don't think this is the intended behavior by Polyphone.

And that's exactly what this patch does. It only delays the wavetable oscillator. The volenv works normally. Feel free to test it in Polyphone 2.4. Put an attack time of 1 and hold the key for 1 second then release, then try instantly releasing it after the keypress. You can hear that the attack phase advances while the key is pressed.

Copy link
Member

@derselbst derselbst left a comment

Choose a reason for hiding this comment

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

Ok, so I've created a soundfont and it does indeed sound just like in Polyphone because I overlooked that the actual dsp update will happen in the interpolation functions below. I'm providing the test soundfont I've used:
polyphone-release-test.zip

noteon 0 23 127
noteoff 0 23

Will start playing the at its beginning sample with no attack and no hold.

noteon 0 24 127
noteoff 0 24

Will use 1s attack and 1s hold. When executed quickly consecutively, one can hear the attack phase. I find that behavior a bit strange. I mean we are already in release phase, so why do we hear attack and hold?

Yet, I would buy it. Pls. remove the extra space in if( voice....)

@derselbst derselbst added this to the 2.4 milestone Oct 20, 2024
@spessasus
Copy link
Contributor Author

Pls. remove the extra space in if( voice....)

Done!

Will use 1s attack and 1s hold. When executed quickly consecutively, one can hear the attack phase. I find that behavior a bit strange. I mean we are already in release phase, so why do we hear attack and hold?

It makes sense IMO. Loop modes only affect wavetable, never envelope. And for example if we want an instrument with long attack time and then some sort of release noise at the end, this approach will make the noise play at the same volume as the main sample if the voice is released during the attack phase.

Copy link

sonarcloud bot commented Oct 20, 2024

Copy link
Member

@derselbst derselbst left a comment

Choose a reason for hiding this comment

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

Ok, LGTM. Thanks!

@derselbst derselbst merged commit 98b1d3e into FluidSynth:master Oct 26, 2024
51 of 54 checks passed
@spessasus spessasus deleted the loop-mode-release branch October 26, 2024 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for sample mode release
2 participants