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

Overview

Torch Time Stretch

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

View on PyPI / View Documentation

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

About

This package includes two main features:

  • Time-stretch audio clips quickly using PyTorch (with CUDA support)
  • Calculate efficient time-stretch targets (useful for augmentation, where speed is more important than precise time-stretches)

Also check out torch-pitch-shift, a sister project for pitch-shifting.

Installation

pip install torch-time-stretch

Usage

Example

Check out example.py to see torch-time-stretch in action!

Documentation

See the documentation page for detailed documentation!

Contributing

Please feel free to submit issues or pull requests!

You might also like...
Additional code for Stable-baselines3 to load and upload models from the Hub.

Hugging Face x Stable-baselines3 A library to load and upload Stable-baselines3 models from the Hub. Installation With pip Examples [Todo: add colab t

BYOL for Audio: Self-Supervised Learning for General-Purpose Audio Representation
BYOL for Audio: Self-Supervised Learning for General-Purpose Audio Representation

BYOL for Audio: Self-Supervised Learning for General-Purpose Audio Representation This is a demo implementation of BYOL for Audio (BYOL-A), a self-sup

Composable transformations of Python+NumPy programs: differentiate, vectorize, JIT to GPU/TPU, and more
Composable transformations of Python+NumPy programs: differentiate, vectorize, JIT to GPU/TPU, and more

JAX: Autograd and XLA Quickstart | Transformations | Install guide | Neural net libraries | Change logs | Reference docs | Code search News: JAX tops

Composable transformations of Python+NumPy programs: differentiate, vectorize, JIT to GPU/TPU, and more
Composable transformations of Python+NumPy programs: differentiate, vectorize, JIT to GPU/TPU, and more

JAX: Autograd and XLA Quickstart | Transformations | Install guide | Neural net libraries | Change logs | Reference docs | Code search News: JAX tops

Extending JAX with custom C++ and CUDA code

Extending JAX with custom C++ and CUDA code This repository is meant as a tutorial demonstrating the infrastructure required to provide custom ops in

Several simple examples for popular neural network toolkits calling custom CUDA operators.
Several simple examples for popular neural network toolkits calling custom CUDA operators.

Neural Network CUDA Example Several simple examples for neural network toolkits (PyTorch, TensorFlow, etc.) calling custom CUDA operators. We provide

Picasso: A CUDA-based Library for Deep Learning over 3D Meshes

The Picasso Library is intended for complex real-world applications with large-scale surfaces, while it also performs impressively on the small-scale applications over synthetic shape manifolds. We have upgraded the point cloud modules of SPH3D-GCN from homogeneous to heterogeneous representations, and included the upgraded modules into this latest work as well. We are happy to announce that the work is accepted to IEEE CVPR2021.

Code for "Learning Structural Edits via Incremental Tree Transformations" (ICLR'21)

Learning Structural Edits via Incremental Tree Transformations Code for "Learning Structural Edits via Incremental Tree Transformations" (ICLR'21) 1.

This Repo is the official CUDA implementation of ICCV 2019 Oral paper for CARAFE: Content-Aware ReAssembly of FEatures

Introduction This Repo is the official CUDA implementation of ICCV 2019 Oral paper for CARAFE: Content-Aware ReAssembly of FEatures. @inproceedings{Wa

Comments
  • RuntimeError: The size of tensor a (40264) must match the size of tensor b (173) at non-singleton dimension 1

    RuntimeError: The size of tensor a (40264) must match the size of tensor b (173) at non-singleton dimension 1

    I use same code in https://github.com/KentoNishi/torch-time-stretch/blob/master/example.py but get below error

    (librosa) ➜  torch-time-stretch git:(master) ✗ python example.py 
    Traceback (most recent call last):
      File "/home/jackie/code/github/torch-time-stretch/example.py", line 48, in <module>
        test_time_stretch_2_up()
      File "/home/jackie/code/github/torch-time-stretch/example.py", line 20, in test_time_stretch_2_up
        up = time_stretch(sample, Fraction(1, 2), SAMPLE_RATE)
      File "/home/jackie/code/github/torch-time-stretch/torch_time_stretch/main.py", line 116, in time_stretch
        output = stretcher(output)
      File "/home/jackie/anaconda3/envs/librosa/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
        return forward_call(*input, **kwargs)
      File "/home/jackie/anaconda3/envs/librosa/lib/python3.9/site-packages/torchaudio/transforms/_transforms.py", line 1059, in forward
        return F.phase_vocoder(complex_specgrams, rate, self.phase_advance)
      File "/home/jackie/anaconda3/envs/librosa/lib/python3.9/site-packages/torchaudio/functional/functional.py", line 743, in phase_vocoder
        phase = angle_1 - angle_0 - phase_advance
    RuntimeError: The size of tensor a (40264) must match the size of tensor b (173) at non-singleton dimension 1
    
    opened by Jackiexiao 4
  • Example ratios are reversed.

    Example ratios are reversed.

    Love it, thanks for making this! Tiny thing: In the example test_time_stretch_2_up should use 1/2 as a ratio, not 2/1. test_time_stretch_2_down should use that 2/1 (it's stretching the clip length by 2x).

    opened by hdemmer 1
  • Does it with mono-channel wav files?

    Does it with mono-channel wav files?

    my audio clip is in mono 16khz audio, [ 0 0 0 ... 63 100 127], so it will throw

    ---> 15 down = time_stretch(sample, Fraction(2, 1), SAMPLE_RATE)
         16 wavfile.write(
         17     "./stretched_down_2.wav",
         18     SAMPLE_RATE,
         19     np.swapaxes(down.cpu()[0].numpy(), 0, 0).astype(dtype),
         20 )
    
    File /opt/conda/envs/classify-audio/lib/python3.9/site-packages/torch_time_stretch/main.py:108, in time_stretch(input, stretch, sample_rate, n_fft, hop_length)
        106 if not hop_length:
        107     hop_length = n_fft // 32
    --> 108 batch_size, channels, samples = input.shape
        109 # resampler = T.Resample(sample_rate, int(sample_rate / stretch)).to(input.device)
        110 output = input
    
    ValueError: not enough values to unpack (expected 3, got 2)
    
    opened by ti3x 0
Releases(v1.0.3)
Owner
Kento Nishi
17-year-old programmer at Lynbrook High School, with strong interests in AI/Machine Learning. Open source developer and researcher at the Four Eyes Lab.
Kento Nishi
A python script to lookup Passport Index Dataset

visa-cli A python script to lookup Passport Index Dataset Installation pip install visa-cli Usage usage: visa-cli [-h] [-d DESTINATION_COUNTRY] [-f]

rand-net 16 Oct 18, 2022
Low-dose Digital Mammography with Deep Learning

Impact of loss functions on the performance of a deep neural network designed to restore low-dose digital mammography ====== This repository contains

WANG-AXIS 6 Dec 13, 2022
Breaking Shortcut: Exploring Fully Convolutional Cycle-Consistency for Video Correspondence Learning

Breaking Shortcut: Exploring Fully Convolutional Cycle-Consistency for Video Correspondence Learning Yansong Tang *, Zhenyu Jiang *, Zhenda Xie *, Yue

Zhenyu Jiang 12 Nov 16, 2022
This is the latest version of the PULP SDK

PULP-SDK This is the latest version of the PULP SDK, which is under active development. The previous (now legacy) version, which is no longer supporte

78 Dec 07, 2022
The repository forked from NVlabs uses our data. (Differentiable rasterization applied to 3D model simplification tasks)

nvdiffmodeling [origin_code] Differentiable rasterization applied to 3D model simplification tasks, as described in the paper: Appearance-Driven Autom

Qiujie (Jay) Dong 2 Oct 31, 2022
Akshat Surolia 2 May 11, 2022
Bidimensional Leaderboards: Generate and Evaluate Language Hand in Hand

Bidimensional Leaderboards: Generate and Evaluate Language Hand in Hand Introduction We propose a generalization of leaderboards, bidimensional leader

4 Dec 03, 2022
A PyTorch toolkit for 2D Human Pose Estimation.

PyTorch-Pose PyTorch-Pose is a PyTorch implementation of the general pipeline for 2D single human pose estimation. The aim is to provide the interface

Wei Yang 1.1k Dec 30, 2022
Tensorforce: a TensorFlow library for applied reinforcement learning

Tensorforce: a TensorFlow library for applied reinforcement learning Introduction Tensorforce is an open-source deep reinforcement learning framework,

Tensorforce 3.2k Jan 02, 2023
Meta-meta-learning with evolution and plasticity

Evolve plastic networks to be able to automatically acquire novel cognitive (meta-learning) tasks

5 Jun 28, 2022
Detectron2-FC a fast construction platform of neural network algorithm based on detectron2

What is Detectron2-FC Detectron2-FC a fast construction platform of neural network algorithm based on detectron2. We have been working hard in two dir

董晋宗 9 Jun 06, 2022
Cross-platform-profile-pic-changer - Script to change profile pictures across multiple platforms

cross-platform-profile-pic-changer script to change profile pictures across mult

4 Jan 17, 2022
Deep learning model for EEG artifact removal

DeepSeparator Introduction Electroencephalogram (EEG) recordings are often contaminated with artifacts. Various methods have been developed to elimina

23 Dec 21, 2022
Video Contrastive Learning with Global Context

Video Contrastive Learning with Global Context (VCLR) This is the official PyTorch implementation of our VCLR paper. Install dependencies environments

143 Dec 26, 2022
the official code for ICRA 2021 Paper: "Multimodal Scale Consistency and Awareness for Monocular Self-Supervised Depth Estimation"

G2S This is the official code for ICRA 2021 Paper: Multimodal Scale Consistency and Awareness for Monocular Self-Supervised Depth Estimation by Hemang

NeurAI 4 Jul 27, 2022
Code for the paper "Attention Approximates Sparse Distributed Memory"

Attention Approximates Sparse Distributed Memory - Codebase This is all of the code used to run analyses in the paper "Attention Approximates Sparse D

Trenton Bricken 14 Dec 05, 2022
An Open-Source Tool for Automatic Disease Diagnosis..

OpenMedicalChatbox An Open-Source Package for Automatic Disease Diagnosis. Overview Due to the lack of open source for existing RL-base automated diag

8 Nov 08, 2022
[CVPR 2021] Counterfactual VQA: A Cause-Effect Look at Language Bias

Counterfactual VQA (CF-VQA) This repository is the Pytorch implementation of our paper "Counterfactual VQA: A Cause-Effect Look at Language Bias" in C

Yulei Niu 94 Dec 03, 2022
Source code of the paper PatchGraph: In-hand tactile tracking with learned surface normals.

PatchGraph This repository contains the source code of the paper PatchGraph: In-hand tactile tracking with learned surface normals. Installation Creat

Paloma Sodhi 11 Dec 15, 2022
Efficient neural networks for analog audio effect modeling

micro-TCN Efficient neural networks for audio effect modeling

Christian Steinmetz 94 Dec 29, 2022