Skip to content

fix: correct custom pitch pie menu order, rotation and preview - #7981

Open
abhijitdalal26 wants to merge 1 commit into
sugarlabs:masterfrom
abhijitdalal26:fix/custom-pitch-piemenu
Open

fix: correct custom pitch pie menu order, rotation and preview#7981
abhijitdalal26 wants to merge 1 commit into
sugarlabs:masterfrom
abhijitdalal26:fix/custom-pitch-piemenu

Conversation

@abhijitdalal26

Copy link
Copy Markdown

Summary

Fixes the three custom pitch pie menu problems described in #2255:

  1. Reversed order - the note wheel was built straight from the temperament's pitch-number order (low to high). Every other pitch wheel in the app lists notes high to low (solfege is built as "ti la sol fa mi re do"), so the custom pitch wheel looked backwards next to them. Fixed by reversing the label array when it's built, and adjusting the initial-selection index math to match.

  2. No rotation - clickModeRotate was explicitly set to false on both the temperament wheel and the note wheel in piemenuCustomNotes. Nothing else in the regular pitch pie menu does this (only the exit button disables rotation), so dragging to rotate the custom pitch wheel never worked. Removed both assignments.

  3. No pitch preview - block.customID was only ever set inside the temperament tab's navigateFunction, so it stayed null until the user clicked a temperament tab. With only one custom temperament defined (the common case), the first note click called getCustomFrequency(notes, null), which can't find a match and falls through to returning the raw note name (e.g. "do") instead of a frequency. That string then got handed to triggerAttackRelease, which can't play it, so there was no preview sound. Fixed by setting block.customID from the selected temperament as soon as the menu opens.

Changes

  • js/piemenus.js: reverse note label order in piemenuCustomNotes, drop clickModeRotate = false for _customWheel/_cusNoteWheel, initialize block.customID up front, fix initial wheel navigation index to account for the reversed order.

Testing

  • npx eslint js/piemenus.js
  • npx jest js/__tests__/piemenus.test.js --runInBand --coverage=false (8/8 passing)
  • npx jest js/blocks/__tests__/PitchBlocks.test.js js/utils/__tests__/synthutils.test.js --runInBand --coverage=false (199/199 passing)

Fixes #2255

The custom pitch pie menu had three problems compared to the regular
pitch wheels:

- note labels were built straight from the temperament's pitch number
  order (low to high), so they showed up reversed relative to every
  other pitch wheel, which lists high to low (e.g. solfege is "ti la
  sol fa mi re do")
- clickModeRotate was explicitly disabled on the custom temperament
  wheel and the note wheel, so dragging to rotate never worked even
  though every other pitch wheel supports it
- block.customID was only ever set once the user clicked the
  temperament tab, so with a single custom temperament defined (the
  common case) the first note click passed a null customID into
  getCustomFrequency, which fell through to returning the raw note
  name instead of a frequency, and triggerAttackRelease got a string
  it can't play

Reverse the label order when building the note wheel, drop the two
clickModeRotate=false assignments, and set customID from the selected
temperament as soon as the menu opens instead of waiting for a tab
click. Also fixed the initial wheel navigation index math to match
the new reversed order.

Fixes sugarlabs#2255
@021nirav-blip

021nirav-blip commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

@abhijitdalal26
code looks almost good to me but i couldn't reproduce the exact bug mentioned in the issue can you share some screenShots

@021nirav-blip

Copy link
Copy Markdown
Contributor

and for the code
One thing still missing: the octave auto-adjustment from piemenuPitches hasn't been ported to piemenuCustomNotes. In the regular pitch wheel, when you scroll past note boundaries - C -> B wraps down, B -> C wraps up - the octave adjusts automatically via deltaOctave. The custom menu doesn't do that yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

Custom Pitch block's pie menu is reversed, no rotation, and no pitch preview

2 participants