pxt
pxt copied to clipboard
note field editor misrenders when minNote is not a "C"
Describe the bug
note field editors with a custom minNote value render the "piano key" visuals as if minNote was a "C" at some octave, regardless of which note minNote actually represents.
To Reproduce Steps to reproduce the behavior:
- Go to https://makecode.com/playground
- In the left editor, paste the following minimal repro:
namespace repro {
//% block="repro %name"
//% name.fieldEditor="note"
//% name.fieldOptions.minNote=34 name.fieldOptions.maxNote=58
export function customNoteRangingFromFSharp3ToFSharp5(name: any): number {
return 0;
}
}
- Select the "Run" button
- In block mode, create a new instance of the Repro > repro block
- Click the "0 Hz" in the new block to open the note editor
- Hover mouse over leftmost key in the note editor UI
- Observe that the hovered note is correctly labelled as "Low F#", but is visually attached to UI for a key that would be a "C" on a piano

Expected behavior The visual keyboard should render the notes as they'd appear on a piano/keyboard. Rough mockup of what the above case ought to look like:

Screenshots see above
Desktop (please complete the following information):
- OS: Windows 11
- Browser: Edge stable Version 105.0.1343.42 (Official build) (64-bit)
- Version: Not sure how to tell - whatever is current on https://makecode.com/playground at the time this issue was filed
Smartphone (please complete the following information): n/a
Additional context
This issue is motivated by an attempt to create an extension adding music/sound support for the Minecraft target - the notes that Minecraft can represent in note blocks (and the pitch arg to its /playsound command) range from F#3 to F#5 inclusive.
@riknoll ?