No project description provided
Project description
Torch Pitch Shift
Pitch-shift audio clips quickly with PyTorch (CUDA Supported)!
About
This library can pitch-shift audio clips quickly to using PyTorch.
Installation
pip install torch_pitch_shift
Usage
Example:
import torch
import numpy as np
from scipy.io import wavfile
from torch_pitch_shift import *
SAMPLE_RATE, sample = wavfile.read("./wavs/test.wav")
dtype = sample.dtype
sample = torch.tensor(np.swapaxes(sample, 0, 1), dtype=torch.float32)
pitch_shift = PitchShifter()
up = pitch_shift(sample, 12, SAMPLE_RATE)
wavfile.write(
"./wavs/test_+1.wav",
SAMPLE_RATE,
np.swapaxes(up.numpy(), 0, 1).astype(dtype),
)
down = pitch_shift(sample, -12, SAMPLE_RATE)
wavfile.write(
"./wavs/test_-1.wav",
SAMPLE_RATE,
np.swapaxes(down.numpy(), 0, 1).astype(dtype),
)
Documentation
Documentation is built into the class and function docstrings. If anyone wants to properly document the package, please feel free to contribute!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file torch_pitch_shift-1.0.8.tar.gz
.
File metadata
- Download URL: torch_pitch_shift-1.0.8.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fef3a9a104be76be3d9972921df4180700e3c48424e82086ccbc056b4671d240 |
|
MD5 | 69baa06aa5132a93ffb48899a15b4681 |
|
BLAKE2b-256 | 04aa209448d35a75a8bb28b06409c7efc9a6e3f00f1f6237eb4a1774994f9487 |
File details
Details for the file torch_pitch_shift-1.0.8-py3-none-any.whl
.
File metadata
- Download URL: torch_pitch_shift-1.0.8-py3-none-any.whl
- Upload date:
- Size: 2.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a22215fd7fcf90f05da4e8247a43603733144fed23532aded115bfae21008978 |
|
MD5 | a8458cc48332264ca1a1d5cf1d1e7f60 |
|
BLAKE2b-256 | 8af1e5c5f0125479e9ab601071055a27b32ac7312e6a4645eade0a478c6fb33a |