Abstract MIDI pitches into keys, chords and notes.
Project description
midi_abstraction
Abstract midi pitches into keys, chords, and notes.
Installation
pip3 install midi_abstraction
Usage
#!/usr/bin/env python3
import random
import json
import midi_abstraction
if __name__ == '__main__':
# get a list of all available keys.
all_keys = midi_abstraction.list_key_names()
print('list of all keys:')
for option in all_keys:
print(option)
print()
# get a key at random
our_key = random.choice(all_keys)
print(f'our_key: {our_key}')
print()
# Initialize the musical key object
Song_key = midi_abstraction.Key(our_key)
# Print all notes found in chords in the key, in the lowest octave.
print(f'Song_key.notes_in_octave(0): {json.dumps(Song_key.notes_in_octave(0), indent = 4, sort_keys = True)}')
print()
# Print all chords in the key, in the lowest octave.
print(f'Song_key.chords_in_octave(0): {json.dumps(Song_key.chords_in_octave(0), indent = 4, sort_keys = True)}')
print()
# Print key chords in all octaves.
# print(f'Song_key.chords: {json.dumps(Song_key.chords, indent = 4, sort_keys = True)}')
# or
print(f'Song_key.chords_in_key(): {json.dumps(Song_key.chords_in_key(), indent = 4, sort_keys = True)}')
# Print all notes in key, all octaves
print(f'Song_key.notes_in_key(): {Song_key.notes_in_key()}')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
midi-abstraction-0.8.6.tar.gz
(3.3 kB
view hashes)
Built Distribution
Close
Hashes for midi_abstraction-0.8.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c695cc9aa89e9cc41d6cba7cb2bb4f1fd3b9ae4b322f9e981966bd2a9169fb0e |
|
MD5 | 4f203631bf0b601c3fa5dea21a6dd180 |
|
BLAKE2b-256 | 9872f21435a3a65aa929c57b994a2dcf949bec073e2566abdb9a44e28e6666d2 |