Variable and Constant Sample Rate
The oscillator and ROM/RAM waveshaper just discussed is an example of variable sample rate digital synthesis. Earlier, it was strongly suggested that the sample rate should remain constant in a digital synthesis system. This in fact is true if the system is handling several unrelated signals at once.
However, a dedicated oscillator is handling only one signal so the rule can be relaxed somewhat with important advantages.
Using the Fig. 17-10 system as an example, we ignore for a moment the fact that the count-up rate of the most significant 8 bits of the accumulator divider is not exactly constant. Therefore, if the raw DAC output is examined, it is found to consist of exactly 256 steps per cycle of the waveform and each cycle is identical to the previous one. As the division ratio and hence synthesized wave frequency is changed, the stepped wave is merely stretched or compressed, but its step-by-step shape remains constant. The spectrum of such a wave is exactly harmonic, including all of the alias copies of the intended spectrum. Thus, the alias distortion is purely harmonic distortion rather than intermodulation distortion and white noise.
Furthermore, and this is the crux of the matter, the quantization noise is also harmonic distortion! This means that perfectly clean sounding tones can be produced with 8 and even fewer bit DACs.
Since the reader is not really expected to believe the previous paragraph immediately, let's discuss the meaning of harmonic distortion. In audio equipment, the most prevalent measure of quality is harmonic distortion.
Literally, this means that any tone entering the equipment will leave with its harmonic amplitude relationships altered. Even large amounts (several percent) of such distortion are inaudible provided the distortion is pure, that is, no other type of distortion is present, and that the amplitude alteration is spread out evenly among the harmonics.
However, the mechanism that causes harmonic distortion in audio equipment does not meet either criteria when several tones are present simultaneously. First, intermodulation (IM) distortion is inevitable, which causes easily heard nonharmonic frequencies to occur. In fact, an amplifier with pure harmonic distortion would be quite an interesting device indeed. Second, the harmonic portion of the distortion tends to concentrate at high frequencies, where it is easily heard. Historically, harmonic distortion ratings were used because they were easy to measure and correlate well with IM readings, which are a much better measure of subjective distortion. Although direct IM measurements are now easily performed, tradition requires that harmonic distortion still be quoted on spec sheets.
As an example, consider the synthesis of a tone having the exact harmonic makeup (chosen at random) listed in Table 17-1. For the sake of argument, let's assume that only 64 words of memory (64 samples per cycle) are available and that each word is a paltry 6 bits long, which means that a 6-bit DAC can be used. Also shown in Table 17-1 are the corresponding sample values to 16-bit (5-digit) accuracy and rounded to 6-bit accuracy. The final column shows the actual harmonic spectrum that would emerge from this low-budget tone generator.
The first surprise is that the difference between desired and actual harmonic amplitudes expressed in decibels is not very great, at least for the significant high-amplitude ones. Lower-amplitude harmonics do suffer greater alteration but are more likely to be masked by the higher-amplitude harmonics. The real difference is that no harmonic can be entirely absent because of the quantization "noise." In actual use with a fairly "bright" harmonic spectrum, the approximation errors would be audible but would be characterized as a slight timbre alteration rather than distortion; much like the audible difference between two presumably excellent speaker systems of different manufacture. The use of 8 bits and 256 steps for the waveform of a digital oscillator is therefore well justified.
Although the alias frequencies are also harmonic, they should be filtered if a high-pitched "chime" effect is to be avoided. Unfortunately, the filter cutoff must track the tone frequency as it changes. This used to be an expensive proposition but ~ 2040 VCF driven by an 8-bit DAC connected to the frequency control word can now solve the problem for under $15. In many cases, it may be possible to omit the filter. For example, when using a 256-entry waveform table, only fundamental frequencies below 150 Hz require filtering, since otherwise the alias frequencies are entirely beyond 20 kHz. In fact, mellow tones containing few harmonics can be generated filter-free down to 80 Hz.
A dedicated digital tone generator can, of course, be based on the constant sample rate approach too. The structure is basically the same as Figs. 17-9 and 17-10 except for the following:
1. The master clock (sample rate) is much slower, such as 50 ks/s.
2. The most significant bits of the accumulator divider will be actual register bits, since the slow clock eliminates the "jitter-filter" counter (the jitter now becomes interpolation error).
3. The waveform memory will require more words (1,024) and more bits per word (10-12), since interpolation and quantization error will now be white noise instead of pure harmonic distortion.
The constant sample rate tone generator is, in fact, a precise hardware implementation of the software table-scanning technique described in Chapter 13. In exchange for additional hardware complexity, one has a structure that can use a fixed low-pass filter (probably no filter at all for 50-ks/s sample rate), operates at a much lower clock rate, and can be easily multiplexed. There is one serious problem that the variable sample rate approach did not have and that is "harmonic overflow" or alias distortion caused by generating frequencies beyond one-half the sample rate. This may be controlled only by cutting back on stored waveform complexity when
high-frequency tones are being generated.