Number Systems for Digital Audio

Linear Number Systems

Binary Integer Fixed-Point Numbers

**Search Mathematics of the DFT**

**Would you like to be notified by email when Julius Orion Smith III publishes a new entry into his blog?**

Most computer languages nowadays only offer two kinds of numbers,
*floating-point* and *integer fixed-point*.
On present-day computers, all numbers are encoded using *binary
digits* (called ``bits'') which
are either 1 or 0.^{G.1} In C, C++, and Java, floating-point variables
are declared as `float` (32 bits) or `double` (64 bits), while
integer fixed-point variables are declared as `short int`
(typically 16 bits and never less), `long int` (typically 32 bits
and never less), or simply `int` (typically the same as a `long int`, but sometimes between short and long). For an 8-bit
integer, one can use the `char` data type (8 bits).

Since C was designed to accommodate a wide range of hardware,
including old mini-computers, some latitude was historically allowed
in the choice of these bit-lengths. The `sizeof` operator is
officially the ``right way'' for a C program to determine the number
of bytes in various data types at run-time, *e.g.*, `sizeof(long)`.
(The word `int` can be omitted after `short` or `long`.)
Nowadays, however, `short`s are always 16 bits (at least on all
the major platforms), `int`s are 32 bits, and `long`s are
typically 32 bits on 32-bit computers and 64 bits on 64-bit computers
(although some C/C++ compilers use `long long int` to declare
64-bit ints). Table G.1 gives the lengths currently used by GNU
C/C++ compilers (usually called ```gcc`'' or ```cc`'') on
64-bit processors.^{G.2}

Java, which is designed to be platform independent, defines a `long int` as *equivalent in precision to* 64 bits, an `int`
as 32 bits, a `short int` as 16 bits, and additionally a `byte
int` as an 8-bit int. Similarly, the ``Structured Audio Orchestra
Language''
(SAOL)
(pronounced ``sail'')--the sound-synthesis component of the new
MPEG-4 audio compression standard--requires only that the underlying number
system be at least as accurate as 32-bit `float`s. All `int`s
discussed thus far are *signed* integer formats. C and C++ also
support *unsigned* versions of all `int` types, and they range
from 0 to instead of to , where
is the number of bits. Finally, an `unsigned char` is often used for
integers that only range between 0 and 255.

- One's Complement Fixed-Point Format
- Two's Complement Fixed-Point Format
- Two's-Complement, Integer Fixed-Point Numbers

Julius Smith's background is in electrical engineering (BS Rice 1975, PhD Stanford 1983). He is presently Professor of Music and Associate Professor (by courtesy) of Electrical Engineering at Stanford's Center for Computer Research in Music and Acoustics (CCRMA), teaching courses and pursuing research related to signal processing applied to music and audio systems. See http://ccrma.stanford.edu/~jos/ for details.

Comments

No comments yet for this page