Select a software instrument or external instrument track, then choose View > Show Editors.
Choose Window > Open Piano Roll (or press Command-4).
For more information about using the Piano Roll Editor, see Apple Books | PDF