Center for New Music and Audio Technologies

next up previous
Next: Phase Up: Frequency Previous: Frequency

Implementation

A triangle wave can be generated by mirroring parts of a sawtooth waveform. As mentioned earlier, a sawtooth is easily generated using an accumulator, consisting of an adder and a register. The register is incremented by the input value in synchrony with the sample clock. As a result the input determines the rate at which the angle increases, and hence the overall oscillator frequency. Periodically the register will overflow, signifying the end of a complete cycle. In order to derive a triangle wave from the sawtooth we divide the sawtooth curve into four parts (see Figure 1.7.b) representing the four quadrants of a rotary system. It can be seen that the upper half of the sawtooth must be inverted. This is within quadrant II and III. The two MSBs of the accumulator can be used to determin the present position within the four quadrants, and therefore to control the inversion.

Figure 1.8: VHDL code for inverting a sawtooth into a triangular wave.
\begin{figure}
\begin{verbatim}10 process(sawtooth)
20 begin
30 case sawtoo...
...60 when others => null;
70 end case;
80 end process;\end{verbatim}\end{figure}

The VHDL code in Figure 1.8 illustrates the inversion of the sawtooth. The mapping into hardware represents a multiplexer between the original and the inverted signal depending on the present position within the quadrants. The resulting circuit is shown in Figure 1.9 as part of the complete design.
next up previous
Next: Phase Up: Frequency Previous: Frequency
Home
Norbert Lindlbauer
2000-01-19