iver56 / audiomentations

A Python library for audio data augmentation. Inspired by albumentations. Useful for machine learning.
https://iver56.github.io/audiomentations/
MIT License
1.76k stars 183 forks source link

Add BitCrush #264

Closed mmxgn closed 4 months ago

atamazian commented 4 months ago

Is this effect is what you expect to have?

iver56 commented 4 months ago

Yup. That page mainly features two different transforms:

  1. Sample rate reduction without low-pass filtering. Also known as sample-and-hold or decimation, but I personally like to think of it as nearest neighbour. This is a terrible form of resampling audio quality wise, but it leads to an interesting kind of output that can be used in music (often electronic music), and it can be used for data augmentation if not overdone
  2. Bit depth reduction, which reduces the number of bits that can be used for representing each audio sample. This introduces quantization noise which can mess with dynamic range and harmonics, amongst other things.

I think these two are sufficiently different that they should be different augmentation classes in audiomentations.

Based on the issue title, I think this one mainly refers to 2. Bit depth reduction

Would you like to implement it? A PR would be welcome

iver56 commented 4 months ago

Here are some nice resources on this topic, from a course I took a long time ago:

Sample rate reduction: http://gdsp.hf.ntnu.no/lessons/1/3/ Bit depth reduction: http://gdsp.hf.ntnu.no/lessons/1/4/

atamazian commented 4 months ago

Thanks for the info. I'll implement this. Please assign this issue to me.

iver56 commented 4 months ago

TODO: