Skip to main content

No project description provided

Project description

Torch Pitch Shift

Pitch-shift audio clips quickly with PyTorch (CUDA Supported)!

View on PyPI

Publish to PyPI

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

torch_pitch_shift-1.0.8.tar.gz (2.4 kB view hashes)

Uploaded Source

Built Distribution

torch_pitch_shift-1.0.8-py3-none-any.whl (2.7 kB view hashes)

Uploaded Python 3

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