Hello everyone,
I’m fairly new to Juce, and I’m working on a polyphonic synthesizer. As part of the GUI, I’d like to display a musical grand staff, with noteheads on it displaying the MIDI notes currently being played.
On my audioProcessor side, I have an array that’s collecting the currently held pitches, so I can pretty easily feed my audioEditor a simple list of MIDI pitches to display, it’s really just a question of being able to draw them accurately.
The only way I can think of to implement this would be to display an image of a blank grand staff: and then draw notehead-shaped ovals at the proper note positions’ Y coordinates, determined by some fancy formula having to do with the MIDIpitch vs the height above the bottom of the grand staff image. Is that basic approach correct? And if so, any thoughts on how to implement this formula to calculate the needed distance from the top/bottom of the grand staff image based on midiPitch?
[also, adding/removing ledger lines could be another issue entirely… maybe if a note is “off the staff”, then instead of a regular notehead, draw a notehead w/ a ledger line through it at those coordinates…?]
Thanks in advance for your help!