Simple musical key detection
Project description
Musher
Simple musical key detection.
Table of Contents
- Musher
- Table of Contents
- Quick Start
- Installation
- Usage
- Development
- Tests
- Documentation
- Cleanup
- Useful links
- Credits
Quick Start
Install
pip install musher
Documentation
Sample Usage
What key profile should I use?
Installation
You can choose to install this package in 2 ways, Python and C++. The package was primary written in C++ and wrapped in Python. Choose either of the following methods of installation.
Python 3.5+
pip install musher
C++ 14
Dependencies
Cmake
-- MacOS --
brew install cmake
-- Linux --
sudo apt install cmake
-- Windows --
Download from https://cmake.org/download/
Conan
pip install conan
Install (WIP)
conan install musher
Usage
import os
import musher
audio_file_path = os.path.join("data", "audio_files", "mozart_c_major_30sec.wav")
wav_decoded = musher.decode_wav_from_file(audio_file_path)
print(wav_decoded)
{'avg_bitrate_kbps': 1411,
'bit_depth': 16,
'channels': 2,
'file_type': 'wav',
'length_in_seconds': 30.0,
'mono': False,
'normalized_samples': array([
[ 0. , 0. , 0. , ..., -0.33203125, -0.32833862, -0.3274536 ],
[ 0. , 0. , 0. , ..., -0.29162598, -0.27130127, -0.25457764]
], dtype=float32),
'sample_rate': 44100,
'samples_per_channel': 1323000,
'stereo': True}
normalized_samples = wav_decoded["normalized_samples"]
sample_rate = wav_decoded["sample_rate"]
# Different key profiles produce different results.
# 'Temperley' produces good results for classical music.
key_profile_type = "Temperley"
key_output = musher.detect_key(normalized_samples, sample_rate, key_profile_type)
print(key_output)
{'first_to_second_relative_strength': 0.6078072169442225,
'key': 'C',
'scale': 'major',
'strength': 0.7603224296919142}
Key Profiles
Description of all available key profiles
Development
Python
Install normally
pip install .
# OR
python3 setup.py install
Install in debug mode
pip install -e .
# OR
python3 setup.py develop
NOTE: This package has 2 dependencies: Pybind11 and Numpy. You may need to install these python packages if the setup.py does not do it for you.
C++
Build normally
python setup.py cmake
# OR
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build .
Build in debug mode
python setup.py cmake --debug
# OR
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug -DENABLE_TESTS=On
cmake --build .
Tests
Python
Required dependencies
pip install tox pytest
Running tests
This will run tests against a pip installed copy of the source code (best to do before deploying code).
# Running this command does not require pytest to be installed
tox
This will run tests directly (best to do while modifying the code base).
pytest ./tests -v
C++
Required dependencies
- Google Test (Conan should install this for you when the project is built in debug mode.)
Running tests
# Ctest
python setup.py ctest
# OR
# Google test
python setup.py gtest
Documentation
Generate documentation using Doxygen, Breathe, and Sphinx.
Link to documentation
Dependencies
- Doxygen >1.5.1 - Generates C++ documentation
- Breathe - Translate Doxygen docs to Sphinx docs
- Sphinx - Generates python documentation
- C++ dependencies - Required to build the project
How to Generate
python setup.py cmake --docs
Publish to Github Pages
You must install the python module and generate the docs BEFORE running this command.
pip install -e .
- Generate docs
python setup.py publish_docs -m "Added docs for new function"
Cleanup
This will remove all the temporary files/folders created from building and testing this package.
python setup.py clean
Useful links
Python audio libraries:
Credits
Essentia - C++ library for audio and music analysis, description and synthesis, including Python bindings.
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
Built Distributions
Hashes for musher-0.0.4-pp37-pypy37_pp73-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c8fc73b205e12881982b0110256e329cac2949cf6167d869247dbbf68cca7a9 |
|
MD5 | 8798f3b4d508c1b420301c81b123e3ee |
|
BLAKE2b-256 | ce30a97a4b7b3d022cedf2c1adb7e9d1482686898adeb9b5e663aaefdf324097 |
Hashes for musher-0.0.4-pp37-pypy37_pp73-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 474dcf55b83fa73e6be7ee5bcb0dd7e249203ddf44d7ed127c7f46fbd7449100 |
|
MD5 | b20eaecc4a067a1eedd4b6c78d397a46 |
|
BLAKE2b-256 | ced4d0a8a0a3559e52e2392006979c728d33b7c1306738af58654e72928853ae |
Hashes for musher-0.0.4-pp36-pypy36_pp73-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7dc0248733c2f243b3263a646ec4d7dba03825c05de1bc482f720cc53c77ada6 |
|
MD5 | 7be78309df134bbf266318de714a6eee |
|
BLAKE2b-256 | 1d712ea19cbc58f70627e642d388f262d461108f8aa607a6e5a14c75c67ee1a1 |
Hashes for musher-0.0.4-pp36-pypy36_pp73-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | efdb2d2db5567d740c6f86a946faeeb710650d99cbc1222600e1ba41a945cbfc |
|
MD5 | efe249ec0719c6d6b529d1978727ce47 |
|
BLAKE2b-256 | b6ac020dac109fe87afda869c29e2b5d7550f2d6e40b17488d0c4d92eef96d8c |
Hashes for musher-0.0.4-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4296b63093f7a4cefdf3df24e5545e90f6aff963260aaf85561cf16e52116072 |
|
MD5 | 9ab4c57ba441df652fe8f120a0021a99 |
|
BLAKE2b-256 | 7c71ee4f8420d386d1a66fe7ff22a27a70de83934ea1a5b45c57ac4a25d4718b |
Hashes for musher-0.0.4-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | da72b022d2144c3a362f09579b040c301ff5326a162ebbc8b32e7f16842dc6d7 |
|
MD5 | 8e9945381e4a4f3a089a6f7d4a03b5bf |
|
BLAKE2b-256 | ea1d447118001ed39fb697d8f06d5595f77d8d7f4349209c1ef40cb4a7c60057 |
Hashes for musher-0.0.4-cp39-cp39-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f813a0ab2d2c5d8c0db3b293fd597e3f681ece44a09196e15bbe62a769a016aa |
|
MD5 | 2ce3bc82456405658b9e851c443985f8 |
|
BLAKE2b-256 | 52faff103dcb9ca08b787a18c0230e9cc7f4a75ce87635e8ae760e9fd32720ce |
Hashes for musher-0.0.4-cp39-cp39-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94ac557776cbc4126fc7deea61ebd0a4bdbe91bfec427396bcf012002d1bf2e4 |
|
MD5 | 46a07a8f3117ce4c0585d5834aa63272 |
|
BLAKE2b-256 | f260b987a80dd17f7add00b0384e0e9b8b6aa59960fa3fafdd105506c41f57d7 |
Hashes for musher-0.0.4-cp39-cp39-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd51fecc65a76333feb055d28b65303ca36e35568690d1e7af2f1ad6e358ec1c |
|
MD5 | 339f656d8923a0bb2f6f456a07cbc425 |
|
BLAKE2b-256 | 662f8f8c3f66840d4214d725392c86d3d417c41d4c182ae423875df0ecae59c9 |
Hashes for musher-0.0.4-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0590f8b130ec77721bd56c517d54259a50dd1da43181ad2e67b91d8ba23c19f |
|
MD5 | d4557611623e52572d5a2f5d8298d0af |
|
BLAKE2b-256 | b9b47e4e10ad296e3e949df27af68c157f6a9eb1f05d6f2fc1d85c5945c6d572 |
Hashes for musher-0.0.4-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4719db5868dc6047e866299950d1923f55adf2f4bbbcd61f853647965a582eb5 |
|
MD5 | e87e9499ef03bca2a1daa3a4f2517c62 |
|
BLAKE2b-256 | 6dd09ed014102483fe1b9aa7249df48df28c7693f148f25c9a2440b56b0b9f38 |
Hashes for musher-0.0.4-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d38d9ca3cf3d38acbb4784cf76e74ca3fde0cf164722c6f3f63eeccd126e60a |
|
MD5 | ff271a29951debdc7ebeed036d979b0f |
|
BLAKE2b-256 | 93be08059aec7cf90f9a632e5202840fffe1c1528945f220edf67955f7e4f72d |
Hashes for musher-0.0.4-cp38-cp38-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6db3bf65e9d12fb7b03e2c12f91ef33d423c8f0e0253a432930527b4c0d653b3 |
|
MD5 | c432d0c6879cf175ae251fdd05a3d95f |
|
BLAKE2b-256 | beb9a440488bbfe567042d2d5f8104fd78a359a70c94c3d2f509b68cf7d4530d |
Hashes for musher-0.0.4-cp38-cp38-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ab72791f8d7225fae4602c73755e783915ac3562d5c9157100894de171fdec4 |
|
MD5 | b2ee565bb3b73294614a2632ca852988 |
|
BLAKE2b-256 | 4e743889e3baec97453ccec662dedefc700c39f0cb946a864969152cfbd9dc14 |
Hashes for musher-0.0.4-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8161ef54cae5ba8a93943c2c4c3829d86489f1656fcba20fc4e56ec9a9a43b45 |
|
MD5 | eac1be183829af209cadc992948b380a |
|
BLAKE2b-256 | 1f380ad49be2ca56cc1bc6473f0b37d2aea674d75d8a3077a19147c5b8163104 |
Hashes for musher-0.0.4-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e7805d626381289c86138bb067c80790dbe89f46f44d05d02d6b4fbcbb52b405 |
|
MD5 | 85e1c1580bf95b1f0d0c233a2c8cde44 |
|
BLAKE2b-256 | f283fa1b90679fbac155875a1b7be8d87a9a3fa5405655e4674e34c9741c2441 |
Hashes for musher-0.0.4-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f09b9d7a47384b1c1d0144fd63d1d5dea7815277ce36bd5f997f910c482ab49e |
|
MD5 | 495f51b8303a0a701207dfbc4d76c384 |
|
BLAKE2b-256 | 031d3966e50f2a456931ce01b2caa83ccb9c141f8662abd9681751e6d5649e30 |
Hashes for musher-0.0.4-cp37-cp37m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 470480a7c3c99213a8fb3a1319638678a7b4aa15de8609ed72003f821244df63 |
|
MD5 | 4f2301dfa7b1f64d4b868cd10cada26c |
|
BLAKE2b-256 | 05abbeb375e748141897414ef23c4dfacbde2ef6c41b9104ff179c8cde2883de |
Hashes for musher-0.0.4-cp37-cp37m-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65e202a885171376efb8c4ece823c37f4dd613e60b8211fbd48c3353db8fa39e |
|
MD5 | f3d179924af498d016563aaf3b14ff45 |
|
BLAKE2b-256 | 4498e2308f6c253753ddd1054ba36e18f710b7331b11daeed6bfb13a5ae599b0 |
Hashes for musher-0.0.4-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f028664e28fb9135f0cb3a3ff00bf5af4760c872be09f29099c4141b01d85757 |
|
MD5 | 5a1d85861cd1842039eee657a485c63f |
|
BLAKE2b-256 | 0e15ac2b7f81bc4e462a1dbe3ae9d67b0b78a4418af5cc9754d9e5129605bf18 |
Hashes for musher-0.0.4-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c44a29ecb1aa952833907f3f2d3d248d3d40889d26a9e8f3d233e083d42c042 |
|
MD5 | 1c3dc4ac9b9e9b8d9c267ef2ecff62c4 |
|
BLAKE2b-256 | 05b3f3dc8bcce21875007a99a419de16379bbeb8ce8ed0f6264347b8deece640 |
Hashes for musher-0.0.4-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 801f022344813492e2bf6174ef3a684e6e2b38e79bb689a5ca2206a5c3b9f1b7 |
|
MD5 | d2994e8a81602fa36a749d53305f36fd |
|
BLAKE2b-256 | 639c928a0ccceddf47fe94b911838e3da07f2053a9eeb217728f9b692795d45c |
Hashes for musher-0.0.4-cp36-cp36m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dbdc15bc8be3f7387d36c79805582af242c872b2266151a693a668d2959eb6aa |
|
MD5 | ed2b2d31108fc96ecc2f5deed3ac52be |
|
BLAKE2b-256 | 9e2a5e372dd5b0662ac528f9dfdf79b58243ab3b9fdfd0fc7d52917aaa48fe37 |
Hashes for musher-0.0.4-cp36-cp36m-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c788fcf2dc107b937b2f552a952a342e5ee41bca39ada17ec9fc1cdabb5dedf9 |
|
MD5 | 0d9542e636fe0d27704cdf6408374ddc |
|
BLAKE2b-256 | de7dfb7b412a171e4aef77ce0ae2474ee4b2132a16347a1ef16c584956904743 |
Hashes for musher-0.0.4-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa7504ae76e5bd7ad8b4dd535c5c8ec51f01edb78d9b8e42091e987086efab78 |
|
MD5 | c2a945a114d93d032723340f2ae7a370 |
|
BLAKE2b-256 | 3227527491738362c291c383ff50c24f89158ad5f27db6e9dac888c6dda4050e |
Hashes for musher-0.0.4-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 00cf32c3095d2c35c065e4c0fb3bf2af486e62bb73d27e59e16c3adb21347c6f |
|
MD5 | a8a70eb3a8ca96375a6451d355a4ea71 |
|
BLAKE2b-256 | 0fdf1a67cca889a8554bb96f3bdb0077f9d5db99b0e0e8883623bf16c2633ede |
Hashes for musher-0.0.4-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ee6b5b9be6f7da7e15a7ff1513bf5b225c3f817e8e518aada210bf6122a7212 |
|
MD5 | 2e02057bc163c5eab3377ba121bd93cc |
|
BLAKE2b-256 | 386a606386a9ac8242cf9a71ddbcb7f58c8a03dcccb2c84630beb99e827b3f9f |
Hashes for musher-0.0.4-cp35-cp35m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd76d418db92d5a4db0cf689594b9666e641d194d15a82a9094e92d479143492 |
|
MD5 | 81b735a7fd7f0224afb5766344a3afb1 |
|
BLAKE2b-256 | a2dd30b69c3a50aa8471c1ef7019acd5e7f1eb6105435605e615e3b231f7ede2 |
Hashes for musher-0.0.4-cp35-cp35m-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd4e2f1675097ae3907679545fc7a6e3ff8a01755c586ad485b28226e878419e |
|
MD5 | 0e1cddf6d301d7958fba661dfa425ce7 |
|
BLAKE2b-256 | 6a39815bc87865f82439e3c41794d5bc34931f7ee75b84f8ba444b4584101ffa |