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

note_creation.py model_output_to_notes() corrected notes attempt #154

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

emmathesaw
Copy link

@emmathesaw emmathesaw commented Dec 9, 2024

This PR addresses a visual pitch discrepancy in Basic Pitch's piano canvas compared to the exported MIDI files. A pitch offset correction was added to the note creation process, attempting to align displayed and exported pitches while maintaining their accuracy of the transcription.

This is referencing #147

Copy link

@mgodave mgodave left a comment

Choose a reason for hiding this comment

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

Altogether this looks good. I would encourage you to add some tests to test that the correction works as expected. I would be especially interested to see if the int coercion works as expected.

basic_pitch/note_creation.py Outdated Show resolved Hide resolved

#apply the correction offset to align pitch (created corrected_notes instead of estimated notes)
corrected_notes = [
(note[0], note[1], int(note[2] - pitch_offset_correction), note[3], note[4])
Copy link

Choose a reason for hiding this comment

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

What is the implication of this cast to int? My understanding is that this truncates the decimal portion of the result, is this the desired behavior?

tests/test_note_creation.py Outdated Show resolved Hide resolved
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.

2 participants