SuperCollider CLASSES

MantissaMask

Reduce precision.
Inherits from: UGen : AbstractFunction : Object

Description

Masks off bits in the mantissa of the floating point sample value. This introduces a quantization noise, but is less severe than linearly quantizing the signal.

Class Methods

*ar (in: 0, bits: 3, mul: 1, add: 0)

*kr (in: 0, bits: 3, mul: 1, add: 0)

Arguments:

in

The input signal.

bits

The number of mantissa bits to preserve. A number from 0 to 23.

mul

Output will be multiplied by this value.

add

This value will be added to the output.

Inherited class methods

Instance Methods

Inherited instance methods

Examples

// preserve only 3 bits of mantissa.
{ MantissaMask.ar(SinOsc.ar(SinOsc.kr(0.2,0,400,500), 0, 0.4), 3) }.play

// the original
{ SinOsc.ar(SinOsc.kr(0.2,0,400,500), 0, 0.4) }.play

// the difference.
(
{
    var in;
    in = SinOsc.ar(SinOsc.kr(0.2,0,400,500), 0, 0.4);
    Out.ar(0, in - MantissaMask.ar(in, 3));
}.play
)


// preserve 7 bits of mantissa.
// This makes the lower 16 bits of the floating point number become zero.
{ MantissaMask.ar(SinOsc.ar(SinOsc.kr(0.2,0,400,500), 0, 0.4), 7) }.play

// the original
{ SinOsc.ar(SinOsc.kr(0.2,0,400,500), 0, 0.4) }.play

// the difference.
(
{
    var in;
    in = SinOsc.ar(SinOsc.kr(0.2,0,400,500), 0, 0.4);
    Out.ar(0, in - MantissaMask.ar(in, 7));
}.play
)