Skip to main content

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)


Installation

macOS

brew install fftw
pip install loristrck

Linux

apt install libfftw3-dev libsndfile1-dev
pip install loristrck

Windows

pip install loristrck

Install from source in Windows

You need to have Visual Studio installed

# From a Developer Powershell
python scripts/prepare_windows_build.py

# From a normal prompt
pip install .

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

Author

eduardo dot moguillansky @ gmail dot com

License

GPL

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

loristrck-1.4.0.tar.gz (1.0 MB view hashes)

Uploaded source

Built Distributions

loristrck-1.4.0-cp39-cp39-win_amd64.whl (2.5 MB view hashes)

Uploaded cp39

loristrck-1.4.0-cp39-cp39-win32.whl (2.5 MB view hashes)

Uploaded cp39

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page