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.1.1.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for torchcrepeV2-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8d4fc8c11f6598ccdc5983eccf374d603a833cf28808667767d55b562b8dfc59
MD5 b6929279087159f916515c21a029604b
BLAKE2b-256 4d91603034920bd417da9541bc49c679aa0d93615e442d29c3244d292ad6088e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for torchcrepeV2-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3cfa20474336fc553cad568864bf7c5c210eef5625c03a5b10eaf08cef0f103f
MD5 081bb7f180e6c8b7a785f91ce42d1407
BLAKE2b-256 4741ca1fe69aca99447638355c88717a351f592ea27d888bd315621561ca1bb9

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