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

Repeated note can cause unnatural truncation #446

Open
dpwe opened this issue Jan 18, 2025 · 0 comments
Open

Repeated note can cause unnatural truncation #446

dpwe opened this issue Jan 18, 2025 · 0 comments

Comments

@dpwe
Copy link
Collaborator

dpwe commented Jan 18, 2025

MIDI events identify notes (in note-on/note-off events) only by their note number, so it's not possible to separately keep track of two notes with the same pitch (on the same channel) in terms of associating their note-ons and note-offs. You can receive two note-ons for the same pitch without an intervening note-off, in which case we simply retrigger the same voice.

However, if the note has a long decay (high sustain value), and the second note has a much lower velocity (strike strength), this retriggering can lead to an abrupt and noticeable decrease in amplitude.

This is very noticeable in the additive piano voice, with pedaling (midi.Synth.sustain()). A strong strike in the low register will start a long-sounding note, but a subsequent soft note on the same key will abruptly switch it to the soft sound, which can sound unnatural. A real piano would not behave like this - a soft strike to an already-sounding note with the pedal down would not make it quieter.

This could be avoided by allowing repeated notes at the same pitch to be allocated to different voices. Then any subsequent note-offs to that pitch would need to apply to all the voices allocated to that note. So midi.Synth.note_of_voice[midi_note] would need to be a list, not a scalar.

@bwhitman bwhitman transferred this issue from shorepine/amy Jan 19, 2025
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

No branches or pull requests

1 participant