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 git+https://github.com/gudgud96/torchcrepeV2

from torchcrepeV2 import TorchCrepePredictor
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(y=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.0.1.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

torchcrepeV2-0.0.1-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for torchcrepeV2-0.0.1.tar.gz
Algorithm Hash digest
SHA256 ce26532dc3302c46c1cae1b2652cc572770ba14bb726213473a4bf958acf8e87
MD5 a9b5c67a1964ecf458c9f4fcc656b519
BLAKE2b-256 6d8286d6bd040d269ed4f8b393f7c58ea558f74d24acea45e396296cd5f91128

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for torchcrepeV2-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ca525f703c2a4e806b4807a12b4826a74c484c520d4fe2802e91012cca6f805e
MD5 3ddc4943c8215998d7cb3dc191460b38
BLAKE2b-256 6d22e6f3ee0ef953c69fc4764eab52dea8df25916ba47405676eef8bd143d592

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