#NEWLINE# def get_piano_roll( self , fs = 100 , times = None ) : #NEWLINE# #INDENT# 'Get the MIDI data in piano roll notation.\n\n        Parameters\n        ----------\n        fs : int\n            Sampling frequency of the columns, i.e. each column is spaced apart\n            by 1./fs seconds\n        times : np.ndarray\n            Times of the start of each column in the piano roll.\n            Default None which is np.arange(0, get_end_time(), 1./fs)\n\n        Returns\n        -------\n        piano_roll : np.ndarray, shape=(128,times.shape[0])\n            Piano roll of MIDI data, flattened across instruments\n\n        ' #NEWLINE# if ( len ( self . instruments ) == 0 ) : #NEWLINE# #INDENT# return np . zeros ( ( 128 , 0 ) ) #NEWLINE# #UNINDENT# piano_rolls = [ i . get_piano_roll ( fs = fs , times = times ) for i in self . instruments ] #NEWLINE# piano_roll = np . zeros ( ( 128 , np . max ( [ p . shape [ 1 ] for p in piano_rolls ] ) ) ) #NEWLINE# for roll in piano_rolls : #NEWLINE# #INDENT# piano_roll [ : , : roll . shape [ 1 ] ] += roll #NEWLINE# #UNINDENT# return piano_roll