next up previous contents index
Next: The PAF generator Up: Examples Previous: Simple formant generator   Contents   Index

Two-cosine carrier signal

Patch F08.two.cosines.pd (figure 6.16) shows how to make a carrier signal that cross-fades between harmonics to make continuously variable center frequencies. The center frequency quotient (the center frequency divided by the fundamental) appears as the output of a line~ object. This is separated into its fractional part (using the wrap~ object) and its integer part (by subtracting the fractional part from the original). These are labelled as $q$ and $k$ to agree with the treatment in section 6.3.

Figure 6.16: Cross-fading between sinusoids to make movable center frequencies.
\begin{figure}\psfig{file=figs/fig06.16.ps}\end{figure}

The phase--a sawtooth wave at the fundamental frequency--is multiplied by both $k$ and $k+1$ (the latter by adding the original sawtooth into the former), and the cosines of both are taken; they are therefore at $k$ and $k+1$ times the fundamental frequency and have no discontinuities at phase wrapping points. The next several objects in the patch compute the weighted sum $p
{c_1} + q {c_2}$, where $c_1$, $c_2$ are the two sinusoids and $p=1-q$, by evaluating an equivalent expression, ${c_1} + q ({c_2} - {c_1})$. This gives us the desired movable-frequency carrier signal.

Patch F09.declickit.pd (not shown here) shows how, by adding a samphold~ object after the line~ object controlling center frequency, you can avoid discontinuities in the output signal even if the desired center frequency changes discontinuously. In the particular example shown, the frequency quotient (i.e., carrier divided by fundamental) alternates between 4 and 13.5. At ramp times below about 20 msec there are audible artifacts when using the line~ object alone which disappear when the samphold~ object is added. (A disadvantage of sample-and-holding the frequency quotient is that, for very low fundamental frequencies, the changes can be heard as discrete steps. So in situations where the fundamental frequency is low and the center frequency need not change very quickly, it may be better to omit the sample-and-hold step.)

The next two patch examples demonstrate using the crossfading-oscillators carrier as part of the classic two-modulator phase modulation technique. The same modulating oscillator is added separately to the phases of the two cosines. The resulting spectra can be made to travel up and down in frequency, but because of the complicated phase relationships between neighboring peaks in the phase modulation spectrum, no matter how you align two such spectra you can never avoid getting phase cancellations where they overlap.


next up previous contents index
Next: The PAF generator Up: Examples Previous: Simple formant generator   Contents   Index
Miller Puckette 2005-04-01