Git Product home page Git Product logo

simpleaudiostretch's Introduction

simpleaudiostretch

Tests badge Coverage badge Documentation badge PyPI Version PyPI Downloads

A simple python package to stretch audio files and change their speed.

Installation

You can install the package by running the command pip install simpleaudiostretch

Features

  • Supports many different audio formats, including mp3, wav, and also raw audio data in the form of numpy ndarrays.
  • Its really fast, especially when working with raw audio data.

Documentation

The full documentation for this package can be found here.

Usage/Examples

Python

This is an example on how you might use this library
In this example we take a file called song.mp3 and make it twice as long:

import simplestretch

# A factor of 2 means the song becomes twice as long
simplestretch.stretch_audio("song.mp3", 2, "out.wav")

You might also have the raw audio data, in which case you could do the following:

import simplestretch, soundfile

# In this example we use soundfile to get the audio data
# But you can use any numpy ndarray representing audio
audio_data, samplerate = soundfile.read("song.mp3")

# When working with raw audio data
# You will also need to pass the audio's sample rate to the function
simplestretch.stretch_audio(audio_data, 2, output="out.wav", samplerate=samplerate)

You can also work with changes in speed rather than changes in length through the speedup_audio method:

import simplestretch

# In this example we make the song twice as fast rather than twice as long
simplestretch.speedup_audio("song.mp3", 2, "out.wav")

CLI

You can also use the command line interface to stretch your audios, through the simplestretch command.

Required Arguments

Short Long Description Type
-a --audio Path to the audio file String
-f --factor Factor for the change in audio length/speed Float
-o --output Path for the output file String

Optional Arguments

Short Long Description Type
-s --speed Use this flag to target audio speed instead of length Boolean

Example Commands

To stretch an audio file to 1.5 times its original size and save it:

simplestretch -a path/to/audio/file -f 1.5 -o path/to/output/file

To speed up an audio file to 2 times speed and save it:

simplestretch -a path/to/audio/file -f 2 -o path/to/output/file -s

Support

If you have any issues using this package or would like to request features, you can open an issue or contact me through my discord!

simpleaudiostretch's People

Contributors

mews avatar github-actions[bot] avatar

Stargazers

Guilherme Euzébio avatar Marc G avatar John Safrit avatar  avatar Erick Rumbold avatar Kai Weber avatar  avatar Sheldon Ketterer avatar  avatar Zoom.Quiet avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.