Signal Generator
Introduction
Signal generators can be used to test frequency responses of loudspeakers. They are also a useful way of testing a Finite Impulse Response (FIR) and Infinite Impulse Response (IIR) filters without the need of an external signal source.
Pulse Generator
A pulse generator generates a single waveform at regular intervals. This can be applied to a loudspeaker and the response measured. It is a method that can be used to evaluate the resonances of a loudspeaker cabinet.
Sine Wave Generation
In this implementation, sine waves are generated using a recursive equation implemented as an Infinite Impulse Response (IIR filter).
y(n) = Ay(N-1) + By(N-2) + Cx(n-1)
where: A = 2coswT
B = -1
C = sinwT
Here, wT will be ouput frequency / Nyquist frequency.
The frequencies generated are very accurate, but do have the tendency to fade away with time due to accumulation of error.
Sweep Generator
The sweep generator generates sine wave forms, which gently increase in the range from bass to treble. In this case a series of 185 different frequencies are generated in the range 60 Hz to 12 kHz.
Because the human ear is logarithmic in both frequency and volume, the frequencies increase on a logarithmic basis rather than linear.
C Code Implementation
An on-chip timer is used to generate an interrupt every 20 seconds. Each time the interrupt occurs, the output frequency is increased. When the highest frequency is reached, the sweep starts again at the lowest frequency.