Skip to content

Commit 1d07840

Browse files
committed
add .copy() method to MidiPiece
1 parent f83ef46 commit 1d07840

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

fortepyan/midi/structures.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,15 @@ def __post_init__(self):
7272
def size(self) -> int:
7373
return self.df.shape[0]
7474

75+
def copy(self) -> "MidiPiece":
76+
notes_df = self.df.copy()
77+
source = self.source.copy()
78+
piece = MidiPiece(
79+
df=notes_df,
80+
source=source,
81+
)
82+
return piece
83+
7584
def time_shift(self, shift_s: float) -> "MidiPiece":
7685
"""
7786
Shift the start and end times of all notes in the MidiPiece by a specified amount.

0 commit comments

Comments
 (0)