# simpleaudiostretch
[![Tests badge](https://github.com/Mews/simpleaudiostretch/actions/workflows/run_tests.yml/badge.svg)](https://github.com/Mews/simpleaudiostretch/actions/workflows/run_tests.yml)
[![Coverage badge](https://raw.githubusercontent.com/Mews/simpleaudiostretch/python-coverage-comment-action-data/badge.svg)](https://htmlpreview.github.io/?https://github.com/Mews/simpleaudiostretch/blob/python-coverage-comment-action-data/htmlcov/index.html)
[![Documentation badge](https://readthedocs.org/projects/simpleaudiostretch/badge/?version=latest&style=flat-default)](https://simpleaudiostretch.readthedocs.io/en/latest/simplestretch.html)
[![PyPI Version](https://img.shields.io/pypi/v/simpleaudiostretch?label=pypi%20package)](https://pypi.python.org/pypi/simpleaudiostretch)
[![PyPI Downloads](https://img.shields.io/pypi/dm/simpleaudiostretch)](https://pypi.python.org/pypi/simpleaudiostretch)
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](https://simpleaudiostretch.readthedocs.io/en/latest/simplestretch.html).
# 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:
```python
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:
```python
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:
```python
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:
```sh
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:
```sh
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](https://github.com/Mews/simpleaudiostretch/issues/new) or contact me through [my discord!](https://discord.com/users/467268976523739157)
Raw data
{
"_id": null,
"home_page": null,
"name": "simpleaudiostretch",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "audio, mp3, sound, speed, stretch, wav",
"author": null,
"author_email": "Mews <tiraraspas@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/cc/97/14ed523d13e3c476f55f4fe13b7c805921f7d20c828f2221f66a2f3d68ea/simpleaudiostretch-0.2.4.tar.gz",
"platform": null,
"description": "\n# simpleaudiostretch\n[![Tests badge](https://github.com/Mews/simpleaudiostretch/actions/workflows/run_tests.yml/badge.svg)](https://github.com/Mews/simpleaudiostretch/actions/workflows/run_tests.yml)\n[![Coverage badge](https://raw.githubusercontent.com/Mews/simpleaudiostretch/python-coverage-comment-action-data/badge.svg)](https://htmlpreview.github.io/?https://github.com/Mews/simpleaudiostretch/blob/python-coverage-comment-action-data/htmlcov/index.html)\n[![Documentation badge](https://readthedocs.org/projects/simpleaudiostretch/badge/?version=latest&style=flat-default)](https://simpleaudiostretch.readthedocs.io/en/latest/simplestretch.html)\n[![PyPI Version](https://img.shields.io/pypi/v/simpleaudiostretch?label=pypi%20package)](https://pypi.python.org/pypi/simpleaudiostretch)\n[![PyPI Downloads](https://img.shields.io/pypi/dm/simpleaudiostretch)](https://pypi.python.org/pypi/simpleaudiostretch)\n\nA simple python package to stretch audio files and change their speed.\n\n## Installation\n\nYou can install the package by running the command `pip install simpleaudiostretch`\n\n## Features\n\n- Supports many different audio formats, including mp3, wav, and also raw audio data in the form of numpy ndarrays.\n- Its really fast, especially when working with raw audio data.\n## Documentation\n\nThe full documentation for this package can be found [here](https://simpleaudiostretch.readthedocs.io/en/latest/simplestretch.html).\n# Usage/Examples\n## Python\nThis is an example on how you might use this library\\\nIn this example we take a file called `song.mp3` and make it twice as long:\n```python\nimport simplestretch\n\n# A factor of 2 means the song becomes twice as long\nsimplestretch.stretch_audio(\"song.mp3\", 2, \"out.wav\")\n```\n\nYou might also have the raw audio data, in which case you could do the following:\n```python\nimport simplestretch, soundfile\n\n# In this example we use soundfile to get the audio data\n# But you can use any numpy ndarray representing audio\naudio_data, samplerate = soundfile.read(\"song.mp3\")\n\n# When working with raw audio data\n# You will also need to pass the audio's sample rate to the function\nsimplestretch.stretch_audio(audio_data, 2, output=\"out.wav\", samplerate=samplerate)\n```\n\nYou can also work with changes in speed rather than changes in length through the `speedup_audio` method:\n```python\nimport simplestretch\n\n# In this example we make the song twice as fast rather than twice as long\nsimplestretch.speedup_audio(\"song.mp3\", 2, \"out.wav\")\n```\n## CLI\n\nYou can also use the command line interface to stretch your audios, through the `simplestretch` command.\n\n### Required Arguments\n\n| Short | Long | Description | Type |\n|-------|------------|-----------------------------------|--------|\n| `-a` | `--audio` | Path to the audio file | String |\n| `-f` | `--factor` | Factor for the change in audio length/speed | Float |\n| `-o` | `--output` | Path for the output file | String |\n\n### Optional Arguments\n\n| Short | Long | Description | Type |\n|-------|-----------|------------------------------------|---------|\n| `-s` | `--speed` | Use this flag to target audio speed instead of length | Boolean |\n\n### Example Commands\n\nTo stretch an audio file to 1.5 times its original size and save it:\n\n```sh\nsimplestretch -a path/to/audio/file -f 1.5 -o path/to/output/file\n```\n\nTo speed up an audio file to 2 times speed and save it:\n\n```sh\nsimplestretch -a path/to/audio/file -f 2 -o path/to/output/file -s\n```\n# Support\nIf you have any issues using this package or would like to request features, you can [open an issue](https://github.com/Mews/simpleaudiostretch/issues/new) or contact me through [my discord!](https://discord.com/users/467268976523739157)\n\n",
"bugtrack_url": null,
"license": null,
"summary": "A small package to stretch audio",
"version": "0.2.4",
"project_urls": {
"Homepage": "https://github.com/Mews/simpleaudiostretch",
"Issues": "https://github.com/Mews/simpleaudiostretch/issues"
},
"split_keywords": [
"audio",
" mp3",
" sound",
" speed",
" stretch",
" wav"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fc5a68acfbedc0f7301990ea74c1c36311132b22492e92eab672dc612aa99164",
"md5": "d592cf2dd7984941df78f8a7561d557c",
"sha256": "3d253dcf59e0512eb2619a5ea2a5f51c559e8835e0fadb5b847259f312f72ba8"
},
"downloads": -1,
"filename": "simpleaudiostretch-0.2.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d592cf2dd7984941df78f8a7561d557c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 17134,
"upload_time": "2024-06-12T09:10:29",
"upload_time_iso_8601": "2024-06-12T09:10:29.948914Z",
"url": "https://files.pythonhosted.org/packages/fc/5a/68acfbedc0f7301990ea74c1c36311132b22492e92eab672dc612aa99164/simpleaudiostretch-0.2.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "cc9714ed523d13e3c476f55f4fe13b7c805921f7d20c828f2221f66a2f3d68ea",
"md5": "da51f45af3dc76f14e3b30c796f170ef",
"sha256": "5dd08a7c939ae68b90cbbbe22d0805d2b85ca21d35883a632c193b7c53b66d2e"
},
"downloads": -1,
"filename": "simpleaudiostretch-0.2.4.tar.gz",
"has_sig": false,
"md5_digest": "da51f45af3dc76f14e3b30c796f170ef",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 3911565,
"upload_time": "2024-06-12T09:10:32",
"upload_time_iso_8601": "2024-06-12T09:10:32.361416Z",
"url": "https://files.pythonhosted.org/packages/cc/97/14ed523d13e3c476f55f4fe13b7c805921f7d20c828f2221f66a2f3d68ea/simpleaudiostretch-0.2.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-12 09:10:32",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Mews",
"github_project": "simpleaudiostretch",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"requirements": [
{
"name": "numpy",
"specs": [
[
"==",
"1.26.4"
]
]
},
{
"name": "soundfile",
"specs": [
[
"==",
"0.12.1"
]
]
},
{
"name": "coverage",
"specs": [
[
"==",
"7.5.3"
]
]
}
],
"lcname": "simpleaudiostretch"
}