scamp_extensions.pitch.chord_builder.chords_from_pitch_classes

scamp_extensions.pitch.chord_builder.chords_from_pitch_classes(pcs, min_pitch, max_pitch, num_notes, prefer_unique_pcs=True, spacing_and_range_prefs=('compact', 'mid', 'even'), how_many=1)[source]

Find the voicings of the given pitch classes that best fit the given preferences.

Parameters:
  • pcs – the pitch classes (integers from 0 to 11) to voice

  • min_pitch – lowest MIDI pitch the voicing may use

  • max_pitch – highest MIDI pitch the voicing may use

  • num_notes – how many notes the chord should have; capped at the number of pitches available

  • prefer_unique_pcs – if True, prefer voicings that cover as many distinct pitch classes as possible, ahead of any of the other preferences

  • spacing_and_range_prefs – the qualities to prefer in a voicing, in decreasing order of priority. These are keys of measurement_functions: “wide”/”compact” (spread out or close together), “even”/”uneven” (equally or unequally spaced), and “high”/”low”/”mid” (placement within the range).

  • how_many – how many voicings to return

Returns:

a list of the best how_many voicings, each a tuple of MIDI pitches, best last