ddf.minim.ugens
Class BitCrush

java.lang.Object
  extended by ddf.minim.ugens.UGen
      extended by ddf.minim.ugens.BitCrush

public class BitCrush
extends UGen

BitCrush is an effect that reduces the fidelity of the incoming signal. This results in a sound that is "crunchier" sounding, or "distorted".

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!

Author:
Anderson Mills

Nested Class Summary
 
Nested classes/interfaces inherited from class ddf.minim.ugens.UGen
UGen.InputType, UGen.UGenInput
 
Field Summary
 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 Summary
BitCrush()
          Construct a BitCrush with a bit resolution of 1.
BitCrush(float localBitRes)
          Construct a BitCrush with the specified bit resolution.
 
Method Summary
 void setBitRes(float localBitRes)
          Set the bit resolution directly.
protected  void uGenerate(float[] channels)
          Implement this method when you extend UGen.
 
Methods inherited from class ddf.minim.ugens.UGen
addInput, getLastValues, patch, patch, patch, printInputs, removeInput, sampleRate, sampleRateChanged, setSampleRate, tick, unpatch, unpatch
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

audio

public UGen.UGenInput audio
The audio input is where audio that gets bit-crushed should be patched. However, you don't need to patch directly to this input, patching to the UGen itself will accomplish the same thing.


bitRes

public UGen.UGenInput bitRes
Control the bit resolution with another UGen by patching to bitRes. Values that make sense for this start at 1 and go up to whatever the actual resolution of the incoming audio is (typically 16).

Constructor Detail

BitCrush

public BitCrush()
Construct a BitCrush with a bit resolution of 1.


BitCrush

public BitCrush(float localBitRes)
Construct a BitCrush with the specified bit resolution.

Parameters:
localBitRes - typically you'll want this in the range [1,16]
Method Detail

setBitRes

public void setBitRes(float localBitRes)
Set the bit resolution directly.

Parameters:
localBitRes - typically you'll want this in the range [1,16]

uGenerate

protected void uGenerate(float[] channels)
Description copied from class: UGen
Implement this method when you extend UGen. It will be called when your UGen needs to generate one sample frame of audio. It is expected that you will assign values to the array and not simply modify the existing values. In the case where you write a UGen that takes audio input and modifies it, the pattern to follow is to have the first UGenInput you create be your audio input and then in uGenerate you will use the 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.

Specified by:
uGenerate in class UGen
Parameters:
channels - an array representing one sample frame.