Bit crusher

Using Nyquist scripts in Audacity.
Post and download new plug-ins.
Forum rules
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
Post Reply
cdgamlin
Posts: 2
Joined: Thu May 28, 2015 6:04 am
Operating System: Please select

Bit crusher

Post by cdgamlin » Thu May 28, 2015 7:30 am

I've been playing with the "Nyquist Prompt", but it seems generating a bit-crusher effect is more difficult than I thought. (I'm using Audacity 2.0.5 in LinuxMint)

I've been looking at two approaches, but both give me dead ends. Note that I want the effect to be "tunable" i.e: you can choose how many bits you want, not just 8-bit (which I know can be generated via exporting).

Approach #1 - Bitwise AND to obtain the required most significant bits using the logand function
CODE: (logand s "number")
=> "number" has required number of most significant bits set, eg: #xFF000000 for 8-bit
=>returns "Nyquist did not return audio"

Approach #2 - Divide by a power of two, then multiply by a power of two
CODE: (mult (mult s (power 2 -24)) (power 2 24))
=> should bit crush down to 8-bit (32-24=8)
=> unfortunately just returns the same audio that was input. Attempts to round down before remultiplying (using truncate) have not worked so far either.

Bit-crushing is just some simple math, yet I'm stuck on how to make it work in Nyquist (and surprised a Nyquist plugin doesnt exist - at least as far as my searches have gone)

Help please? (Cheers!)

PS: Very new at this, so am probably making a really simple error. Please forgive.

Robert J. H.
Posts: 3633
Joined: Thu May 31, 2012 8:33 am
Operating System: Windows 10

Re: Bit crusher

Post by Robert J. H. » Thu May 28, 2015 10:05 am

Why not simply quantize?

Code: Select all

(quantize s 256)
gives 8-bit.

Logand, truncate and so on won't work with sounds--the former only with integer in fact.

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

Re: Bit crusher

Post by steve » Thu May 28, 2015 10:09 am

Description of Quantize in the manual: http://www.cs.cmu.edu/~rbd/doc/nyquist/ ... l#index541
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Post Reply