Skip to main content

PyMusicKit

A python project that uses Librosa and other libraries to analyze the key that a song (an .mp3) is in, i.e. F major or C# minor, using the Krumhansl-Schmuckler key-finding algorithm.

** Forked from Jack Mcarthur's work 'https://github.com/jackmcarthur/musical-key-finder' ** This forked version allows the user to install the package using pip and use it as a library in their own projects.

Installation

To install the package, run the following command in your terminal:

pip install pymusickit

Usage

Key Finder

from pymusickit.key_finder import KeyFinder

audio_path = 'sweet-home-alabama.mp3'
song = KeyFinder(audio_path)

#optional parameters: t_start, t_end (in seconds)
# song = KeyFinder(audio_path, t_start=10, t_end=20)

#variety of print functions
song.print_key()
song.print_chroma()
song.print_correlation()
song.print_correlation_table()

#plotting functions
song.chromagram(title="Sweet Home Alabama")

the KeyFinder class has many attributes to programatically access the data

Music Theory

from pymusickit.music_theory import MusicTheory
mt = MusicTheory(key_str = 'C')

'''
class MusicTheory:
    ...
    major_scale: List[Note]
    natural_minor_scale: List[Note]
    chromatic_scale: List[Note]
    pentatonic_scale: List[Note]
    mode: Mode
    modal_scale: List[Note]
    relative_minor: Note
    relative_major: Note
    key: Note
    ...

class Mode:
    ...
    mode_int:  0 = Ionian, 1 = Dorian, 2 = Phrygian, 3 = Lydian, 4 = Mixolydian, 5 = Aeolian, 6 = Locrian
    mode_str: 'Ionian', 'Dorian', 'Phrygian', 'Lydian', 'Mixolydian', 'Aeolian', 'Locrian'
    ...

class Note:
    ...
    note_str: 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B'
    note_int: 0 = C, 1 = C#, 2 = D, 3 = D#, 4 = E, 5 = F, 6 = F#, 7 = G, 8 = G#, 9 = A, 10 = A#, 11 = B
    ...
'''

the MusicTheory class has many attributes to programatically access the data

Metadata

Release files for pymusickit 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pymusickit 0.1.1
File Size Uploaded Provenance Actions
pymusickit-0.1.1.tar.gz 7.7 kB Without provenance Details for pymusickit-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pymusickit 0.1.1
File Interpreter ABI Platform Actions
pymusickit-0.1.1-py3-none-any.whl Python 3 none any Details for pymusickit-0.1.1-py3-none-any.whl

Total release size: 20.7 kB

Release files / pymusickit-0.1.1.tar.gz

Download URL pymusickit-0.1.1.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2397ebcdfc19f7e92adf7219f87277c3593302025e3520629c3baf56952e0569
BLAKE2b-256 checksum
How to use checksums
80072e5cc44371e96cfbb299c31497645666b4fd206b0461eb93c6e1e0248a0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release files / pymusickit-0.1.1-py3-none-any.whl

Download URL pymusickit-0.1.1-py3-none-any.whl
Size 13.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8675977b1037f65f7d056c49a2a9442d10d549b999c8dcde65d8e7b5116f2663
BLAKE2b-256 checksum
How to use checksums
f63658bd6539809db0ef3949162b2ed11595ef4bf9868debb80b8ee3c354cb65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Security for pymusickit 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page