public class BitCrush extends UGen
Audio is represented digitally (ultimately) as an integral value. If you have 16-bit audio, then you can represent a sample value with any number in the range -32,768 to +32,767. If you bit-crush this audio do be 8-bit, then you effectively reduce it representation to -128 to +127, even though you will still represent it with a 16-bit number. This reduction in the fidelity of the representation essentially squares off the waveform, which makes it sound "crunchy". Try bit crushing down to 1-bit and see what you get!
UGen.InputType, UGen.UGenInput
Modifier and Type | Field and Description |
---|---|
UGen.UGenInput |
audio
The audio input is where audio that gets bit-crushed should be patched.
|
UGen.UGenInput |
bitRes
Control the bit resolution with another UGen by patching to bitRes.
|
Constructor and Description |
---|
BitCrush()
Construct a BitCrush with a bit resolution of 1.
|
BitCrush(float localBitRes)
Construct a BitCrush with the specified bit resolution.
|
Modifier and Type | Method and Description |
---|---|
void |
setBitRes(float localBitRes)
Set the bit resolution directly.
|
protected void |
uGenerate(float[] channels)
Implement this method when you extend UGen.
|
addInput, getLastValues, patch, patch, patch, printInputs, removeInput, sampleRate, sampleRateChanged, setAudioChannelCount, setSampleRate, tick, unpatch, unpatch
public UGen.UGenInput audio
public UGen.UGenInput bitRes
public BitCrush()
public BitCrush(float localBitRes)
localBitRes
- typically you'll want this in the range [1,16]public void setBitRes(float localBitRes)
localBitRes
- typically you'll want this in the range [1,16]protected void uGenerate(float[] channels)
UGen
getLastValues
method of your audio UGenInput to
retrieve the audio you want to modify, which you will then modify however
you need to, assigning the result to the values in channels
.