torchfcpe
The official Pytorch implementation of Fast Context-based Pitch Estimation (FCPE)
What it is and what it does
TorchFCPE is a PyTorch implementation of Fast Context-based Pitch Estimation (FCPE), a neural network model for extracting fundamental frequency (F0) from audio signals. It's designed for both speech and music analysis, taking raw audio waveforms and producing frame-by-frame pitch estimates. The package wraps a pre-trained model accessible via `spawn_bundled_infer_model()`, which you can then call with audio tensors and configuration parameters like sample rate, decoder mode, and frequency bounds.
The model itself is a standard PyTorch module, so it integrates with the PyTorch ecosystem—you can move it between devices, compile it, or fine-tune it like any other `torch.nn.Module`. It depends on einops and local-attention for its internal computations, and expects audio as a PyTorch tensor. The inference API accepts optional parameters for V/UV (voiced/unvoiced) thresholding, frequency range constraints, and output interpolation.
Use it for:
- Extract pitch contours from speech recordings for prosody analysis or voice conversion pipelines.
- Estimate fundamental frequency from musical recordings for melody extraction or music analysis.
- Preprocess audio for singing voice synthesis or pitch-based audio effects.
- Build real-time pitch tracking systems by integrating the model into streaming audio applications.
- Validate or compare pitch estimates from other methods in audio research workflows.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
TorchFCPE estimates fundamental frequency (pitch) from audio using a PyTorch implementation of Fast Context-based Pitch Estimation, suitable for speech and music analysis.
Yes, if you need robust pitch estimation in PyTorch. The package has low install friction, permissive licensing, and no known vulnerabilities. However, maintenance is aging—the last release was March 2024 with no recent commits—so expect limited support for bugs or compatibility issues with newer PyTorch versions. Suitable for research and production use where pitch extraction is a component, not a primary concern.
Install
torchfcpe on PyPI
pip
pip install torchfcpeuv
uv add torchfcpepoetry
poetry add torchfcpeInstalling torchfcpe
Before you install
Low friction installation with a pure Python wheel. Maintenance status is aging—last release was 2024-03-06 and the repository shows no recent commits, though it remains unarchived with 210 stars.
License in practice
MIT license permits commercial and private use with minimal restrictions; you may use, modify, and distribute the package freely provided you retain the license notice.
Quickstart
pip install torchfcpe
from torchfcpe import spawn_bundled_infer_model
import torch
model = spawn_bundled_infer_model(device='cpu')
f0 = model.infer(audio, sr=16000, decoder_mode='local_argmax', threshold=0.006)
Requires torch and torchaudio as runtime dependencies; audio input must be a torch.Tensor with appropriate shape and sample rate.
Verify before relying
- Whether the bundled model weights are automatically downloaded on first use or require manual setup.
- Supported audio formats and preprocessing requirements beyond the librosa example shown.
- Performance characteristics (inference speed, memory usage) on typical hardware.
- Whether Python version constraints exist despite requires_python being unspecified.
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 5 — einops, local-attention, torch, torchaudio, numpy |
| Maintenance | aging — 891 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 143,468/month — #11,177 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: torchfcpe-0.0.4-py3-none-any.whl
Keywords: pitch, audio, speech, music, pytorch, fcpe
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
torchcrepePyTorch implementation of the CREPE pitch…
permissive · top 15,000 on PyPI
aubioaubio is a Python wrapper around a C library…
copyleft · top 15,000 on PyPI
pyloudnormMeasures and normalizes audio loudness…
permissive · top 5,000 on PyPI
pyworldPyWorld wraps the WORLD vocoder to decompose…
unclear · top 15,000 on PyPI
basic-pitchBasic Pitch converts audio files to MIDI…
unclear · top 15,000 on PyPI
torchlibrosaProvides PyTorch implementations of librosa…
permissive · top 15,000 on PyPI
pyrubberbandProvides Python wrappers for time-stretching…
permissive · top 15,000 on PyPI
torchaudioProvides PyTorch-based audio processing,…
permissive · top 5,000 on PyPI
torch-stoiComputes Short Term Objective Intelligibility…
permissive · top 15,000 on PyPI
stftpitchshiftShifts the pitch and timbre of audio signals…
permissive · top 15,000 on PyPI