简单的音乐键检测
项目描述
穆舍
简单的音乐键检测。
目录
快速开始
安装
pip install musher
文档
示例使用
我应该使用什么密钥配置文件?
安装
您可以选择以 2 种方式安装此软件包,Python 和 C++。该包最初是用 C++ 编写的,并用 Python 包装。选择以下安装方法之一。
Python 3.5+
pip install musher
C++ 14
依赖项
制作
-- MacOS --
brew install cmake
-- Linux --
sudo apt install cmake
-- Windows --
Download from https://cmake.org/download/
柯南
pip install conan
安装(在制品)
conan install musher
用法
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}
关键配置文件
发展
Python
正常安装
pip install .
# OR
python3 setup.py install
以调试模式安装
pip install -e .
# OR
python3 setup.py develop
注意:这个包有 2 个依赖项:Pybind11和Numpy。如果 setup.py 没有为您安装这些 python 包,您可能需要安装这些包。
C++
正常构建
python setup.py cmake
# OR
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build .
在调试模式下构建
python setup.py cmake --debug
# OR
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug -DENABLE_TESTS=On
cmake --build .
测试
Python
必需的依赖项
pip install tox pytest
运行测试
这将针对源代码的 pip 安装副本运行测试(最好在部署代码之前执行)。
# Running this command does not require pytest to be installed
tox
这将直接运行测试(最好在修改代码库时进行)。
pytest ./tests -v
C++
必需的依赖项
- 谷歌测试(当项目以调试模式构建时,柯南应该为你安装这个。)
运行测试
# Ctest
python setup.py ctest
# OR
# Google test
python setup.py gtest
文档
使用 Doxygen、Breathe 和 Sphinx 生成文档。
链接到文档
依赖项
- Doxygen >1.5.1 - 生成 C++ 文档
- 呼吸- 将 Doxygen 文档翻译成 Sphinx 文档
- Sphinx - 生成 python 文档
- C++ 依赖项- 构建项目所必需的
如何生成
python setup.py cmake --docs
发布到 Github 页面
在运行此命令之前,您必须安装 python 模块并生成文档。
pip install -e .- 生成文档
python setup.py publish_docs -m "Added docs for new function"
清理
这将删除在构建和测试此包时创建的所有临时文件/文件夹。
python setup.py clean
有用的链接
Python 音频库:
学分
Essentia - 用于音频和音乐分析、描述和合成的 C++ 库,包括 Python 绑定。
项目详情
下载文件
下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。
源分布
musher-0.0.4.tar.gz
(36.4 MB
查看哈希)
内置发行版
musher-0.0.4-pp37-pypy37_pp73-win32.whl
(191.1 kB
查看哈希)
musher-0.0.4-pp36-pypy36_pp73-win32.whl
(191.1 kB
查看哈希)
musher-0.0.4-cp39-cp39-win_amd64.whl
(230.4 kB
查看哈希)
musher-0.0.4-cp39-cp39-win32.whl
(192.6 kB
查看哈希)
musher-0.0.4-cp38-cp38-win_amd64.whl
(230.1 kB
查看哈希)
musher-0.0.4-cp38-cp38-win32.whl
(192.3 kB
查看哈希)
musher-0.0.4-cp37-cp37m-win_amd64.whl
(231.7 kB
查看哈希)
musher-0.0.4-cp37-cp37m-win32.whl
(194.2 kB
查看哈希)
musher-0.0.4-cp36-cp36m-win_amd64.whl
(231.5 kB
查看哈希)
musher-0.0.4-cp36-cp36m-win32.whl
(194.0 kB
查看哈希)
musher-0.0.4-cp35-cp35m-win_amd64.whl
(231.5 kB
查看哈希)
musher-0.0.4-cp35-cp35m-win32.whl
(194.0 kB
查看哈希)
关
musher -0.0.4-pp37-pypy37_pp73-manylinux2010_x86_64.whl 的哈希值
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | 474dcf55b83fa73e6be7ee5bcb0dd7e249203ddf44d7ed127c7f46fbd7449100 |
|
| MD5 | b20eaecc4a067a1eedd4b6c78d397a46 |
|
| 布莱克2-256 | ced4d0a8a0a3559e52e2392006979c728d33b7c1306738af58654e72928853ae |
关
musher -0.0.4-pp36-pypy36_pp73-manylinux2010_x86_64.whl 的哈希值
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | efdb2d2db5567d740c6f86a946faeeb710650d99cbc1222600e1ba41a945cbfc |
|
| MD5 | efe249ec0719c6d6b529d1978727ce47 |
|
| 布莱克2-256 | b6ac020dac109fe87afda869c29e2b5d7550f2d6e40b17488d0c4d92eef96d8c |