pxt icon indicating copy to clipboard operation
pxt copied to clipboard

note field editor misrenders when minNote is not a "C"

Open dbjorge opened this issue 3 years ago • 1 comments
trafficstars

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:

  1. Go to https://makecode.com/playground
  2. 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;
    }
}
  1. Select the "Run" button
  2. In block mode, create a new instance of the Repro > repro block
  3. Click the "0 Hz" in the new block to open the note editor
  4. Hover mouse over leftmost key in the note editor UI
  5. 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

screenshot describing the state described in repro step 7 above

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:

mockup of expected behavior

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.

dbjorge avatar Sep 21 '22 23:09 dbjorge

@riknoll ?

abchatra avatar Sep 23 '22 17:09 abchatra