Skip to content

Pitch Bend range not correct when playing from middle #456

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

Open
robertnhart opened this issue Feb 2, 2025 · 1 comment
Open

Pitch Bend range not correct when playing from middle #456

robertnhart opened this issue Feb 2, 2025 · 1 comment

Comments

@robertnhart
Copy link
Collaborator

When playback is started at a position that is not the beginning of the song, the Pitch Bend range specified at the beginning of the track is not applied.

Example Discord messages

  • 2024-10
  • 2024-07
  • 2023-08 (In this case, we didn't realize it might be related to the playback starting at a position that is not the beginning of the song, but that is probably what it was.)
@robertnhart
Copy link
Collaborator Author

robertnhart commented Feb 2, 2025

Some initial code investigation...

It looks like the current code is mainly looking for events that cause an effect with one message. The code may need to be expanded to find or remember the most recent RPN Pitch Bend Range amount, which uses a sequence of three messages to cause an effect.

Here is various code I found related to restoring state when the playback is started from a position that is not the beginning.

file app/src/player/EventSource.ts

  • function getCurrentStateEvents
    basically just calls getStatusEvents

file app/src/track/selector.ts

  • function getStatusEvents
    gets an array of events with events.filter(isControllerEvent).filter(isTickBefore(tick)) then removes duplicates, leaving only the most recent message for each controller. It also uses a similar process to get the most recent tempo, program change, and pitch bend messages.

  • function isTickBefore
    defined to just return e.tick <= tick

file app/src/track/identify.ts

  • contains the various functions like isControllerEvent that are useful for the filter.

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