Skip to main content

Robust pitch prediction using PyTorch

Project description

RobPitch

Overview

RobPitch is a pitch detection model trained to be robust against noise and reverberation environments. The model has been trained on 1600 hours of high-quality data, supplemented by an equivalent amount of simulated noisy and reverberant data, ensuring effective performance under challenging acoustic conditions.

Installation

pip install rob-pitch==0.1.0

Model Download

We use modelscope to download pretrained model and config.

from modelscope import snapshot_download
model_dir = snapshot_download('pandamq/robpitch-16k')
cp -r ~/.cache/modelscope/hub/pandamq/robpitch-16k .

Usage Example

import torch
import numpy as np

from robpitch import RobPitch
from utils.audio import load_audio

# Initialize the model
robpitch = RobPitch()
device = torch.device("cpu")

# Load model from checkpoint
model = robpitch.load_from_checkpoint(
    config_path="robpitch-16k/config.yaml",
    ckpt_path="robpitch-16k/model.bin",
    device=device
)

# Load and process the audio
wav = load_audio(
    "path/to/audio",
    sampling_rate=16000,
    volume_normalize=True
)
wav = torch.from_numpy(wav).unsqueeze(0).float().to(device)

# Get model outputs
outputs = model(wav)
pitch = outputs['pitch']
latent_feature = outputs['latent']

For more detailed usage examples, refer to the exp/demo.ipynb notebook.

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

rob_pitch-0.1.0.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

rob_pitch-0.1.0-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

Details for the file rob_pitch-0.1.0.tar.gz.

File metadata

  • Download URL: rob_pitch-0.1.0.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.19

File hashes

Hashes for rob_pitch-0.1.0.tar.gz
Algorithm Hash digest
SHA256 17ae982e7a104bb5115ff9210234e5c0f2de23c9dd3b20552ec4fc4d43c70c80
MD5 75c441e335acd86b685ecf902d972cea
BLAKE2b-256 8180762960af3616a7b1e2c555288b56f9d5a8e16b2d0b39209654cf3aa144f7

See more details on using hashes here.

File details

Details for the file rob_pitch-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: rob_pitch-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.19

File hashes

Hashes for rob_pitch-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6b4233064678e259740657062f7e08547fe436826820f0610be5ee3cd31e8175
MD5 59f44065648f44689df72cbe08ecdb89
BLAKE2b-256 1cd7f2ab8ecc4cac476c097e939736ca724f973da2d8e097be025b27a9869b0f

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