Skip to main content

A simple audio data augmentation package

Project description

augmentaudio

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 augmentaudio

Usage

Example usage:

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:

...
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)
...

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 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

augmentaudio-1.0.8.tar.gz (8.2 kB view details)

Uploaded Source

File details

Details for the file augmentaudio-1.0.8.tar.gz.

File metadata

  • Download URL: augmentaudio-1.0.8.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

File hashes

Hashes for augmentaudio-1.0.8.tar.gz
Algorithm Hash digest
SHA256 43c4a57fe08f6cc13e5812b0226be264d884d70abe41badae15d976e3fa40a17
MD5 88ab1566435d9301d7d0889ef07604e5
BLAKE2b-256 7a0b4df572dc542a9326775c5fc1d8f73c9bbdf3b03dbb20782b425a20f896b5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page