Skip to content

Commit

Permalink
Merge pull request #362 from CPJKU/fix_349
Browse files Browse the repository at this point in the history
improve documentation performance note_array
  • Loading branch information
sildater authored Jul 23, 2024
2 parents 30ffdc4 + cbc9f48 commit 42423e0
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions partitura/performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ def num_tracks(self) -> int:

def note_array(self, *args, **kwargs) -> np.ndarray:
"""Structured array containing performance information.
The fields are 'id', 'pitch', 'onset_div', 'duration_div',
'onset_sec', 'duration_sec' and 'velocity'.
The fields are 'id', 'pitch', 'onset_tick', 'duration_tick',
'onset_sec', 'duration_sec', 'track', 'channel', and 'velocity'.
"""

fields = [
Expand Down Expand Up @@ -206,9 +206,19 @@ def from_note_array(
id: str = None,
part_name: str = None,
):
"""Create an instance of PerformedPart from a note_array.
"""
Create an instance of PerformedPart from a note_array.
Note that this property does not include non-note information (i.e.
controls such as sustain pedal).
controls such as sustain pedal, program changes, tempo changes, etc.).
The following fields are mandatory:
'pitch', 'onset_sec', 'duration_sec', and 'velocity'.
The following fields are used if available:
'id', 'track', 'channel'.
The following fields are ignored:
'onset_tick', 'duration_tick', all others
"""
if "id" not in note_array.dtype.names:
n_ids = ["n{0}".format(i) for i in range(len(note_array))]
Expand Down

0 comments on commit 42423e0

Please sign in to comment.