Skip to main content

Fast, data‑driven harmony analysis for any MIDI file

Project description

midiharmony

Fast, data‑driven harmony analysis for any MIDI file

midiharmony

Abstract

midiharmony provides fast, stand‑alone harmony analysis for MIDI files by comparing their chord and note relationships against a high‑quality database of extracted chord quads. This approach enables reliable detection of strong harmonic structure, musically coherent progressions, and potential inconsistencies, making it a practical tool for music‑AI pipelines, composition analysis, and large‑scale MIDI processing.


Install

!pip install -U midiharmony

Basic use example

Using midiharmony is easy and requires just two lines of code :)

Analyze a single MIDI

import midiharmony

midi_harmony_dict = midiharmony.analyze_midi('Come To My Window.mid')

Analyze MIDI folder(s)

import midiharmony

midi_harmony_dicts_list = midiharmony.analyze_midi_folders(['./midi_folder_1', './midi_folder_2'])

midiharmony API reference list

midiharmony.find_quads_fast_cupy
Count matching 4‑chord rows between two arrays using a GPU‑accelerated FNV‑1a hash.

midiharmony.find_quads_fast_numpy
Count matching 4‑chord rows between two arrays using NumPy on CPU.

midiharmony.get_trg_array
Load and cache the target harmonic‑quad array in NumPy or CuPy form.

midiharmony.process_midi
Extract chords, grouped chords, and unique 4‑chord quads from a MIDI file.

midiharmony.analyze_processed_midi
Compare extracted quads against the target database and compute harmony metrics.

midiharmony.analyze_midi
Run the full pipeline: process a MIDI file and evaluate its harmonic quality.

midiharmony.analyze_midi_folders
Batch‑analyze all MIDI files in one or more folders and return harmony reports.

midiharmony.helpers.get_package_data
Return a sorted list of packaged .npz data files with their resolved paths.

midiharmony.helpers.get_normalized_midi_md5_hash
Compute original and normalized MD5 hashes for any MIDI file.

midiharmony.helpers.normalize_midi_file
Normalize a MIDI file and write the normalized version to disk.

midiharmony.helpers.is_installed
Check whether a Debian package is installed using dpkg-query.

midiharmony.helpers._run_apt_get
Internal helper to run apt-get commands with consistent flags and timeout.

midiharmony.helpers.install_apt_package
Idempotently install an apt package with retries, optional sudo, and optional python‑apt.


Project Los Angeles

Tegridy Code 2026

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

midiharmony-26.1.28.tar.gz (39.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

midiharmony-26.1.28-py3-none-any.whl (39.0 MB view details)

Uploaded Python 3

File details

Details for the file midiharmony-26.1.28.tar.gz.

File metadata

  • Download URL: midiharmony-26.1.28.tar.gz
  • Upload date:
  • Size: 39.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for midiharmony-26.1.28.tar.gz
Algorithm Hash digest
SHA256 24ed43b4e084966610b591832f62ee32ca144d5c9c6ef22e35649aaa07dd9dd9
MD5 a67e7d86561fbcc1aff734acc74b039e
BLAKE2b-256 ecdf400fb22f6450cc60a0648a35cb5e78652a1d92104bf583dbe4c351fa773c

See more details on using hashes here.

File details

Details for the file midiharmony-26.1.28-py3-none-any.whl.

File metadata

  • Download URL: midiharmony-26.1.28-py3-none-any.whl
  • Upload date:
  • Size: 39.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for midiharmony-26.1.28-py3-none-any.whl
Algorithm Hash digest
SHA256 6d9aeba799c6c1f80cbcf59964bc0f802200dd1fe8e95b413d4a7fab19f23465
MD5 da0f2bbf185e851e185407d370670431
BLAKE2b-256 5d968a2969f5828b04a97c00e94702d4355406a45b00b42ac5d600d3693343f7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page