Package: Visualizations (src.visualizations)

Module: visualizations.analysis_results_graphs.py

This module, part of the visualizations package, provides a suite of methods for generating visualizations from the analysis results of musical scores.

The purpose of these functions is to create comprehensive and understandable visualizations of the musical structures and characteristics that emerge from the analysis of musical scores.

iMaT.src.visualizations.analysis_results_graphs.display_advanced_pitch_class_duration_analysis(analysis_results, identifier)[source]

Display a series of bar plots for the advanced pitch and pitch class duration analysis.

Parameters:
  • analysis_results (pd.DataFrame) – The DataFrame with the results of the analysis.

  • identifier (str) – The identifier string to be added to the plot title.

iMaT.src.visualizations.analysis_results_graphs.display_analysis_number_of_intervals_per_type(analysis_results, identifier)[source]

Display a bar diagram of the number of interval types.

Parameters:
  • analysis_results (pd.DataFrame) – The DataFrame with the results of the analysis.

  • identifier (str) – The identifier string to be added to the plot title.

iMaT.src.visualizations.analysis_results_graphs.display_analysis_number_of_intervals_per_type_with_direction(analysis_results, identifier)[source]

Display a bar diagram of the number of ascending and descending interval types.

Parameters:
  • analysis_results (pd.DataFrame) – The DataFrame with the results of the analysis.

  • identifier (str) – The identifier string to be added to the plot title.

iMaT.src.visualizations.analysis_results_graphs.display_analysis_number_of_pitch_classes_per_metrical_position(analysis_results, identifier)[source]

Display a matrix plot of the number of pitch classes per metrical position.

Parameters:
  • analysis_results (pd.DataFrame) – The DataFrame with the results of the analysis.

  • identifier (str) – The identifier string to be added to the plot title.

iMaT.src.visualizations.analysis_results_graphs.display_analysis_number_of_pitch_classes_per_offset(analysis_results, identifier)[source]

Display a matrix plot of the number of pitch classes per offset.

Parameters:
  • analysis_results (pd.DataFrame) – The DataFrame with the results of the analysis.

  • identifier (str) – The identifier string to be added to the plot title.

iMaT.src.visualizations.analysis_results_graphs.display_analysis_number_of_pitch_classes_per_tone_duration(analysis_results, identifier)[source]

Display a matrix plot of the number of pitch classes per duration.

Parameters:
  • analysis_results (pd.DataFrame) – The DataFrame with the results of the analysis.

  • identifier (str) – The identifier string to be added to the plot title.

iMaT.src.visualizations.analysis_results_graphs.display_analysis_number_of_pitches_per_metrical_position(analysis_results, identifier)[source]

Display a matrix plot of the number of pitches per metrical position.

Parameters:
  • analysis_results (pd.DataFrame) – The DataFrame with the results of the analysis.

  • identifier (str) – The identifier string to be added to the plot title.

iMaT.src.visualizations.analysis_results_graphs.display_analysis_number_of_pitches_per_offset(analysis_results, identifier)[source]

Display a matrix plot of the number of pitches per offset.

Parameters:
  • analysis_results (pd.DataFrame) – The DataFrame with the results of the analysis.

  • identifier (str) – The identifier string to be added to the plot title.

iMaT.src.visualizations.analysis_results_graphs.display_analysis_number_of_pitches_per_tone_duration(analysis_results, identifier)[source]

Display a matrix plot of the number of pitches per duration.

Parameters:
  • analysis_results (pd.DataFrame) – The DataFrame with the results of the analysis.

  • identifier (str) – The identifier string to be added to the plot title.

iMaT.src.visualizations.analysis_results_graphs.display_analysis_number_of_rests_per_rest_duration(analysis_results, identifier)[source]

Display a bar diagram of the number of rests per rest duration.

Parameters:
  • analysis_results (pd.DataFrame) – The DataFrame with the results of the analysis.

  • identifier (str) – The identifier string to be added to the plot title.

iMaT.src.visualizations.analysis_results_graphs.display_analysis_number_of_sound_events_per_metrical_position(analysis_results, identifier)[source]

Display a bar diagram of the number of sound events per metrical position.

Parameters:
  • analysis_results (pd.DataFrame) – The DataFrame with the results of the analysis.

  • identifier (str) – The identifier string to be added to the plot title.

iMaT.src.visualizations.analysis_results_graphs.display_analysis_number_of_sound_events_per_pitch(analysis_results, identifier)[source]

Display a bar diagram of the number of sound events per pitch.

Parameters:
  • analysis_results (pd.DataFrame) – The DataFrame with the results of the analysis.

  • identifier (str) – The identifier string to be added to the plot title.

iMaT.src.visualizations.analysis_results_graphs.display_analysis_number_of_sound_events_per_pitch_class(analysis_results, identifier)[source]

Display a bar diagram of the number of sound events per pitch class.

Parameters:
  • analysis_results (pd.DataFrame) – The DataFrame with the results of the analysis.

  • identifier (str) – The identifier string to be added to the plot title.

iMaT.src.visualizations.analysis_results_graphs.display_analysis_number_of_sound_events_per_tone_duration(analysis_results, identifier)[source]

Display a bar diagram of the number of sound events per tone duration.

Parameters:
  • analysis_results (pd.DataFrame) – The DataFrame with the results of the analysis.

  • identifier (str) – The identifier string to be added to the plot title.

iMaT.src.visualizations.analysis_results_graphs.map_analysis_functions_to_display_functions(analysis_func: callable)[source]

Returns the corresponding results display function for a provided analysis function.

Parameters:

analysis_func (callable) – The analysis function for which the corresponding results display function is to be returned.

Returns:

The corresponding results display function.

Return type:

function

Raises:

ValueError – If the provided analysis function is not mapped to a results display function.

Module: visualizations.m21_integrated.py

This module, part of the visualizations package, leverages the music21 library to provide various methods of displaying and analyzing musical scores.

Functions

  • play_midi_score(selected_score): Plays the selected score in MIDI format.

  • show_musescore(selected_score): Displays the selected score in MuseScore.

  • show_chord_connections(selected_score): Visualizes the chord connections in the selected score.

  • show_figured_bass(selected_score): Presents the figured bass notation in the selected score.

  • show_chord_scale_system(selected_score): Visualizes the chord-scale system in the selected score.

  • show_pianoroll(selected_score): Creates a pianoroll view of the selected score.

  • show_voice_progression(selected_score): Illustrates the voice progression in the selected score.

  • show_volume_change(selected_score): Plots the volume change over time in the selected score.

  • show_key_analysis(selected_score): Provides a key analysis of the selected score.

  • display_file_export_directory(): Prints the directory where the score or analysis result files are exported.

These functions manage exceptions by leveraging the handle_error function from the src.utils package. The display_menu_print_textblock and display_menu_request_selection functions from src.cli.menu_constructors are used to interact with the user.

iMaT.src.visualizations.m21_integrated.display_file_export_directory()[source]

Prints the directory where the files are exported and waits for the user to press enter to continue.

iMaT.src.visualizations.m21_integrated.play_midi_score(selected_score)[source]

Plays the selected score in MIDI format and prints the directory where it’s exported.

Parameters:

selected_score (music21 stream) – Music21 stream object of the selected score.

iMaT.src.visualizations.m21_integrated.show_chord_connections(selected_score)[source]

Shows chord connections of the selected score and prints the directory where it’s exported.

Parameters:

selected_score (music21 stream) – Music21 stream object of the selected score.

iMaT.src.visualizations.m21_integrated.show_chord_scale_system(selected_score)[source]

Shows chord-scale system of the selected score and prints the directory where it’s exported.

Parameters:

selected_score (music21 stream) – Music21 stream object of the selected score.

iMaT.src.visualizations.m21_integrated.show_figured_bass(selected_score)[source]

Shows figured bass notation of the selected score and prints the directory where it’s exported.

Parameters:

selected_score (music21 stream) – Music21 stream object of the selected score.

iMaT.src.visualizations.m21_integrated.show_key_analysis(selected_score)[source]

Shows key analysis of the selected score and prints the directory where it’s exported.

Parameters:

selected_score (music21 stream) – Music21 stream object of the selected score.

iMaT.src.visualizations.m21_integrated.show_musescore(selected_score)[source]

Shows the selected score in MuseScore and prints the directory where it’s exported.

Parameters:

selected_score (music21 stream) – Music21 stream object of the selected score.

iMaT.src.visualizations.m21_integrated.show_pianoroll(selected_score)[source]

Shows a pianoroll view of the selected score and prints the directory where it’s exported.

Parameters:

selected_score (music21 stream) – Music21 stream object of the selected score.

iMaT.src.visualizations.m21_integrated.show_voice_progression(selected_score)[source]

Shows voice progression of the selected score and prints the directory where it’s exported.

Parameters:

selected_score (music21 stream) – Music21 stream object of the selected score.

iMaT.src.visualizations.m21_integrated.show_volume_change(selected_score)[source]

Shows volume change over time of the selected score and prints the directory where it’s exported.

Parameters:

selected_score (music21 stream) – Music21 stream object of the selected score.

Module: visualizations.main.py

This module, part of the visualizations package, provides workflow management for the display and playback of musical scores. It includes functions that manage score selection and handle user interaction post-analysis.

Functions

  • generic_display_workflow(display_func): Manages the workflow for displaying or playing back a musical score.

  • get_user_option_post_display(): Presents post-analysis options to the user and retrieves their selection.

This module interacts with several other packages including src.cli.menu_constructors, src.score_selection.main, src.score_selection.name_parts, and src.score_selection.select_parts_and_measures.

Examples

Please see the docstrings of individual functions for specific examples of their use.

iMaT.src.visualizations.main.generic_display_workflow(display_func: callable)[source]

Handles the display/playback function workflow for a musical score.

The workflow includes score selection, application of the display function, and the post-display options.

Parameters:

display_func (callable) – Function to display or playback the musical score.

iMaT.src.visualizations.main.get_user_option_post_display()[source]

Presents the user with post-analysis options and retrieves their selection.

The post-analysis options include “repeat”, “export”, “display_results”, or “back”.

Returns:

User’s selected option as a string.

Return type:

str