pytakt.pianoroll module¶
This module defines functions for the piano roll viewer.
- show(score, velocity='auto', ctrlnums='auto', limit=500000.0, render=True, bar0len=None, magnify=1.0, geometry=None, title='Pytakt') None ¶
Displays a piano roll for score.
- Parameters:
score (Score) – Score to display.
velocity (bool or str, optional) – If True, display the velocity Pane; If False, do not display. If ‘auto’, display only when there are changes in velocity .
ctrlnums (iterable of int or str, or str, optional) – Specifies the type of controller panes to display (e.g.
show(s, ctrlnums=[C_VOL])
). If ‘auto’ is specified, all such controllers that contain two or more events with different values in a channel of a track will be displayed. If ‘verbose’ is specified, it will show all controllers where events are present. ‘auto’ or ‘verbose’ can be included in an iterable, which can then be further added, or can be removed by specifying a sign-inverted controller number (e.g.,ctrlnums=('auto', C_PROG, -C_DATA)
). To delete controller number 0 (C_BANK), specify -256.limit (ticks, optional) – Limit the length of the score. For details on limits, see the same name entry of
Score.stream()
.render (bool, optional) – If True (default), renders events according to the played time. If False, display events according to the notated time.
bar0len (ticks, optional) – Specifies the length of Bar 0. See
TimeSignatureMap
for details.magnify (float, optional) – Specifies the overall display magnification.
geometry (str, optional) – Specifies the window size and position (e.g., “800x600+0+0”)
title (str, optional) – Specifies the title string of the window.
Default values for the magnification and geoemtry arguments can be specified by the environment variables PYTAKT_MAGNIFY and PYTAKT_GEOMETRY, respectively.
Operations in the Window
Track Buttons: The ALL and number buttons at the top change the selection status of individual tracks. Pressing the number button means ‘solo’ operation (deselect all tracks except the one). Press it again to return to the last state when the two or more tracks were selected. Pressing the ALL button selects all tracks. Press it again to return to the previous state. Pressing the number button with SHIFT or CTRL will toggle the selection status of that track.
Tempo Scale: The tempo scale can be changed by the number box at the upper right.
Play Button (|▶): Starts playing from the position of the red cursor. The red cursor can be moved by clicking on the bar number ruler at the top.
Pause/Continue Button (⏸, ▶): Alternates between stopping and playing from the previously stopped position (green cursor position).
Right Button Menu: The right mouse button opens a menu from which you can add/delete controller panes, zoom, switch output devices, etc.
Note Pane: Clicking on each note brings it to the front with playing the note’s sound. Clicking it with SHIFT sends it to the back. Clicking it with CTRL does the same action as pressing the track button. Clicking with the middle mouse button prints event contents to the standard output. Dragging in the empty area scrolls the score horizontally (+SHIFT scrolls it vertically and horizontally). Mouse wheel and SHIFT+mouse wheel scrolls the score (direction is platform-dependent); CTRL+mouse wheel zooms, horizontally if done in the bar number ruler area, vertically in the keyboard area, and both in other area.
Controller Panes: They can be turn on/off from the right-button menu. Mouse wheel and the middle button work the same as in the Note Pane.
Status Display: The lines at the bottom of the screen show information about ticks, seconds, the pitch (with the MIDI note number in the parentheses), the time signature, the key signature, the track number and track name (if any) as well as event contents. If there are multiple overlapping notes, the track numbers will be displayed as “+ 2 3”.
- Shortcut Keys:
p: Same as Play button
space: Same as Pause/Continue button
r: Reset cursor potitions
a: Same as ALL button
c: Display all controller panes with value changes (equivalent to ctrlnums=’auto’). If all are already displayed, hide them.
v: Show/hide the velocity pane
t: Show/hide the tempo pane
j: Jump to a specified position
0-9: Same as track number buttons (+ALT for tracks 10-19)
Arrow keys: Scroll (+SHIFT for pages)
Home/End: Move to the beginning/end of the score
PageUp/PageDown: Increase/decrease tempo scale
CTRL+’+’, CTRL+’-’: Zoom Up/Down
CTRL+’=’: Reset Zoom
CTRL+d: Close the Controller Pane at the mouse cursor
CTRL+w, CTRL+q, ESC: Exit