A simple audio data augmentation package
Project description
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:
import librosa
import augaudio
import soundfile
y, sr = librosa.load('audio.wav')
augmented = augaudio.augment(y, 1, 4, sr) # only supply sampling_rate for augmentations 1 and 4, if not supplied sampling_rate will default to 22050
soundfile.write('augmented.wav', augmented, sr)
Directly access one of the augmentations:
...
augmented = augaudio.GaussianNoise(y, 4)
...
Chain augmentations together:
...
augmented = augaudio.GaussianNoise(augaudio.TimeStretch(y, 2), 4)
...
Iterate over augmentations:
...
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)
...
Augmentations
Augmentation | index | Description | takes sample_rate | negative intensity |
---|---|---|---|---|
GaussianNoise | 0 | Applies gaussian noise to the audio data | false | allowed |
PitchShift | 1 | Shifts the pitch of the audio data | true | allowed |
TimeStretch | 2 | Stretches the time of the audio data | false | disallowed |
Crush | 3 | Crushes details by applying and reversing a pitch shift | true | allowed |
Copyright Notice
Copyright 2020 Bastian Schwickert
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
augaudio-1.0.0.tar.gz
(6.8 kB
view hashes)