{"id":13533116,"url":"https://github.com/iver56/audiomentations","last_synced_at":"2025-05-13T16:06:45.275Z","repository":{"id":37431451,"uuid":"170352817","full_name":"iver56/audiomentations","owner":"iver56","description":"A Python library for audio data augmentation. Useful for making audio ML models work well in the real world, not just in the lab.","archived":false,"fork":false,"pushed_at":"2025-04-19T20:57:00.000Z","size":11169,"stargazers_count":2014,"open_issues_count":52,"forks_count":198,"subscribers_count":19,"default_branch":"main","last_synced_at":"2025-04-19T22:11:42.918Z","etag":null,"topics":["audio","audio-data-augmentation","audio-effects","augmentation","data-augmentation","deep-learning","dsp","machine-learning","music","python","sound","sound-processing"],"latest_commit_sha":null,"homepage":"https://iver56.github.io/audiomentations/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iver56.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"iver56"}},"created_at":"2019-02-12T16:36:24.000Z","updated_at":"2025-04-19T20:57:03.000Z","dependencies_parsed_at":"2022-07-21T04:34:31.424Z","dependency_job_id":"4f469a33-b6c8-4d9f-a830-b8e50e231bf7","html_url":"https://github.com/iver56/audiomentations","commit_stats":{"total_commits":1104,"total_committers":29,"mean_commits":38.06896551724138,"dds":0.2653985507246377,"last_synced_commit":"465c2f039bbb86f9821a2caa175046e283ef8451"},"previous_names":[],"tags_count":43,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iver56%2Faudiomentations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iver56%2Faudiomentations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iver56%2Faudiomentations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iver56%2Faudiomentations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iver56","download_url":"https://codeload.github.com/iver56/audiomentations/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250513413,"owners_count":21443201,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audio","audio-data-augmentation","audio-effects","augmentation","data-augmentation","deep-learning","dsp","machine-learning","music","python","sound","sound-processing"],"created_at":"2024-08-01T07:01:16.694Z","updated_at":"2025-05-13T16:06:45.253Z","avatar_url":"https://github.com/iver56.png","language":"Python","funding_links":["https://github.com/sponsors/iver56"],"categories":["Tools","Audio Processing \u0026 I/O","Data Processing","Python","📚 فهرست","Audio Related Packages","Utils libraries"],"sub_categories":["Coming soon...","Data Pre-processing \u0026 Loading","کار با فایل های صوتی","OGC Features"],"readme":"# Audiomentations\n\n[![Build status](https://img.shields.io/circleci/project/github/iver56/audiomentations/main.svg)](https://circleci.com/gh/iver56/audiomentations)\n[![Code coverage](https://img.shields.io/codecov/c/github/iver56/audiomentations/main.svg)](https://codecov.io/gh/iver56/audiomentations)\n[![Code Style: Black](https://img.shields.io/badge/code%20style-black-black.svg)](https://github.com/psf/black)\n[![Licence: MIT](https://img.shields.io/pypi/l/audiomentations)](https://github.com/iver56/audiomentations/blob/main/LICENSE)\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.15341145.svg)](https://doi.org/10.5281/zenodo.15341145)\n\nAudiomentations is a Python library for audio data augmentation, built to be fast and easy to use - its API is inspired by\n[albumentations](https://github.com/albu/albumentations). It's useful for making audio deep learning models work well in the real world, not just in the lab.\nAudiomentations runs on CPU, supports mono audio and multichannel audio and integrates well in training pipelines,\nsuch as those built with TensorFlow/Keras or PyTorch. It has helped users achieve\nworld-class results in Kaggle competitions and is trusted by companies building next-generation audio products with AI.\n\nNeed a Pytorch-specific alternative with GPU support? Check out [torch-audiomentations](https://github.com/asteroid-team/torch-audiomentations)!\n\n# Setup\n\n![Python version support](https://img.shields.io/pypi/pyversions/audiomentations)\n[![PyPI version](https://img.shields.io/pypi/v/audiomentations.svg?style=flat)](https://pypi.org/project/audiomentations/)\n[![Number of downloads from PyPI per month](https://img.shields.io/pypi/dm/audiomentations.svg?style=flat)](https://pypi.org/project/audiomentations/)\n![os: Linux, macOS, Windows](https://img.shields.io/badge/OS-Linux%20%28arm%20%26%20x86%29%20|%20macOS%20%28arm%29%20|%20Windows%20%28x86%29-blue)\n\n`pip install audiomentations`\n\n# Usage example\n\n```python\nfrom audiomentations import Compose, AddGaussianNoise, TimeStretch, PitchShift, Shift\nimport numpy as np\n\naugment = Compose([\n    AddGaussianNoise(min_amplitude=0.001, max_amplitude=0.015, p=0.5),\n    TimeStretch(min_rate=0.8, max_rate=1.25, p=0.5),\n    PitchShift(min_semitones=-4, max_semitones=4, p=0.5),\n    Shift(p=0.5),\n])\n\n# Generate 2 seconds of dummy audio for the sake of example\nsamples = np.random.uniform(low=-0.2, high=0.2, size=(32000,)).astype(np.float32)\n\n# Augment/transform/perturb the audio data\naugmented_samples = augment(samples=samples, sample_rate=16000)\n```\n\n# Documentation\n\nThe API documentation, along with guides, example code, illustrations and example sounds, is available at [https://iver56.github.io/audiomentations/](https://iver56.github.io/audiomentations/)\n\n# Transforms\n\n* [AddBackgroundNoise](https://iver56.github.io/audiomentations/waveform_transforms/add_background_noise/): Mixes in another sound to add background noise\n* [AddColorNoise](https://iver56.github.io/audiomentations/waveform_transforms/add_color_noise/): Adds noise with specific color\n* [AddGaussianNoise](https://iver56.github.io/audiomentations/waveform_transforms/add_gaussian_noise/): Adds gaussian noise to the audio samples\n* [AddGaussianSNR](https://iver56.github.io/audiomentations/waveform_transforms/add_gaussian_snr/): Injects gaussian noise using a randomly chosen signal-to-noise ratio\n* [AddShortNoises](https://iver56.github.io/audiomentations/waveform_transforms/add_short_noises/): Mixes in various short noise sounds\n* [AdjustDuration](https://iver56.github.io/audiomentations/waveform_transforms/adjust_duration/): Trims or pads the audio to fit a target duration\n* [AirAbsorption](https://iver56.github.io/audiomentations/waveform_transforms/air_absorption/): Applies frequency-dependent attenuation simulating air absorption\n* [Aliasing](https://iver56.github.io/audiomentations/waveform_transforms/aliasing/): Produces aliasing artifacts by downsampling without low-pass filtering and then upsampling\n* [ApplyImpulseResponse](https://iver56.github.io/audiomentations/waveform_transforms/apply_impulse_response/): Convolves the audio with a randomly chosen impulse response\n* [BandPassFilter](https://iver56.github.io/audiomentations/waveform_transforms/band_pass_filter/): Applies band-pass filtering within randomized parameters\n* [BandStopFilter](https://iver56.github.io/audiomentations/waveform_transforms/band_stop_filter/): Applies band-stop (notch) filtering within randomized parameters\n* [BitCrush](https://iver56.github.io/audiomentations/waveform_transforms/bit_crush/): Applies bit reduction without dithering\n* [Clip](https://iver56.github.io/audiomentations/waveform_transforms/clip/): Clips audio samples to specified minimum and maximum values\n* [ClippingDistortion](https://iver56.github.io/audiomentations/waveform_transforms/clipping_distortion/): Distorts the signal by clipping a random percentage of samples\n* [Gain](https://iver56.github.io/audiomentations/waveform_transforms/gain/): Multiplies the audio by a random gain factor\n* [GainTransition](https://iver56.github.io/audiomentations/waveform_transforms/gain_transition/): Gradually changes the gain over a random time span\n* [HighPassFilter](https://iver56.github.io/audiomentations/waveform_transforms/high_pass_filter/): Applies high-pass filtering within randomized parameters\n* [HighShelfFilter](https://iver56.github.io/audiomentations/waveform_transforms/high_shelf_filter/): Applies a high shelf filter with randomized parameters\n* [Lambda](https://iver56.github.io/audiomentations/waveform_transforms/lambda/): Applies a user-defined transform\n* [Limiter](https://iver56.github.io/audiomentations/waveform_transforms/limiter/): Applies dynamic range compression limiting the audio signal\n* [LoudnessNormalization](https://iver56.github.io/audiomentations/waveform_transforms/loudness_normalization/): Applies gain to match a target loudness\n* [LowPassFilter](https://iver56.github.io/audiomentations/waveform_transforms/low_pass_filter/): Applies low-pass filtering within randomized parameters\n* [LowShelfFilter](https://iver56.github.io/audiomentations/waveform_transforms/low_shelf_filter/): Applies a low shelf filter with randomized parameters\n* [Mp3Compression](https://iver56.github.io/audiomentations/waveform_transforms/mp3_compression/): Compresses the audio to lower the quality\n* [Normalize](https://iver56.github.io/audiomentations/waveform_transforms/normalize/): Applies gain so that the highest signal level becomes 0 dBFS\n* [Padding](https://iver56.github.io/audiomentations/waveform_transforms/padding/): Replaces a random part of the beginning or end with padding\n* [PeakingFilter](https://iver56.github.io/audiomentations/waveform_transforms/peaking_filter/): Applies a peaking filter with randomized parameters\n* [PitchShift](https://iver56.github.io/audiomentations/waveform_transforms/pitch_shift/): Shifts the pitch up or down without changing the tempo\n* [PolarityInversion](https://iver56.github.io/audiomentations/waveform_transforms/polarity_inversion/): Flips the audio samples upside down, reversing their polarity\n* [RepeatPart](https://iver56.github.io/audiomentations/waveform_transforms/repeat_part/): Repeats a subsection of the audio a number of times\n* [Resample](https://iver56.github.io/audiomentations/waveform_transforms/resample/): Resamples the signal to a randomly chosen sampling rate\n* [Reverse](https://iver56.github.io/audiomentations/waveform_transforms/reverse/): Reverses the audio along its time axis\n* [RoomSimulator](https://iver56.github.io/audiomentations/waveform_transforms/room_simulator/): Simulates the effect of a room on an audio source\n* [SevenBandParametricEQ](https://iver56.github.io/audiomentations/waveform_transforms/seven_band_parametric_eq/): Adjusts the volume of 7 frequency bands\n* [Shift](https://iver56.github.io/audiomentations/waveform_transforms/shift/): Shifts the samples forwards or backwards\n* [TanhDistortion](https://iver56.github.io/audiomentations/waveform_transforms/tanh_distortion/): Applies tanh distortion to distort the signal\n* [TimeMask](https://iver56.github.io/audiomentations/waveform_transforms/time_mask/): Makes a random part of the audio silent\n* [TimeStretch](https://iver56.github.io/audiomentations/waveform_transforms/time_stretch/): Changes the speed without changing the pitch\n* [Trim](https://iver56.github.io/audiomentations/waveform_transforms/trim/): Trims leading and trailing silence from the audio\n\n# Changelog\n\n## [0.41.0] - 2025-05-05\n\n### Added\n\n* Add support for NumPy 2.x\n* Add `weights` parameter to `OneOf`. This lets you guide the probability of each transform being chosen.\n\n### Changed\n\n* Improve type hints\n\n#### :warning: The `TimeMask` transform has been changed significantly:\n\n* **Breaking change**: Remove `fade` parameter. `fade_duration=0.0` now denotes disabled fading.\n* Enable fading by default\n* Apply a smooth fade curve instead of a linear one\n* Add `mask_location` parameter\n* Change the default value of `min_band_part` from 0.0 to 0.01\n* Change the default value of `max_band_part` from 0.5 to 0.2\n* ~50% faster\n\nThe following examples show how you can adapt your code when upgrading from \u003c=v0.40.0 to \u003e=v0.41.0:\n\n| \u003c= 0.40.0                                                    | \u003e= 0.41.0                                                             |\n|--------------------------------------------------------------|-----------------------------------------------------------------------|\n| `TimeMask(min_band_part=0.1, max_band_part=0.15, fade=True)` | `TimeMask(min_band_part=0.1, max_band_part=0.15, fade_duration=0.01)` |\n| `TimeMask()`                                                 | `TimeMask(min_band_part=0.0, max_band_part=0.5, fade_duration=0.0)`   |\n\n### Removed\n\n* `SpecCompose`, `SpecChannelShuffle` and `SpecFrequencyMask` have been removed. You can read more about this here: [#391](https://github.com/iver56/audiomentations/pull/391)\n\nFor the full changelog, including older versions, see [https://iver56.github.io/audiomentations/changelog/](https://iver56.github.io/audiomentations/changelog/)\n\n# Acknowledgements\n\nThanks to [Nomono](https://nomono.co/) for backing audiomentations.\n\nThanks to [all contributors](https://github.com/iver56/audiomentations/graphs/contributors) who help improving audiomentations.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiver56%2Faudiomentations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiver56%2Faudiomentations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiver56%2Faudiomentations/lists"}