Skip to main content

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!

Metadata

Release files for simpleaudiostretch 0.2.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simpleaudiostretch 0.2.5
File Size Uploaded
simpleaudiostretch-0.2.5.tar.gz 1.1 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for simpleaudiostretch 0.2.5
File Interpreter ABI Platform
simpleaudiostretch-0.2.5-py3-none-any.whl Python 3 none any Details

Total release size: 1.1 MB

Release files / simpleaudiostretch-0.2.5.tar.gz

Download URL simpleaudiostretch-0.2.5.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
b8c2651d3b2685860fea3fc7583b7b2d7ca87b8f0fadcf137652343640722f19
BLAKE2b-256 checksum
How to use checksums
822fa9ec184e5675cd50c3e8e5a39cf4518d73c3f182e34de7d1e2bc390a6225
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.4

Release files / simpleaudiostretch-0.2.5-py3-none-any.whl

Download URL simpleaudiostretch-0.2.5-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
afa8b51d9dd3f960e43317549e9e51d8dd9701f795b4f4970f7e1671a97c3497
BLAKE2b-256 checksum
How to use checksums
0d12e9cd6d85ce4b1a0f65f609add56882a2fcd66b9d18e503883c208e2c959b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.4

Release history Release notifications | RSS feed

This release

0.2.5 This release

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page