Skip to main content

No project description provided

Project description

Torch Pitch Shift

Pitch-shift audio clips quickly with PyTorch (CUDA supported)! Additional utilities for searching efficient transformations are included.

View on PyPI / View Documentation

Publish to PyPI PyPI version Number of downloads from PyPI per month Python version support Code Style: Black

About

This package includes two main features:

  • Pitch-shift audio clips quickly using PyTorch (with CUDA support)
  • Calculate efficient pitch-shift targets (useful for augmentation, where speed is more important than precise pitch-shifts)

Installation

pip install torch_pitch_shift

Usage

Example

It's super simple:

# import libraries
import torch
from torch_pitch_shift import *

# specify the sample rate
SAMPLE_RATE = 16000
# create a random stereo audio clip (1s long)
audio = torch.rand(
    2,
    SAMPLE_RATE,
    device="cuda" if torch.cuda.is_available() else "cpu"
)
# create the pitch shifter
pitch_shift = PitchShifter()

# for fast shift targets between -1 and +1 octaves
for ratio in get_fast_shifts(SAMPLE_RATE):
    # shift the audio clip
    shifted = pitch_shift(audio, ratio, SAMPLE_RATE)
    print(f"Pitch shift ({ratio}):", shifted)

Check out example.py to see torch_pitch_shift a more detailed example!

Documentation

See the GitHub Wiki Page for detailed documentation!

Contributing

Please feel free to submit issues or pull requests!

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.14.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

torch_pitch_shift-1.0.14-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file torch_pitch_shift-1.0.14.tar.gz.

File metadata

  • Download URL: torch_pitch_shift-1.0.14.tar.gz
  • Upload date:
  • Size: 3.8 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

Hashes for torch_pitch_shift-1.0.14.tar.gz
Algorithm Hash digest
SHA256 cf3bfb2683e1378f3ad8f863747e25a68221332d2d1092689d19794c6e791bd3
MD5 feea025f5d4d14155da0609c1aa38a02
BLAKE2b-256 0e6799ab72e0d98ca3de8e51fbcdd03e46b6d90a908c7d614dfdb1afdb35e86b

See more details on using hashes here.

File details

Details for the file torch_pitch_shift-1.0.14-py3-none-any.whl.

File metadata

  • Download URL: torch_pitch_shift-1.0.14-py3-none-any.whl
  • Upload date:
  • Size: 4.1 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

Hashes for torch_pitch_shift-1.0.14-py3-none-any.whl
Algorithm Hash digest
SHA256 e4fced1289922d0595620da028bcfc2c0dc2b9af8fb8b4272ee358d3c238dcc4
MD5 a4ed3f99a4191b7a7c1ae6ab4e3d545e
BLAKE2b-256 3319fcdeb220a85196e8fcd0e3301d4e5ce485b6805deb071ac5f83de3d13781

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