Skip to main content

Crepe pitch detection 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

  • Optimize inference performance

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.1.3.tar.gz (69.7 MB view details)

Uploaded Source

Built Distribution

torchcrepeV2-0.1.3-py3-none-any.whl (69.7 MB view details)

Uploaded Python 3

File details

Details for the file torchcrepeV2-0.1.3.tar.gz.

File metadata

  • Download URL: torchcrepeV2-0.1.3.tar.gz
  • Upload date:
  • Size: 69.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.10

File hashes

Hashes for torchcrepeV2-0.1.3.tar.gz
Algorithm Hash digest
SHA256 6935c28239a3666c087c68686783d38c5e54be3198d562c076e961cf66fdabfa
MD5 357c79f57595e421a73a4e51352cd8ca
BLAKE2b-256 f27cfdbb2d7a0a138bdfd767de7d8c896696e2b076ddce672e88fefa7ad3ff55

See more details on using hashes here.

File details

Details for the file torchcrepeV2-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: torchcrepeV2-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 69.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.10

File hashes

Hashes for torchcrepeV2-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 12e77ce3a92f46435b82b7b0c7e6192d17917e45dde4402d69e7216632bd4584
MD5 fb3634e8dd6f9b82dc6311e78fef8348
BLAKE2b-256 dad36c1580ec31b6d02eb9e77d33b6d24828c179dea5c3254b4d51c187d54972

See more details on using hashes here.

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