Module music_df.read_rntxt
Functions
def read_rntxt(input_path: str) ‑> pandas.DataFrame-
Expand source code
def read_rntxt(input_path: str) -> pd.DataFrame: score = converter.parse(input_path, format="romanText") measures = list(score[Measure]) bar_rows = [_get_bar_row(measure) for measure in measures] # We flatten so that offsets will be relative to start of score flat_score = score.flatten() time_sigs = flat_score[TimeSignature] time_sig_rows = [_get_time_sig_row(ts) for ts in time_sigs] df = pd.DataFrame(bar_rows + time_sig_rows) df = sort_df(df) return df