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 to 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 |
bitRate
Control the bit rate with another UGen by patching to bitRate.
|
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 and a bit rate of 44100.
|
BitCrush(float localBitRes,
float localBitRate)
Construct a BitCrush with the specified bit resolution and bit rate.
|
Modifier and Type | Method and Description |
---|---|
protected void |
channelCountChanged()
This method is only called when setChannelCount results in the channel count
of this UGen actually changing.
|
void |
setBitRes(float localBitRes)
Set the bit resolution directly.
|
protected void |
uGenerate(float[] out)
Implement this method when you extend UGen.
|
addAudio, addControl, addControl, addInput, channelCount, getLastValues, patch, patch, patch, printInputs, removeInput, sampleRate, sampleRateChanged, setChannelCount, setSampleRate, tick, unpatch, unpatch
public UGen.UGenInput audio
public UGen.UGenInput bitRes
public UGen.UGenInput bitRate
public BitCrush()
public BitCrush(float localBitRes, float localBitRate)
localBitRes
- float: typically you'll want this in the range [1,16]localBitRate
- float: this must be in the range [1,outputSampleRate]protected void channelCountChanged()
UGen
channelCountChanged
in class UGen
public void setBitRes(float localBitRes)
localBitRes
- float: typically you'll want this in the range [1,16]protected void uGenerate(float[] out)
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
.