A wrapper around the partial-tracking library Loris
Project description
LORISTRCK
loristrck is a wrapper for the C++ partial-tracking library Loris.
It is written in cython and targets python 3 (>= 3.8 at the moment). The source of the library is included as part of the project and does not need to be installed previously.
- C++ Library Dependencies:
- Additional Python Module Dependencies:
Cython
NumPy
pysndfile + libsndfile
sounddevice to be able to play samples (see loristrck_play)
- Optional dependencies:
csound (in order to play .mtx files, as generated by loristrck_pack)
Documentation
Installation
Install from source
- Install dependencies (see each platform):
fftw
libsndfile
git clone https://github.com/gesellkammer/loristrck cd loristrck pip install -r requirements.txt pip install .
OSX using homebrew
loristrck is a C/C++ extension for python 3 (>=3.6) and needs a compiler present. It is developed in linux but should work in macOS and Windows without problems
brew install fftw brew install libsndfile pip install numpy cython pip install loristrck
Linux
apt install libfftw3-dev libsndfile1-dev pip install numpy cython pip install loristrck
Windows
Install libsndfile from http://www.mega-nerd.com/libsndfile/#Download
Install fftw3 from http://www.fftw.org/install/windows.html
Download the 32-bit binary package. Unzip to a directory of your choice. Suggestion: C:\\src. You should have then a folder C:\\src\\fftw
Put that directory in your PATH (Control Panel/System/Advanced/Environmental Variables/)
python setup.py install -LC:\\my\\path\\to\\fftw
At the command-line, do:
git clone https://github.com/gesellkammer/loristrck cd loristrck pip install -r requirements.txt pip install .
Otherwise, install it via pip:
pip install numpy cython pip install loristrck
(this assumes that you put the fftw3 source under C:\\src)
Usage
import loristrck as lt
samples, sr = lt.sndreadmono("/path/to/sndfile.wav")
partials = lt.analyze(samples, sr, resolution=60)
# partials is a python list of numpy arrays
# select a subset of most significant partials
selected, noise = lt.select(partials, mindur=0.02, maxfreq=12000, minamp=-60, minbp=2)
# print each partial as data
for partial in selected:
print(partial)
# plot selected partials
lt.plot_partials(selected)
# now resynthesize both parts separately
lt.partials_render(selected, outfile="selected.wav")
lt.partials_render(noise, outfile="noise.wav")
Each partial will be a numpy array of shape = (numbreakpoints, 5) with the columns:
time, frequency, amplitude, phase, bandwidth
See the example scripts in bin for more complete examples
See also
sndtrck: https://github.com/gesellkammer/sndtrck
License
GPL
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 loristrck-1.2.2-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d53002b015b6b25a435c2f5e5a58dbe3f6a3874ca9c16e5adf97f405948fd9b4 |
|
MD5 | 48cef55df7effd3bb71d636aa3e94bdd |
|
BLAKE2b-256 | a6f5d7ec92cf4b6923eb3055e49750fc8949ffe7788cabbc8769cad49b30640f |
Hashes for loristrck-1.2.2-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a4183c6ca86a344fdfe405f620c79f075dea799b95f3e623e0441e8a2a24698 |
|
MD5 | 002cbc717a4988e30ac99cdb3875f0ad |
|
BLAKE2b-256 | 0f49d32e8e1b3a7c6006831200ce53941434511aedd6240fc0a80ec2f2511ced |
Hashes for loristrck-1.2.2-cp39-cp39-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c83c22a845409b6349be5275d4574b52578df14df57f37854e1bcd4e22fcb91 |
|
MD5 | 1edbbe130b1bdce354dcebb5bcff3553 |
|
BLAKE2b-256 | 970b509e28af242eb0704bd92ebde33fb05e64ff1bbd67f3bd8cf7c166a39078 |
Hashes for loristrck-1.2.2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09ab32bcfdaa944984e148af4f7a7f07880090a3c058a629cfa4bb480ae7966d |
|
MD5 | 45366783e8635092dec4a00d1a751678 |
|
BLAKE2b-256 | a00d2b9d194aa1b156ee9af18b26ca27bb5da0e5dd7808a02bce6e9a1b35e40f |
Hashes for loristrck-1.2.2-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a5bbf3df17e5038bdae9178fc26714dcb356deefddc45cfd718960017a2ecf6 |
|
MD5 | fddf9a4ad21b6522d3a197c814fcd82a |
|
BLAKE2b-256 | d6479fce9846a7b5469a2bd5057d39f4982261c3d544ca8a6f370d8b8cde7716 |
Hashes for loristrck-1.2.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2f46150e4dbd3a798e4bf55eddaa568e26a74e6e1e71d609748502edb318764 |
|
MD5 | 01ad72e1e705cb68a013e77cadf04537 |
|
BLAKE2b-256 | fb6a191376675ae218e9e0fb079e8b98ef52046db759d3aaf4392ef7eaace21e |