Bit Crusher

Share your Audacity/Nyquist plug-ins here, or test drive the latest plug-ins submitted by Audacity users.

After testing a plug-in from this forum, please post feedback for the plug-in author.
Post Reply
steve
Site Admin
Posts: 82533
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Bit Crusher

Post by steve » Sat Jul 03, 2021 10:25 pm

A bitcrusher effect (https://en.wikipedia.org/wiki/Bitcrusher)
Low numbers of bits are only really suitable for simple (monophonic) sounds and tend to just sound like a mess with complex sounds.
Higher settings work well for making more complex sounds sound "low-fi".
  1. Bits per sample: The number of bits per sample. Lower is more "crunchy" / "noisy".
  2. Sample Rate: The effective sample rate. Lower reduces the frequency range (bandwidth).
Tip: The effect may slightly boost the level, so leave a bit of headroom before use or amplify / normalize back below 0 dB after processing.
Update: The latest version includes an output level control, so no need to leave headroom before processing - better to use the full track height range and adjust the output level as necessary.


Original version:
BitCrusher.ny
(993 Bytes) Downloaded 224 times
Latest version: BitCrusher.ny
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Trebor
Posts: 10133
Joined: Sat Dec 27, 2008 5:22 pm
Operating System: Windows 8 or 8.1

Re: Bit Crusher

Post by Trebor » Sun Jul 04, 2021 2:12 am

"BitCrusher,ny" is working for me, (but I'm still on Audcaity 2.3.2).

steve
Site Admin
Posts: 82533
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Bit Crusher

Post by steve » Sun Jul 04, 2021 8:58 am

Trebor wrote:
Sun Jul 04, 2021 2:12 am
"BitCrusher,ny" is working for me, (but I'm still on Audcaity 2.3.2).
Thanks Trebor.
I used Nyquist's resampling rather than a sinc filter as sinc filters are extremely slow prior to the latest big Nyquist update.

As you are using a version of Nyquist that predates the last big update, could you check that you get the expected number of "steps" for the selected "bits per sample". For example, if set to 4 bits per sample, and the sample rate is set to maximum, you should see 16 distinct steps over full-scale.

Resampling occurs after bit reduction, so the "steps" are bandwidth limited. At lower sample rates you should see that the steps are smoothed.
Do you think it's worth adding an option to resample before reducing the bits per sample? (Doing so mostly sounds horrible :D)
If you want to try that, change the last line from:

Code: Select all

(qrate (abs-quantize *track* bits) rate)
to:

Code: Select all

(abs-quantize (qrate *track* rate) bits)
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Trebor
Posts: 10133
Joined: Sat Dec 27, 2008 5:22 pm
Operating System: Windows 8 or 8.1

Re: Bit Crusher

Post by Trebor » Sun Jul 04, 2021 11:18 am

steve wrote:
Sun Jul 04, 2021 8:58 am
As you are using a version of Nyquist that predates the last big update, could you check that you get the expected number of "steps" for the selected "bits per sample". For example, if set to 4 bits per sample, and the sample rate is set to maximum, you should see 16 distinct steps over full-scale.
Yes: 16 treads when set to 4 bits per sample ...
16 steps with 4bits.png
16 steps with 4bits.png (16.89 KiB) Viewed 2924 times
steve wrote:
Sun Jul 04, 2021 8:58 am
Resampling occurs after bit reduction, so the "steps" are bandwidth limited. At lower sample rates you should see that the steps are smoothed.
Do you think it's worth adding an option to resample before reducing the bits per sample? (Doing so mostly sounds horrible :D)
I think bitcrush users want the artefacts from quantization and/or decimation.
(perhaps with the option of a wet/dry slider to dilute the effect with the original audio).

steve
Site Admin
Posts: 82533
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Bit Crusher

Post by steve » Sun Jul 04, 2021 3:18 pm

Trebor wrote:
Sun Jul 04, 2021 11:18 am
I think bitcrush users want the artefacts from quantization and/or decimation.
(perhaps with the option of a wet/dry slider to dilute the effect with the original audio).
How about this:

BitCrusher.png
BitCrusher.png (28.31 KiB) Viewed 2908 times

Parameters:
  • Bits per sample: [1 to 16 - default 8] Number of bits per sample.
  • Sample Rate: [1 to 40 kHz - default 8 kHz] Effective sample rate.
  • Process order: [choice: Crush->Resample, Resample->Crush, Crush Only, Resample Only - default "Crush->Resample"]
    "Crush->Resample" means, reduce the bits per sample first (bitcrush) , then resample.
  • Mix: [0 to 100 % - default 100%] Dry / Wet mix. 100% = wet (effect only). 0% = dry (unprocessed sound only)
I've also fixed the scaling / offset so that the steps fit in the range +/- 1 and zero (silence) remains at zero. To do this, there has to be an odd number of steps, so the number of steps is now: (2^bits) - 1
1-bit has to be handled slightly differently because having only one level would be silence. Thus 1 bit is rendered as +1 for positive input samples, and 0 for sample <= 0.

8-bits: 255 levels
4-bit: 15 levels
3-bit: 7 levels
2-bit: 3 levels
1-bit: 2 levels (0 or 1)

The plug-in:
BitCrusher.ny
(1.74 KiB) Downloaded 92 times
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

steve
Site Admin
Posts: 82533
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Bit Crusher

Post by steve » Sun Jul 04, 2021 3:26 pm

steve wrote:
Sat Jul 03, 2021 10:25 pm
Tip: The effect may slightly boost the level, so leave a bit of headroom before use or amplify / normalize back below 0 dB after processing.
For low bits per sample it makes sense for the input audio to be normalized to 0 dB so as to get the full bit-range, but then the preview will clip. So I'm wondering if it would be best to add an output level control (default to say 0.9).

What do you think?
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Trebor
Posts: 10133
Joined: Sat Dec 27, 2008 5:22 pm
Operating System: Windows 8 or 8.1

Re: Bit Crusher

Post by Trebor » Sun Jul 04, 2021 9:40 pm

steve wrote:
Sun Jul 04, 2021 3:18 pm
BitCrusher.ny (1.74 KiB)
Working as advertised.
steve wrote:
Sun Jul 04, 2021 3:26 pm
For low bits per sample it makes sense for the input audio to be normalized to 0 dB so as to get the full bit-range,
but then the preview will clip. So I'm wondering if it would be best to add an output level control (default to say 0.9).
What do you think?
I would end up using a (hard) limiter on it anyway, so sounded as loud as the original ... But it seems logical to give users no-clipping as the default.

steve
Site Admin
Posts: 82533
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Bit Crusher

Post by steve » Sun Jul 04, 2021 10:01 pm

With an output level control:
BitCrusher-screenshot.png
BitCrusher-screenshot.png (32.14 KiB) Viewed 2885 times

And the plug-in:
BitCrusher.ny
(1.83 KiB) Downloaded 388 times
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Trebor
Posts: 10133
Joined: Sat Dec 27, 2008 5:22 pm
Operating System: Windows 8 or 8.1

Re: Bit Crusher

Post by Trebor » Mon Jul 05, 2021 9:01 am

steve wrote:
Sun Jul 04, 2021 3:26 pm
... So I'm wondering if it would be best to add an output level control ...
Having just tried 1-bit-depth for the first time, now I see what you mean: everything becomes really loud ...

before-after 1-bit depth.png
at 1-bit depth everything becomes ½ fs (without a level control)
before-after 1-bit depth.png (13.2 KiB) Viewed 2836 times

steve
Site Admin
Posts: 82533
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Bit Crusher

Post by steve » Mon Jul 05, 2021 9:09 am

Trebor wrote:
Mon Jul 05, 2021 9:01 am
Having just tried 1-bit-depth for the first time, now I see what you mean: everything becomes really loud ...
:D Yes. By definition, it's either full on, or full off.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Post Reply