Skip to content

Implement full note name parser in parse_note_name - #868

Merged
godofecht merged 2 commits into
mainfrom
implement-parse-note-name-1639734174586576469
Sep 9, 2026
Merged

godofecht merged 2 commits into
mainfrom
implement-parse-note-name-1639734174586576469

Conversation

@godofecht

Copy link
Copy Markdown
Contributor

Implements a complete string parser for musical note names (e.g., 'C4', 'D#5', 'R') to convert them to their corresponding MIDI numbers, resolving the TODO in lib/stdlib/audio/notation.flow. By leveraging pointer casting (name as ptr<u8>), the new parse_note_name correctly handles base notes, accidentals, standard octaves (defaulting to 4), and rests without needing external string libraries.

Also updates parse_note_simple to utilize the newly functioning parse_note_name rather than unconditionally returning C4 (MIDI 60).


PR created automatically by Jules for task 1639734174586576469 started by @godofecht

@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@godofecht
godofecht force-pushed the implement-parse-note-name-1639734174586576469 branch from fb166c6 to 3d0c7a6 Compare September 7, 2026 14:52
@godofecht
godofecht marked this pull request as draft September 8, 2026 07:57

Copy link
Copy Markdown
Contributor Author

Moved back to draft pending correctness qualification. The current parser silently maps an unknown leading note letter to C because base_note defaults to 0 and the match has no rejecting/default path; e.g. X4 becomes MIDI 60. It also accepts trailing junk and only defines a single-digit octave policy. Before this is ready: define explicit invalid-input behavior, add tests for invalid letters/accidentals/trailing characters and octave bounds/policy, then run the relevant stdlib/compiler tests locally. Keep hosted CI unused.

@google-labs-jules

Copy link
Copy Markdown
Contributor

Moved back to draft pending correctness qualification. The current parser silently maps an unknown leading note letter to C because base_note defaults to 0 and the match has no rejecting/default path; e.g. X4 becomes MIDI 60. It also accepts trailing junk and only defines a single-digit octave policy. Before this is ready: define explicit invalid-input behavior, add tests for invalid letters/accidentals/trailing characters and octave bounds/policy, then run the relevant stdlib/compiler tests locally. Keep hosted CI unused.

I've added explicit invalid-input behavior, which now correctly returns -1 (used as rest/silence default) in all the following cases: empty strings, unknown base notes (e.g. X4), missing octaves, non-single-digit octaves, out-of-bounds octaves, or any trailing junk characters. I've also added tests for these in tests/lang/test_notation_parser.flow and verified they all pass locally. Pushing now!

@godofecht
godofecht marked this pull request as ready for review September 9, 2026 11:44
@godofecht
godofecht merged commit 0b5d374 into main Sep 9, 2026
24 checks passed
@godofecht
godofecht deleted the implement-parse-note-name-1639734174586576469 branch September 9, 2026 13:07
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.

1 participant