miller-book/node96.html

465 lines
15 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<!--Converted with LaTeX2HTML 2002-2-1 (1.71)
original version by: Nikos Drakos, CBLU, University of Leeds
* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<TITLE>Phase-aligned formant (PAF) generator</TITLE>
<META NAME="description" CONTENT="Phase-aligned formant (PAF) generator">
<META NAME="keywords" CONTENT="book">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META NAME="Generator" CONTENT="LaTeX2HTML v2002-2-1">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<LINK REL="STYLESHEET" HREF="book.css">
<LINK REL="next" HREF="node97.html">
<LINK REL="previous" HREF="node95.html">
<LINK REL="up" HREF="node89.html">
<LINK REL="next" HREF="node97.html">
</HEAD>
<BODY >
<!--Navigation Panel-->
2022-04-12 23:32:40 -03:00
<A ID="tex2html1981"
HREF="node97.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
SRC="next.png"></A>
2022-04-12 23:32:40 -03:00
<A ID="tex2html1975"
HREF="node89.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
SRC="up.png"></A>
2022-04-12 23:32:40 -03:00
<A ID="tex2html1969"
HREF="node95.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
SRC="prev.png"></A>
2022-04-12 23:32:40 -03:00
<A ID="tex2html1977"
HREF="node4.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
SRC="contents.png"></A>
2022-04-12 23:32:40 -03:00
<A ID="tex2html1979"
HREF="node201.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
SRC="index.png"></A>
<BR>
2022-04-12 23:32:40 -03:00
<B> Next:</B> <A ID="tex2html1982"
HREF="node97.html">Examples</A>
2022-04-12 23:32:40 -03:00
<B> Up:</B> <A ID="tex2html1976"
HREF="node89.html">Designer spectra</A>
2022-04-12 23:32:40 -03:00
<B> Previous:</B> <A ID="tex2html1970"
HREF="node95.html">Movable ring modulation</A>
2022-04-12 23:32:40 -03:00
&nbsp; <B> <A ID="tex2html1978"
HREF="node4.html">Contents</A></B>
2022-04-12 23:32:40 -03:00
&nbsp; <B> <A ID="tex2html1980"
HREF="node201.html">Index</A></B>
<BR>
<BR>
<!--End of Navigation Panel-->
2022-04-12 23:32:40 -03:00
<H1><A ID="SECTION001040000000000000000"></A>
<A ID="sect6.paf"></A>
<BR>
Phase-aligned formant (PAF) generator
</H1>
<P>
Combining the two-cosine carrier signal with the waveshaping pulse generator
gives the
2022-04-12 23:32:40 -03:00
<A ID="6911"></A><I>phase-aligned formant</I>
generator, usually called by its acronym, PAF. (The PAF is the subject of a
1994 patent owned by IRCAM.) The combined formula is,
<BR><P></P>
<DIV ALIGN="CENTER">
<!-- MATH
\begin{displaymath}
x[n] = {
{\underbrace
{g \left ( a \sin (\omega n/2) \right )}_{\mathrm{modulator}}
}
\;
{\underbrace {\left [
{p \cos( k \omega n) + q \cos( (k+1) \omega n)}
\right ] } _\mathrm{carrier}}
}
\end{displaymath}
-->
<IMG
WIDTH="369" HEIGHT="51" BORDER="0"
SRC="img598.png"
ALT="\begin{displaymath}
x[n] = {
{\underbrace
{g \left ( a \sin (\omega n/2) \ri...
...) + q \cos( (k+1) \omega n)}
\right ] } _\mathrm{carrier}}
}
\end{displaymath}">
</DIV>
<BR CLEAR="ALL">
<P></P>
Here the function <IMG
WIDTH="11" HEIGHT="29" ALIGN="MIDDLE" BORDER="0"
SRC="img29.png"
ALT="$g$"> may be either the Gaussian or Cauchy waveshaping
function, <IMG
WIDTH="14" HEIGHT="13" ALIGN="BOTTOM" BORDER="0"
SRC="img27.png"
ALT="$\omega $"> is the fundamental frequency, <IMG
WIDTH="11" HEIGHT="13" ALIGN="BOTTOM" BORDER="0"
SRC="img4.png"
ALT="$a$"> is a modulation
index controlling bandwidth, and <IMG
WIDTH="12" HEIGHT="14" ALIGN="BOTTOM" BORDER="0"
SRC="img58.png"
ALT="$k$">, <IMG
WIDTH="11" HEIGHT="29" ALIGN="MIDDLE" BORDER="0"
SRC="img57.png"
ALT="$p$">, and <IMG
WIDTH="11" HEIGHT="29" ALIGN="MIDDLE" BORDER="0"
SRC="img592.png"
ALT="$q$"> control the formant
center frequency.
<P>
2022-04-12 23:32:40 -03:00
<DIV ALIGN="CENTER"><A ID="fig06.08"></A><A ID="6919"></A>
<TABLE>
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 6.8:</STRONG>
The PAF generator as a block diagram.</CAPTION>
<TR><TD><IMG
WIDTH="478" HEIGHT="689" BORDER="0"
SRC="img599.png"
ALT="\begin{figure}\psfig{file=figs/fig06.08.ps}\end{figure}"></TD></TR>
</TABLE>
</DIV>
<P>
Figure <A HREF="#fig06.08">6.8</A> shows
the PAF as a block diagram, separated into a phase
generation step, a carrier, and a modulator. The phase generation step
outputs a sawtooth signal at the fundamental frequency.
The modulator is done by standard waveshaping, with a slight twist added.
The formula for the modulator signals in the PAF call for an incoming
sinusoid at half the fundamental frequency, i.e., <!-- MATH
$\sin({\omega \over 2})$
-->
<IMG
WIDTH="47" HEIGHT="32" ALIGN="MIDDLE" BORDER="0"
SRC="img600.png"
ALT="$\sin({\omega \over 2})$">,
and this nominally would require us to use a phasor tuned to half the
fundamental frequency. However, since the waveshaping function is even,
we may substitute the absolute value of the sinusoid:
<BR><P></P>
<DIV ALIGN="CENTER">
<!-- MATH
\begin{displaymath}
\left | \sin({\omega \over 2}) \right |
\end{displaymath}
-->
<IMG
WIDTH="53" HEIGHT="35" BORDER="0"
SRC="img601.png"
ALT="\begin{displaymath}
\left \vert \sin({\omega \over 2}) \right \vert
\end{displaymath}">
</DIV>
<BR CLEAR="ALL">
<P></P>
which repeats at the frequency <IMG
WIDTH="14" HEIGHT="13" ALIGN="BOTTOM" BORDER="0"
SRC="img27.png"
ALT="$\omega $"> (the first half cycle is the same
as the second one.) We can compute this simply by using a half-cycle
sinusoid as a wavetable lookup function (with phase running from <IMG
WIDTH="41" HEIGHT="32" ALIGN="MIDDLE" BORDER="0"
SRC="img283.png"
ALT="$-\pi/2$">
to <IMG
WIDTH="29" HEIGHT="32" ALIGN="MIDDLE" BORDER="0"
SRC="img5.png"
ALT="$\pi /2$">), and it is this rectified sinusoid that we pass to the
waveshaping function.
<P>
Although the wavetable function is pictured over both negative and positive
values (reaching from -10 to 10), in fact we're only using the positive
side for lookup, ranging from 0 to <IMG
WIDTH="10" HEIGHT="14" ALIGN="BOTTOM" BORDER="0"
SRC="img21.png"
ALT="$b$">, the index of modulation.
If the index of modulation exceeds the input range of the table (here set
to stop at 10 as an example), the table lookup address should be
clipped. The table should extend far enough into the tail of the waveshaping
function so that the effect of clipping is inaudible.
<P>
The carrier signal is a weighted sum of two cosines, whose frequencies are
increased by multiplication (by <IMG
WIDTH="12" HEIGHT="14" ALIGN="BOTTOM" BORDER="0"
SRC="img58.png"
ALT="$k$"> and <IMG
WIDTH="39" HEIGHT="30" ALIGN="MIDDLE" BORDER="0"
SRC="img602.png"
ALT="$k+1$">, respectively) and wrapping. In
this way all the lookup
phases are controlled by the same sawtooth oscillator.
<P>
The quantities <IMG
WIDTH="12" HEIGHT="14" ALIGN="BOTTOM" BORDER="0"
SRC="img58.png"
ALT="$k$">, <IMG
WIDTH="11" HEIGHT="29" ALIGN="MIDDLE" BORDER="0"
SRC="img592.png"
ALT="$q$">, and the wavetable index <IMG
WIDTH="10" HEIGHT="14" ALIGN="BOTTOM" BORDER="0"
SRC="img21.png"
ALT="$b$">
are calculated as shown in Figure <A HREF="#fig06.09">6.9</A>. They are
functions of the specified fundamental frequency, the formant center frequency,
and the bandwidth, which are the original parameters of the algorithm. The
quantity <IMG
WIDTH="11" HEIGHT="29" ALIGN="MIDDLE" BORDER="0"
SRC="img57.png"
ALT="$p$">, not shown in the figure, is just <IMG
WIDTH="38" HEIGHT="29" ALIGN="MIDDLE" BORDER="0"
SRC="img603.png"
ALT="$1-q$">.
<P>
2022-04-12 23:32:40 -03:00
<DIV ALIGN="CENTER"><A ID="fig06.09"></A><A ID="7044"></A>
<TABLE>
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 6.9:</STRONG>
Calculation of the time-varying parameters <IMG
WIDTH="11" HEIGHT="13" ALIGN="BOTTOM" BORDER="0"
SRC="img4.png"
ALT="$a$"> (the waveshaping index),
<I>k</I>, and <I>q</I> for use in the block diagram of Figure <A HREF="#fig06.08">6.8</A>.</CAPTION>
<TR><TD><IMG
WIDTH="322" HEIGHT="326" BORDER="0"
SRC="img604.png"
ALT="\begin{figure}\psfig{file=figs/fig06.09.ps}\end{figure}"></TD></TR>
</TABLE>
</DIV>
<P>
As described in the previous section, the quantities <IMG
WIDTH="12" HEIGHT="14" ALIGN="BOTTOM" BORDER="0"
SRC="img58.png"
ALT="$k$">, <IMG
WIDTH="11" HEIGHT="29" ALIGN="MIDDLE" BORDER="0"
SRC="img57.png"
ALT="$p$">, and <IMG
WIDTH="11" HEIGHT="29" ALIGN="MIDDLE" BORDER="0"
SRC="img592.png"
ALT="$q$"> should
only change at phase wraparound points, that is to say, at periods of
<IMG
WIDTH="39" HEIGHT="32" ALIGN="MIDDLE" BORDER="0"
SRC="img138.png"
ALT="$2 \pi / \omega$">. Since the calculation of <IMG
WIDTH="12" HEIGHT="14" ALIGN="BOTTOM" BORDER="0"
SRC="img58.png"
ALT="$k$">, etc., depends on the value
of the parameter <IMG
WIDTH="14" HEIGHT="13" ALIGN="BOTTOM" BORDER="0"
SRC="img27.png"
ALT="$\omega $">, it follows that <IMG
WIDTH="14" HEIGHT="13" ALIGN="BOTTOM" BORDER="0"
SRC="img27.png"
ALT="$\omega $"> itself should only be
updated
when the phase is a multiple of <IMG
WIDTH="21" HEIGHT="13" ALIGN="BOTTOM" BORDER="0"
SRC="img16.png"
ALT="$2\pi $">; otherwise, a change in <IMG
WIDTH="14" HEIGHT="13" ALIGN="BOTTOM" BORDER="0"
SRC="img27.png"
ALT="$\omega $"> could
send the center frequency <IMG
WIDTH="62" HEIGHT="32" ALIGN="MIDDLE" BORDER="0"
SRC="img605.png"
ALT="$(k+q)\omega$"> to an incorrect value for a
(very audible)
fraction of a period. In effect, all the parameter calculations should be
synchronized to the phase of the original oscillator.
<P>
Having the oscillator's phase control the updating of its own frequency
is an example of
2022-04-12 23:32:40 -03:00
<A ID="6933"></A><I>feedback</I>,
which in general means using any process's output as one of its inputs.
When processing digital audio signals at a fixed sample rate (as we're doing),
it is never possible to have the process's <I>current</I> output as an input,
since at the time we would need it we haven't yet calculated it. The best
we can hope for is to use the previous sample of output--in effect, adding
one sample of delay. In block environments (such as Max, Pd, and Csound) the
situation becomes more complicated, but we will delay discussing that until
the next chapter (and simply wish away the problem in the examples at the
end of this one).
<P>
The amplitude of the central peak in the spectrum of the PAF generator is
roughly <IMG
WIDTH="66" HEIGHT="32" ALIGN="MIDDLE" BORDER="0"
SRC="img572.png"
ALT="$1/(1+b)$">; in other words, close to unity when the index <IMG
WIDTH="10" HEIGHT="14" ALIGN="BOTTOM" BORDER="0"
SRC="img21.png"
ALT="$b$"> is
smaller than one, and falling off inversely with larger values of <IMG
WIDTH="10" HEIGHT="14" ALIGN="BOTTOM" BORDER="0"
SRC="img21.png"
ALT="$b$">.
For values of <IMG
WIDTH="10" HEIGHT="14" ALIGN="BOTTOM" BORDER="0"
SRC="img21.png"
ALT="$b$"> less than about ten, the loudness of the output does
not vary greatly, since the introduction of other partials, even at lower
amplitudes, offsets the decrease of the center partial's amplitude. However,
if using the PAF to generate formants with specified peak amplitudes, the
output should be multiplied by <IMG
WIDTH="37" HEIGHT="30" ALIGN="MIDDLE" BORDER="0"
SRC="img606.png"
ALT="$1+b$"> (or even, if necessary, a better
approximation of the correction factor, whose exact value depends on the
waveshaping function).
This amplitude correction should be ramped, not
sampled-and-held.
<P>
Since the expansion of the waveshaping (modulator) signal consists of all
cosine terms (i.e., since they all have initial phase zero), as do the two
components of the carrier, it follows from the cosine product formula that the
components of the result are all cosines as well. This means that any number of
PAF generators, if they are made to share the same oscillator for phase
generation, will all be in phase and combining them gives the sum of the
individual spectra. So we can make a multiple-formant version as shown in
Figure <A HREF="#fig06.10">6.10</A>.
<P>
2022-04-12 23:32:40 -03:00
<DIV ALIGN="CENTER"><A ID="fig06.10"></A><A ID="6939"></A>
<TABLE>
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 6.10:</STRONG>
Block diagram for making a spectrum with two formants using the PAF
generator.</CAPTION>
<TR><TD><IMG
WIDTH="493" HEIGHT="466" BORDER="0"
SRC="img607.png"
ALT="\begin{figure}\psfig{file=figs/fig06.10.ps}\end{figure}"></TD></TR>
</TABLE>
</DIV>
<P>
Figure <A HREF="#fig06.11">6.12</A> shows a possible output of a pair of formants generated
this way; the first formant is centered halfway between partials 3 and 4, and
the second at partial 12, with lower amplitude and bandwidth. The Cauchy
waveshaping function was used, which makes linearly sloped spectra (viewed
in dB). The two superpose additively, so that the spectral envelope curves
smoothly from one formant to the other. The lower formant also adds to its
own reflection about the vertical axis, so that it appears slightly curved
upward there.
<P>
2022-04-12 23:32:40 -03:00
<DIV ALIGN="CENTER"><A ID="fig06.11"></A><A ID="6945"></A>
<TABLE>
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 6.11:</STRONG>
Spectrum from a two-formant PAF generator.</CAPTION>
<TR><TD><IMG
WIDTH="310" HEIGHT="230" BORDER="0"
SRC="img608.png"
ALT="\begin{figure}\psfig{file=figs/fig06.11.ps}\end{figure}"></TD></TR>
</TABLE>
</DIV>
<P>
The PAF generator can be altered if desired to make inharmonic spectra by
sliding the partials upward or downward in frequency. To do this, add a second
oscillator to the phase of both carrier cosines, but not to the phase of the
modulation portion of the diagram, nor to the controlling phase of the
sample-and-hold units. It turns out that the sample-and-hold strategy for
smooth parameter updates still works; and furthermore, multiple PAF generators
sharing the same phase generation portion will still be in phase with each
other.
<P>
This technique for superposing spectra does not work as predictably for phase
modulation as it does for the PAF generator; the partials of the phase
modulation output have complicated phase relationships and they seem difficult
to combine coherently. In general, phase modulation will give more complicated
patterns of spectral evolution, whereas the PAF is easier to predict and turn to
specific desired effects.
<P>
2022-04-12 23:32:40 -03:00
<DIV ALIGN="CENTER"><A ID="fig06.11"></A><A ID="6952"></A>
<TABLE>
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 6.12:</STRONG>
Spectrum from a two-formant PAF generator.</CAPTION>
<TR><TD><IMG
WIDTH="318" HEIGHT="235" BORDER="0"
SRC="img609.png"
ALT="\begin{figure}\vspace*{-15pt}
\centerline{\psfig{file=figs/fig06.11.ps,width=3.8in}}
\vspace*{-13pt}\vspace*{13pt}
\end{figure}"></TD></TR>
</TABLE>
</DIV>
<P>
<HR>
<!--Navigation Panel-->
2022-04-12 23:32:40 -03:00
<A ID="tex2html1981"
HREF="node97.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
SRC="next.png"></A>
2022-04-12 23:32:40 -03:00
<A ID="tex2html1975"
HREF="node89.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
SRC="up.png"></A>
2022-04-12 23:32:40 -03:00
<A ID="tex2html1969"
HREF="node95.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
SRC="prev.png"></A>
2022-04-12 23:32:40 -03:00
<A ID="tex2html1977"
HREF="node4.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
SRC="contents.png"></A>
2022-04-12 23:32:40 -03:00
<A ID="tex2html1979"
HREF="node201.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
SRC="index.png"></A>
<BR>
2022-04-12 23:32:40 -03:00
<B> Next:</B> <A ID="tex2html1982"
HREF="node97.html">Examples</A>
2022-04-12 23:32:40 -03:00
<B> Up:</B> <A ID="tex2html1976"
HREF="node89.html">Designer spectra</A>
2022-04-12 23:32:40 -03:00
<B> Previous:</B> <A ID="tex2html1970"
HREF="node95.html">Movable ring modulation</A>
2022-04-12 23:32:40 -03:00
&nbsp; <B> <A ID="tex2html1978"
HREF="node4.html">Contents</A></B>
2022-04-12 23:32:40 -03:00
&nbsp; <B> <A ID="tex2html1980"
HREF="node201.html">Index</A></B>
<!--End of Navigation Panel-->
<ADDRESS>
Miller Puckette
2006-12-30
</ADDRESS>
</BODY>
</HTML>