Sound Hardware

Before you can process a sound, you must first get it into your NeXT computer. A microphone is provided on the front of the display, as well as a microphone jack on the back of the display that accepts a high-impedance microphone signal. The SndKit recording methods, described later in this chapter, automatically record and store sounds introduced through the microphone or the microphone jack.

For sound playback, the computer contains a speaker built into the display as well as stereo headphone and stereo line-out jacks. The keyboard volume and mute keys affect the built-in speaker and the headphone jack; the line-out jacks are provided to allow you to connect your NeXT computer to your own stereo for greater playback fidelity.

NeXT computers provide equipment to convert analog signals to digital and digital signals to analog. The following sections describe the NeXT digital sound hardware.

Voice-Quality Input

The microphone and microphone jack are connected to an analog-to-digital converter (ADC), known as the CODEC (“COder-DECoder”). The CODEC converter uses an 8-bit mu-law encoded quantization and a sampling rate of 8012.8 Hz. This is generally considered to be fast and accurate enough for telephone-quality speech input. The samples from this converter can be stored on the disk or they can be forwarded to the DAC, described below, to reproduce the sound.

The CODEC's mu-law encoding allows a 12-bit dynamic range to be stored in eight bits. In other words, an 8-bit sound with mu-law encoding will yield the same amplitude resolution as an unencoded 12-bit sound. With this compression algorithm, the CODEC saves storage space. For example, one second of 8-bit mu-law audio takes 8012 bytes of storage. By comparison, one second of CD-quality sound occupies 88200 bytes, or about 11 times more storage space.

While 8-bit mu-law encoding provides only moderate fidelity, the CODEC is sufficient and useful in a number of sound application areas. For instance, all the elements necessary to implement voice mail―sending spoken mail messages through the network―are present. In such an application, compact data storage is more desirable than high fidelity.

The CODEC is available as a standard UNIX® device. It does have a special constraint in that once conversion starts, a new byte will come from the device every 124.8 microseconds. The program reading the CODEC must be prompt in absorbing this data or it will be lost. The operating system does some buffering of CODEC input data, but it's by no means unlimited. In most applications, the SndKit management of input data is sufficient.

High-Quality Sound Output

The high-quality stereo digital-to-analog converter (DAC) operates at 44100 samples per second (in each channel) with a 16-bit quantization, the same as in CD players.

A 1 kHz maximum-amplitude sinusoid played through the DAC will generate a 2-volt RMS signal at the audio output. The converter has full de-glitching and anti-aliasing filters built in, so no external hardware is necessary for basic operation.

Like the CODEC, the DAC is available as a standard UNIX device. It's somewhat different from most devices in that it requires a great deal of data (176400 bytes per second at the high sampling rate). Any interruption in sending this data causes an interruption in the sound that will result in a pop in the audio output. Utilities are provided that ensure continuous data flow when sending sound data directly from the disk to the DAC.