Notes · chapter 5 of 11
A key is a family of notes
There are twelve notes. A key picks seven of them that sound good together, and one of those is home. Melodies here are written as steps of the key, so they can never land outside it.
The lit piano keys are the family. Change the key or the scale and a different set lights up, while the tune keeps its shape.
That is the idea.
Pick the family first and there are no wrong notes.