Comments (4)
Interesting! Do you have a list of transforms that expand the max amplitude beyond +1 and -1? Edit: By quickly looking at the list of transforms, I can tell that AddGaussianNoise
and AddGaussianSNR can obviously return values outside that range. Maybe we should add those cases as unit tests so we can study the cases? Help is appreciated :)
Maybe we could add a "limiter" transform or "compressor" transform? This is what is usually done by mobile recorders and music producers (in DAWs) when they need to gracefully* reduce too loud peaks in their signal. *Bring down the volume without adding too much unwanted distortion.
Yes, audiomentations
does indeed expect the audio samples to be float32 and not int16. And yes, the range should be -1 to +1. Maybe you could compare your functions with open source audio processing/utility libraries? Or see what other people do in their code? A quick search returns these resources:
- https://github.com/magenta/magenta/blob/cd506bf753389ea44b7a31ba8062da33d1a09177/magenta/music/audio_io.py#L41
- https://stackoverflow.com/a/42544738/2319697
I note from that Stackoverflow conversation that samples in int16 should not have value -32768. Hence, it may be safer to multiply by 32767 instead of 32768, to avoid integer underflow
from audiomentations.
Sorry for the delay - haven't had any time to work on this since I posted the issue. Yes AddGuassianNoise definately does, and I think possibly also FrequencyMask (at least I seemed to end up with NaN or inf with that). I was using a set of them when I encountered this issue - so to figure out which is causing the issue would require some more extensive testing in isolation.
Maybe we could add a "limiter" transform or "compressor" transform? This is what is usually done by mobile recorders and music producers (in DAWs) when they need to gracefully* reduce too loud peaks in their signal. *Bring down the volume without adding too much unwanted distortion.
Maybe that's the a solution but I would be wary that it would need to be done before the relevant transform (e.g. AddGaussianNoise) in such a way as to guarantee the latter transform doesn't exceed the max - so maybe a way of coupling it in a pair with existing transforms - sounds a little complicated though...Another way might to train a min-max scaler on the input to a transform, then scale the output of the transform to match the initial input (? not sure if this would cause unintended side effects).
I've noticed there is a surprisingly small amount of literature on Audio augmentation for machine learning - on kaggle most people seem to do simple stretch and volume augmentation - so I think this library is pretty cool.
Oh thanks for the helpful links - I'm using the first link's suggestion at the moment.
from audiomentations.
Solved with #111, please close this issue.
from audiomentations.
from audiomentations.
Related Issues (20)
- Dereverberation transform
- Improve Shift transform
- Add support for target_peak_dbfs and maybe a "true peak" boolean in Normalize
- Add support for zero phase peaking filter
- Add support for zero phase low/high shelf filter
- Speed augmentation HOT 4
- Add Chorus transform HOT 2
- Add Phaser transform HOT 1
- Add parameter for ensuring mp3 compression output length is the same as the input length HOT 3
- Enhance pitch shifting HOT 1
- test_simulate_apply_parity failure HOT 5
- Report specific python minor version HOT 2
- test_simulate_apply_parity - AssertionError: approx() is not supported in a boolean context HOT 7
- Obsolete link to DOI on the documentation page HOT 1
- Reference to non-released version in docs
- Add issue templates to the repository
- Question about documentation creation HOT 1
- Transform for adding noise with the same spectral profile as the given signal
- The blank frame will be added after applying the Limiter HOT 5
- Avoid picking silent part of noise file HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from audiomentations.