Skip to content

Commit

Permalink
v1.2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
twardoch committed May 6, 2023
1 parent 8559b10 commit 54e37b1
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

AudioStretchy is a Python library and CLI tool that which performs fast, high-quality time-stretching of WAV/MP3 files without changing their pitch. Works well for speech, can time-stretch silence separately. The library is a wrapper around David Bryant’s [audio-stretch](https://github.com/dbry/audio-stretch) C library.

Version: 1.2.3
_Version: **1.2.4**_

## Features

Expand Down Expand Up @@ -74,25 +74,33 @@ POSITIONAL ARGUMENTS
FLAGS
-r, --ratio=RATIO
The stretch ratio, where values greater than 1.0 will extend the audio and values less than 1.0 will shorten the audio. From 0.5 to 2.0, or with `-d` from 0.25 to 4.0. Default is 1.0 = no stretching.
The stretch ratio, where values greater than 1.0 will extend the audio and
values less than 1.0 will shorten the audio. From 0.5 to 2.0, or with `-d`
from 0.25 to 4.0. Default is 1.0 = no stretching.
-g, --gap_ratio=GAP_RATIO
The stretch ratio for gaps (silence) in the audio. Default is 0.0 = uses ratio.
The stretch ratio for gaps (silence) in the audio.
Default is 0.0 = uses ratio.
-u, --upper_freq=UPPER_FREQ
The upper frequency limit for period detection in Hz. Default is 333 Hz.
-l, --lower_freq=LOWER_FREQ
The lower frequency limit. Default is 55 Hz.
-b, --buffer_ms=BUFFER_MS
The buffer size in milliseconds for processing the audio in chunks (useful with `-g`). Default is 25 ms.
The buffer size in milliseconds for processing the audio in chunks
(useful with `-g`). Default is 25 ms.
-t, --threshold_gap_db=THRESHOLD_GAP_DB
The threshold level in dB to determine if a section of audio is considered a gap (for `-g`). Default is -40 dB.
The threshold level in dB to determine if a section of audio is considered
a gap (for `-g`). Default is -40 dB.
-d, --double_range=DOUBLE_RANGE
If set, doubles the min/max range of stretching.
-f, --fast_detection=FAST_DETECTION
If set, enables fast period detection, which may speed up processing but reduce the quality of the stretched audio.
If set, enables fast period detection, which may speed up processing but
reduce the quality of the stretched audio.
-n, --normal_detection=NORMAL_DETECTION
If set, forces the algorithm to use normal period detection instead of fast period detection.
If set, forces the algorithm to use normal period detection instead
of fast period detection.
-s, --sample_rate=SAMPLE_RATE
The target sample rate for resampling the stretched audio in Hz (if installed with `[all]`). Default is 0 = use sample rate of the input audio.
The target sample rate for resampling the stretched audio in Hz (if installed
with `[all]`). Default is 0 = use sample rate of the input audio.
```

### Python
Expand All @@ -111,7 +119,8 @@ For advanced usage, you can use the `AudioStretch` class that lets you open and
from audiostretchy.stretch import AudioStretch

audio_stretch = AudioStretch()
audio_stretch.open(file=MP3DataAsBytesIO, format="mp3") # Needs [all] installation for MP3 support
# This needs [all] installation for MP3 support
audio_stretch.open(file=MP3DataAsBytesIO, format="mp3")
audio_stretch.stretch(
ratio=1.1,
gap_ratio=1.2,
Expand All @@ -123,7 +132,8 @@ audio_stretch.stretch(
fast_detection=False,
normal_detection=False,
)
audio_stretch.resample(sample_rate=44100) # Needs [all] installation for soxr support
# This needs [all] installation for soxr support
audio_stretch.resample(sample_rate=44100)
audio_stretch.save(file=WAVDataAsBytesIO, format="wav")
```

Expand All @@ -132,5 +142,5 @@ audio_stretch.save(file=WAVDataAsBytesIO, format="wav")

- [Original C library code](https://github.com/dbry/audio-stretch): Copyright (c) 2022 David Bryant
- [Python code](https://github.com/twardoch/audiostretchy): Copyright (c) 2023 Adam Twardoch
- Written with assistance from GPT-4
- Python code written with assistance from GPT-4
- Licensed under the [BSD-3-Clause license](./LICENSE.txt)

0 comments on commit 54e37b1

Please sign in to comment.