Skip to main content

A Python package for music analysis. Keyfinder Forked from "https://github.com/jackmcarthur/musical-key-finder"

Project description

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

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

pymusickit-0.1.1.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

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

pymusickit-0.1.1-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file pymusickit-0.1.1.tar.gz.

File metadata

  • Download URL: pymusickit-0.1.1.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for pymusickit-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2397ebcdfc19f7e92adf7219f87277c3593302025e3520629c3baf56952e0569
MD5 61c2327a3b2506e8d3a0aefbcddafa7d
BLAKE2b-256 80072e5cc44371e96cfbb299c31497645666b4fd206b0461eb93c6e1e0248a0f

See more details on using hashes here.

File details

Details for the file pymusickit-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pymusickit-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for pymusickit-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8675977b1037f65f7d056c49a2a9442d10d549b999c8dcde65d8e7b5116f2663
MD5 8fb50e1701b059fca59740c70b6e699d
BLAKE2b-256 f63658bd6539809db0ef3949162b2ed11595ef4bf9868debb80b8ee3c354cb65

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