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

Improve the note stealing #214

Merged
merged 24 commits into from
May 9, 2020
Merged

Improve the note stealing #214

merged 24 commits into from
May 9, 2020

Conversation

paulfd
Copy link
Member

@paulfd paulfd commented May 5, 2020

So the previous note stealing was very conservative. Now, we make use of the average power computed by all voices after each block to steal the voice that had the lowest mean-squared score in the last 10 blocks, without further checks. The reasoning is that most of the time under such pressure a new note will always trump an old one, and we might as well take the lowest.

Also, I put the default polyphony to 256 and increased the max to 512.

Close #187

@paulfd paulfd requested a review from jpcima May 5, 2020 21:53
@paulfd
Copy link
Member Author

paulfd commented May 7, 2020

I added the envelope/power tracker as a simple abs + super-lowpass filtering set at 5 Hz for now. We may further tweak this part, but at least it's independent of the block size now. I also added the voice age as a possible metric.

The heuristic now is to sort voices by age, set a threshold of the envelope (now set at "average envelope value over the voices / 4"), try to find a voice which fits the bill to kill. If we go beyond "max voice age / 2", we just pick the oldest one.

I also kill all "sister voices" now, which are started at the same time and with the same trigger. Writing this down I realize that this can be a problem if one of the sister voice is super strong, so we still need to refine all of this.

Maybe consider the average envelope over all sister voices, or just do not kill sister voices?

@paulfd
Copy link
Member Author

paulfd commented May 7, 2020

The more I think about this the more I think we need an opcode so instrument makers can set a voice stealing that is adapted to their instrument behavior...

src/sfizz/Voice.cpp Outdated Show resolved Hide resolved
@jpcima
Copy link
Collaborator

jpcima commented May 7, 2020

Maybe consider the average envelope over all sister voices, or just do not kill sister voices?

Perhaps consider the max of all of them?
From the case of a loud voice like you mentioned, I think this to make the most sense.

@paulfd
Copy link
Member Author

paulfd commented May 7, 2020

Maybe consider the average envelope over all sister voices, or just do not kill sister voices?

Perhaps consider the max of all of them?
From the case of a loud voice like you mentioned, I think this to make the most sense.

Did that, and I also added that killed voices pre-render their block in all relevant effect busses. This data is "ramped out" at the beginning of the block before the rendering of active voices. It's a linear ramp now, it could be an exponential ramp.

The behavior seems good, on hardcore piano stuff (like say Chopin or Liszt) with relatively low polyphony you don't "hear" dropped notes, and if you're way crazy on the polyphony you can sometimes distinguish something going wrong.

I was bitten by the fact that the voice kills itself btw. Maybe flagging ended voices and letting the synth clean them up is a better idea in the end.

I should polish and split up the stealing function, it ended up quite large and convoluted.

@jpcima
Copy link
Collaborator

jpcima commented May 8, 2020

Looking good. Another thing, you may consider as heuristic to check if there exists already other voices using the same instrument, and increase the killability score if this is the case.

@paulfd
Copy link
Member Author

paulfd commented May 9, 2020

I'll merge the current state and listed possible improvements for the next release based on our discussions. Thanks all!

@paulfd paulfd merged commit d6c24be into sfztools:develop May 9, 2020
@paulfd paulfd deleted the note-stealing branch January 21, 2022 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve the note stealing
2 participants