Skip to main content

Yet another crepe (pitch tracking tool) in PyTorch.

Project description

TorchCrepeV2

My own version of crepe in PyTorch, SOTA pitch tracking tool. Releasing as pip package for ease of usage.

Only full version of model is supported.

Similar project: https://github.com/maxrmorrison/torchcrepe

Usage

pip install torchcrepeV2

from torchcrepeV2 import TorchCrepePredictor
import librosa
import numpy as np
import matplotlib.pyplot as plt

y, sr = librosa.load("some_audio.wav", sr=16000)
torch_crepe = TorchCrepePredictor(device="cuda")

# all arguments are aligned with original crepe implementation
f = torch_crepe.predict(audio=y, 
                        sr=sr,
                        viterbi=True, 
                        center=True, 
                        step_size=10)

# can add some post-processing
block_size = 100
length = y.shape[0] // 100
if f.shape[-1] != length:
    f = np.interp(
        np.linspace(0, 1, length, endpoint=False),
        np.linspace(0, 1, f.shape[-1], endpoint=False),
        f,
    )

plt.plot(f, label='torchcrepe')
plt.show()

Results

Tracked pitch nearly identical as compared to crepe.

TODO

  • Add unit tests

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

torchcrepeV2-0.2.0.tar.gz (70.8 MB view hashes)

Uploaded Source

Built Distribution

torchcrepeV2-0.2.0-py3-none-any.whl (70.8 MB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page