https://github.com/ptrpaws/augaudio
A simple audio data augmentation package
https://github.com/ptrpaws/augaudio
audio data-augmentation librosa python python3 simple
Last synced: 5 months ago
JSON representation
A simple audio data augmentation package
- Host: GitHub
- URL: https://github.com/ptrpaws/augaudio
- Owner: ptrpaws
- License: apache-2.0
- Created: 2020-07-17T18:58:58.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-07-13T04:55:38.000Z (6 months ago)
- Last Synced: 2025-08-19T15:24:39.826Z (5 months ago)
- Topics: audio, data-augmentation, librosa, python, python3, simple
- Language: Python
- Homepage:
- Size: 17.6 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# augaudio
This package contains multiple simple audio data augmentations in order to increase/test the robustness of neural networks.
###### Original

###### Gaussian Noise

###### Pitch Shift

###### Time Stretch

###### Crush

## Installation
You can install this package via
`pip install augaudio`
## Usage
### Example usage:
```python
import librosa
import augaudio
import soundfile
y, sr = librosa.load('audio.wav')
augmented = augaudio.augment(y, 1, 4)
soundfile.write('augmented.wav', augmented, sr)
```
#### Directly access one of the augmentations:
```python
...
augmented = augaudio.GaussianNoise(y, 4)
...
```
#### Chain augmentations together:
```python
...
augmented = augaudio.GaussianNoise(augaudio.TimeStretch(y, 2), 4)
...
```
#### Iterate over augmentations:
```python
...
for augmentation in range(4):
for intensity in range(1,10):
augmented = augaudio.augment(y, augmentation, intensity)
soundfile.write(str(augmentation) + '-' + str(intensity) + '.wav', augmented, sr)
...
```
### Command Line Usage:
#### Single File:
`augaudio /path/to/audio.wav 0 5`
#### Complete Folder:
`augaudio /path/to/input 0 5 /path/to/output`
## Augmentations
| Augmentation | index | Description | negative intensity |
| --- | --- | --- | --- |
| Augmentations | -2 | Applies /multiple/ random augmentations | available |
| Random | -1 | Applies random augmentation | available |
| GaussianNoise | 0 | Applies gaussian noise to the audio data | n/a |
| PitchShift | 1 | Shifts the pitch of the audio data | available |
| TimeStretch | 2 | Stretches the time of the audio data | n/a |
| Crush | 3 | Crushes details by applying and reversing a pitch shift | available |
## Copyright Notice
```
Copyright 2020 Ellie
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```