Harmonic synthesizers must zero out partials above the Nyquist frequency to prevent aliasing
Any sinusoidal component at or above half the sample rate (Nyquist frequency) cannot be faithfully represented and will alias — fold back into audible frequencies as spurious tones. DDSP’s remove_above_nyquist() sets the amplitude envelope to zero for all oscillators whose frequency envelope exceeds sample_rate / 2. This is applied automatically inside Harmonic.get_controls() when normalize_below_nyquist=True. At 16kHz sample rate and A4 (440 Hz), only 18 harmonics (18 × 440 = 7920 Hz < 8000 Hz Nyquist) are non-zero. The remaining harmonic distribution is then renormalized to sum to 1.
Examples
At 16kHz sample rate:
- f0=440 Hz (A4): harmonics 1-18 valid, 19+ zeroed
- f0=880 Hz (A5): harmonics 1-9 valid, 10+ zeroed
filtered_dist = ddsp.core.remove_above_nyquist(
harmonic_frequencies, harmonic_distribution, sample_rate=16000)
Assessment
At 16kHz sample rate and f0=500 Hz, which harmonic numbers are zeroed out? Why must the harmonic distribution be renormalized after zeroing?