dataCompilation
dataCompilation
|
This function takes the results of the alignment and the note matrix and compiles the data into a JSON object that can be used to insert the audio analysis into the score. |
- pyampact.dataCompilation.data_compilation(y, original_sr, hop_length, winms, tsr, spec, nmat, piece, audio_file_path, output_path='output')[source]
This function takes the results of the alignment and the note matrix and compiles the data into a JSON object that can be used to insert the audio analysis into the score.
- Parameters:
nmat (np.ndarray) – The note matrix containing information about notes, including their timing and duration.
hop_length (int) – Hop length
spec (np.ndarray) – Spec (check type and fill out)
audio_file (str) – The path to the audio file associated with the performance data.
piece (Score) – An instantiation of the original Score object containing the data input for the musical piece.
output_path (str, optional) – The file path for the output MEI file. Defaults to ‘./output’.
- Returns:
nmat (The note matrix with performance data appended.)
json_data (A JSON object containing the compiled data.)
xml_data (XML data representing the MEI output.)
- pyampact.dataCompilation.export_selected_columns(nmat, columns, output_path='./output_selected_data.csv')[source]
Export specified columns from a dictionary of DataFrames, a single DataFrame, or a NumPy array of DataFrames to a CSV. Missing columns are added as NaN.
- Parameters:
nmat (dict of DataFrames) – The dictionary of nmat with all relevant onset, offset, duration, and pitch information,
columns (array of strings) – List of column names and order in which they are exported
output_path (str, optional) – The file path for the output CSV file. Defaults to ‘./output_selected_data’.
- Returns:
plt – A PNG image of the spectrogram, overlay, and information
- Return type:
png file
- pyampact.dataCompilation.visualise_alignment_from_nmat(nmat_dict, y, sr, output_path='output_visual')[source]
Creates a spectrogram with pitch, voice, and duration information overlaid.
- Parameters:
nmat_dict (dict of DataFrames) – The dictionary of nmat with all relevant onset, offset, duration, and pitch information,
y (ndarray) – Audio time series of the file.
sr (int) – Original sample rate of the audio file.
output_path (str, optional) – The file path for the output MEI file. Defaults to ‘./output_visual’.
- Returns:
plt – A PNG image of the spectrogram, overlay, and information
- Return type:
png file