<h1 align="center">TorchFCPE</h1>
<div align="center">
</div>
## Useage
```python
from torchfcpe import spawn_bundled_infer_model
import torch
import librosa
# configure device and target hop_size
device = 'cpu'
sr = 16000
hop_size = 160
# load audio
audio, sr = librosa.load('test.wav', sr=sr)
audio = librosa.to_mono(audio)
audio_length = len(audio)
f0_target_length=(audio_length // hop_size) + 1
audio = torch.from_numpy(audio).float().unsqueeze(0).unsqueeze(-1).to(device)
# load model
model = spawn_bundled_infer_model(device=device)
# infer
f0 = model.infer(
audio,
sr=sr,
decoder_mode='local_argmax',
threshold=0.006,
f0_min=80,
f0_max=880,
interp_uv=False,
output_interp_target_length=f0_target_length,
)
print(f0)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/CNChTu/FCPE",
"name": "torchfcpe",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "pitch,audio,speech,music,pytorch,fcpe",
"author": "CNChTu",
"author_email": "2921046558@qq.com",
"download_url": "",
"platform": null,
"description": "<h1 align=\"center\">TorchFCPE</h1>\r\n<div align=\"center\">\r\n\r\n</div>\r\n\r\n\r\n## Useage\r\n\r\n```python\r\nfrom torchfcpe import spawn_bundled_infer_model\r\nimport torch\r\nimport librosa\r\n\r\n# configure device and target hop_size\r\ndevice = 'cpu'\r\nsr = 16000\r\nhop_size = 160\r\n\r\n# load audio\r\naudio, sr = librosa.load('test.wav', sr=sr)\r\naudio = librosa.to_mono(audio)\r\naudio_length = len(audio)\r\nf0_target_length=(audio_length // hop_size) + 1\r\naudio = torch.from_numpy(audio).float().unsqueeze(0).unsqueeze(-1).to(device)\r\n\r\n# load model\r\nmodel = spawn_bundled_infer_model(device=device)\r\n\r\n# infer\r\nf0 = model.infer(\r\n audio,\r\n sr=sr,\r\n decoder_mode='local_argmax',\r\n threshold=0.006,\r\n f0_min=80,\r\n f0_max=880,\r\n interp_uv=False,\r\n output_interp_target_length=f0_target_length,\r\n)\r\n\r\nprint(f0)\r\n```\r\n\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "The official Pytorch implementation of Fast Context-based Pitch Estimation (FCPE)",
"version": "0.0.3",
"project_urls": {
"Homepage": "https://github.com/CNChTu/FCPE"
},
"split_keywords": [
"pitch",
"audio",
"speech",
"music",
"pytorch",
"fcpe"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6cb9420b9d8070f542248aa00aa7d85513da0c1cf6735796324c8315488648bf",
"md5": "98b5fdd891c10bf9556f948d1bb990eb",
"sha256": "c92c2a3316b7dd71c24f8edfccc063bc0f1413b8ba3f9e556be9613db4d24fc1"
},
"downloads": -1,
"filename": "torchfcpe-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "98b5fdd891c10bf9556f948d1bb990eb",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 40220171,
"upload_time": "2024-01-13T14:22:44",
"upload_time_iso_8601": "2024-01-13T14:22:44.778874Z",
"url": "https://files.pythonhosted.org/packages/6c/b9/420b9d8070f542248aa00aa7d85513da0c1cf6735796324c8315488648bf/torchfcpe-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-13 14:22:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "CNChTu",
"github_project": "FCPE",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "torchfcpe"
}