musif.extract.features.harmony.utils module

musif.extract.features.harmony.utils.CountChordsGroup(counter_function: List[str], number: str) Dict[str, str][source]
musif.extract.features.harmony.utils.compute_number_of_measures(done, starting_measure, previous_measure, measure, current_onset, num_beats)[source]
musif.extract.features.harmony.utils.continued_sections(sections, mc)[source]
musif.extract.features.harmony.utils.count_chords(chords: list, order: List[str] = []) Dict[str, str][source]
musif.extract.features.harmony.utils.create_measures_extended(measures)[source]
musif.extract.features.harmony.utils.get_additions(lausanne_table)[source]
musif.extract.features.harmony.utils.get_chord_type(chord_type)[source]
musif.extract.features.harmony.utils.get_chord_types(lausanne_table)[source]
musif.extract.features.harmony.utils.get_chord_types_groupings(chordtype_list)[source]
musif.extract.features.harmony.utils.get_chords(harmonic_analysis)[source]
musif.extract.features.harmony.utils.get_chords_functions(chords, relativeroots, local_keys) list[source]
musif.extract.features.harmony.utils.get_first_chord_local(chord, local_key)[source]
musif.extract.features.harmony.utils.get_first_numeral(numeral, relativeroot, local_key)[source]
musif.extract.features.harmony.utils.get_function_first(element, mode)[source]
musif.extract.features.harmony.utils.get_function_second(element)[source]
musif.extract.features.harmony.utils.get_harmonic_rhythm(ms3_table) dict[source]
musif.extract.features.harmony.utils.get_keyareas(lausanne_table, major=True)[source]
musif.extract.features.harmony.utils.get_keyareas_lists(keys, g1, g2)[source]
musif.extract.features.harmony.utils.get_keys(list_keys, mode)[source]
musif.extract.features.harmony.utils.get_measures_per_key(keys_options, measures, keys, mc_onsets, time_signatures)[source]
musif.extract.features.harmony.utils.get_numerals(lausanne_table)[source]
musif.extract.features.harmony.utils.get_numerals_lists(list_numerals, list_relativeroots, list_local_keys)[source]
musif.extract.features.harmony.utils.get_second_grouping_localkey(first_grouping, relativeroot, local_key)[source]
musif.extract.features.harmony.utils.make_type_col(df, num_col='numeral', form_col='form', fig_col='figbass')[source]
musif.extract.features.harmony.utils.parse_chord(chord)[source]
musif.extract.features.harmony.utils.same_measure(measures, i)[source]
musif.extract.features.harmony.utils.sort_labels(labels, git_branch='master', drop_duplicates=True, verbose=True, **kwargs)[source]
Sort a list of DCML labels following custom criteria.

Uses: split_labels()

Parameters
  • labels (collection or pandas.Series) – The labels you want to sort.

  • git_branch (str, optional) – The branch of the DCMLab/standards repo from which you want to use the regEx.

  • drop_duplicates (bool, optional) – By default, the function returns an ordered list of unique labels. Set to False in order to keep duplicate labels. Note that where the ordered features are identical, labels appear in the order of their occurrence.

  • verbose (.obj:bool, optional) – By default, values that are missing from custom orderings are printed out. Pass False to prevent that.

  • kwargs ({‘values’, ‘occurrences’, ‘rvalues’, ‘roccurrences’}, dict, list or callable) – Pass one argument for every feature that you want to sort in the order in which features should be used for sorting. The arguments will be mapped on the respective columns which should yield alpha-numeric values to be sorted. globalkey localkey pedal chord numeral form figbass changes relativeroot pedalend phraseend chordtype

Examples

musif.extract.features.harmony.utils.split_labels(labels, git_branch='master', dropna=True)[source]
Split DCML harmony labels into their respective features using the regEx

from the indicated branch of the DCMLab/standards repository.

Parameters
  • labels (pandas.Series) – Harmony labels to be split.

  • git_branch (str, optional) – The branch of the DCMLab/standards repo from which you want to use the regEx.

  • dropna (bool, optional) – Drop rows where the regEx didn’t match.