2022-04-12 22:02:59 -03:00
|
|
|
<!DOCTYPE html>
|
2022-04-12 21:54:18 -03:00
|
|
|
|
|
|
|
<!--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>
|
2022-04-12 22:02:59 -03:00
|
|
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
|
|
|
|
|
2022-04-12 21:54:18 -03:00
|
|
|
<TITLE>Phase vocoder time bender</TITLE>
|
|
|
|
<META NAME="description" CONTENT="Phase vocoder time bender">
|
|
|
|
<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="previous" HREF="node181.html">
|
|
|
|
<LINK REL="up" HREF="node178.html">
|
|
|
|
<LINK REL="next" HREF="node183.html">
|
|
|
|
</HEAD>
|
|
|
|
|
|
|
|
<BODY >
|
|
|
|
<!--Navigation Panel-->
|
|
|
|
<A NAME="tex2html3285"
|
|
|
|
HREF="node183.html">
|
|
|
|
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
|
2022-04-12 22:02:59 -03:00
|
|
|
SRC="next.png"></A>
|
2022-04-12 21:54:18 -03:00
|
|
|
<A NAME="tex2html3279"
|
|
|
|
HREF="node178.html">
|
|
|
|
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
|
2022-04-12 22:02:59 -03:00
|
|
|
SRC="up.png"></A>
|
2022-04-12 21:54:18 -03:00
|
|
|
<A NAME="tex2html3275"
|
|
|
|
HREF="node181.html">
|
|
|
|
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
|
2022-04-12 22:02:59 -03:00
|
|
|
SRC="prev.png"></A>
|
2022-04-12 21:54:18 -03:00
|
|
|
<A NAME="tex2html3281"
|
|
|
|
HREF="node4.html">
|
|
|
|
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
|
2022-04-12 22:02:59 -03:00
|
|
|
SRC="contents.png"></A>
|
2022-04-12 21:54:18 -03:00
|
|
|
<A NAME="tex2html3283"
|
|
|
|
HREF="node201.html">
|
|
|
|
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
|
2022-04-12 22:02:59 -03:00
|
|
|
SRC="index.png"></A>
|
2022-04-12 21:54:18 -03:00
|
|
|
<BR>
|
|
|
|
<B> Next:</B> <A NAME="tex2html3286"
|
|
|
|
HREF="node183.html">Exercises</A>
|
|
|
|
<B> Up:</B> <A NAME="tex2html3280"
|
|
|
|
HREF="node178.html">Examples</A>
|
|
|
|
<B> Previous:</B> <A NAME="tex2html3276"
|
2022-04-12 23:17:03 -03:00
|
|
|
HREF="node181.html">Timbre stamp ("vocoder")</A>
|
2022-04-12 21:54:18 -03:00
|
|
|
<B> <A NAME="tex2html3282"
|
|
|
|
HREF="node4.html">Contents</A></B>
|
|
|
|
<B> <A NAME="tex2html3284"
|
|
|
|
HREF="node201.html">Index</A></B>
|
|
|
|
<BR>
|
|
|
|
<BR>
|
|
|
|
<!--End of Navigation Panel-->
|
|
|
|
|
|
|
|
<H2><A NAME="SECTION001374000000000000000">
|
|
|
|
Phase vocoder time bender</A>
|
|
|
|
</H2>
|
|
|
|
|
|
|
|
<P>
|
|
|
|
|
|
|
|
<DIV ALIGN="CENTER"><A NAME="fig09.18"></A><A NAME="12750"></A>
|
|
|
|
<TABLE>
|
|
|
|
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 9.18:</STRONG>
|
|
|
|
Phase vocoder for time stretching and contraction.</CAPTION>
|
|
|
|
<TR><TD><IMG
|
|
|
|
WIDTH="589" HEIGHT="851" BORDER="0"
|
|
|
|
SRC="img1240.png"
|
|
|
|
ALT="\begin{figure}\psfig{file=figs/fig09.18.ps}\end{figure}"></TD></TR>
|
|
|
|
</TABLE>
|
|
|
|
</DIV>
|
|
|
|
|
|
|
|
<P>
|
|
|
|
The phase vocoder usually refers to the general technique of passing from
|
|
|
|
(complex-valued) channel amplitudes to pairs consisting of (real-valued)
|
2022-04-12 23:17:03 -03:00
|
|
|
magnitudes and phase precession rates ("frequencies"), and back, as
|
2022-04-12 21:54:18 -03:00
|
|
|
described in Figure <A HREF="node175.html#fig09.11">9.11</A> (Section <A HREF="node175.html#sect9.phase">9.5</A>). In
|
|
|
|
Example I07.phase.vocoder.pd (Figure <A HREF="#fig09.18">9.18</A>), we use this technique with the
|
|
|
|
specific aim of time-stretching and/or time-contracting a recorded sound
|
|
|
|
under real-time control. That is, we control, at any moment in real time,
|
|
|
|
the location in the recorded sound we hear. Two new objects are used:
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<BR><!-- MATH
|
|
|
|
$\fbox{\texttt{lrshift\~}}$
|
|
|
|
-->
|
|
|
|
<IMG
|
|
|
|
WIDTH="81" HEIGHT="39" ALIGN="MIDDLE" BORDER="0"
|
|
|
|
SRC="img1241.png"
|
|
|
|
ALT="\fbox{\texttt{lrshift\~}}">:
|
|
|
|
<A NAME="12905"></A>shift a block left or right (according to its creation argument). If the
|
|
|
|
argument is positive, each block of the output is the input shifted that number
|
|
|
|
of spaces to the right, filling zeros in as needed on the left. A negative
|
|
|
|
argument shifts to the left, filling zeros in at the right.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<BR><!-- MATH
|
|
|
|
$\fbox{\texttt{q8\_rsqrt\~}}$
|
|
|
|
-->
|
|
|
|
<IMG
|
|
|
|
WIDTH="87" HEIGHT="39" ALIGN="MIDDLE" BORDER="0"
|
|
|
|
SRC="img1243.png"
|
|
|
|
ALT="\fbox{\texttt{q8\_rsqrt\~}}">:
|
|
|
|
<A NAME="12906"></A>quick and approximate reciprocal square root. Outputs the reciprocal of the
|
|
|
|
square root of its input, good to about a part in 256, using much less
|
|
|
|
computation than a full-precision square root and reciprocal would.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
The process starts with a sub-patch, <TT>pd read-windows</TT>, that outputs
|
2022-04-12 23:17:03 -03:00
|
|
|
two Hann-windowed blocks of the recorded sound, a "back" one and a
|
|
|
|
"front" one 1/4 window further forward in the recording. The window
|
2022-04-12 21:54:18 -03:00
|
|
|
shown uses the two outputs of the sub-patch to guide the amplitude
|
|
|
|
and phase change of each channel of its own output.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
The top two <TT>tabreceive~</TT> objects recall the previous block of complex
|
|
|
|
amplitudes sent to the <TT>rifft~</TT> object at bottom, corresponding to
|
|
|
|
<IMG
|
|
|
|
WIDTH="80" HEIGHT="32" ALIGN="MIDDLE" BORDER="0"
|
|
|
|
SRC="img1198.png"
|
|
|
|
ALT="$S[m-1,k]$"> in
|
|
|
|
the discussion of Section <A HREF="node175.html#sect9.phase">9.5</A>. The patch as a whole computes
|
|
|
|
<IMG
|
|
|
|
WIDTH="52" HEIGHT="32" ALIGN="MIDDLE" BORDER="0"
|
|
|
|
SRC="img64.png"
|
|
|
|
ALT="$S[m, k]$"> and then its Hann windowed inverse FT for output.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
After normalizing <IMG
|
|
|
|
WIDTH="80" HEIGHT="32" ALIGN="MIDDLE" BORDER="0"
|
|
|
|
SRC="img1198.png"
|
|
|
|
ALT="$S[m-1,k]$">, its complex conjugate (the normalized inverse)
|
|
|
|
is multiplied by the windowed Fourier
|
2022-04-12 23:17:03 -03:00
|
|
|
transform of the "back" window <IMG
|
2022-04-12 21:54:18 -03:00
|
|
|
WIDTH="32" HEIGHT="32" ALIGN="MIDDLE" BORDER="0"
|
|
|
|
SRC="img1199.png"
|
|
|
|
ALT="$T[k]$">, giving the product <IMG
|
|
|
|
WIDTH="33" HEIGHT="32" ALIGN="MIDDLE" BORDER="0"
|
|
|
|
SRC="img1206.png"
|
|
|
|
ALT="$R[k]$"> of
|
|
|
|
Page <A HREF="node176.html#sect9.phaserelationship"><IMG ALIGN="BOTTOM" BORDER="1" ALT="[*]"
|
2022-04-12 22:02:59 -03:00
|
|
|
SRC="crossref.png"></A>.
|
2022-04-12 23:17:03 -03:00
|
|
|
Next, depending on the value of the parameter "lock", the computed value of
|
2022-04-12 21:54:18 -03:00
|
|
|
<IMG
|
|
|
|
WIDTH="33" HEIGHT="32" ALIGN="MIDDLE" BORDER="0"
|
|
|
|
SRC="img1206.png"
|
|
|
|
ALT="$R[k]$"> is conditionally replaced with the phase-locking version <IMG
|
|
|
|
WIDTH="37" HEIGHT="32" ALIGN="MIDDLE" BORDER="0"
|
|
|
|
SRC="img1245.png"
|
|
|
|
ALT="$R'[k]$">. This
|
|
|
|
is done using <TT>lrshift~</TT> objects, whose outputs are added into <IMG
|
|
|
|
WIDTH="33" HEIGHT="32" ALIGN="MIDDLE" BORDER="0"
|
|
|
|
SRC="img1206.png"
|
|
|
|
ALT="$R[k]$"> if
|
2022-04-12 23:17:03 -03:00
|
|
|
"lock" is set to one, or otherwise not if it is zero.
|
2022-04-12 21:54:18 -03:00
|
|
|
The result is then normalized and multiplied by the Hann-windowed Fourier transform
|
2022-04-12 23:17:03 -03:00
|
|
|
of the "front" window (<IMG
|
2022-04-12 21:54:18 -03:00
|
|
|
WIDTH="37" HEIGHT="32" ALIGN="MIDDLE" BORDER="0"
|
|
|
|
SRC="img1196.png"
|
|
|
|
ALT="$T'[k]$">) to give <IMG
|
|
|
|
WIDTH="52" HEIGHT="32" ALIGN="MIDDLE" BORDER="0"
|
|
|
|
SRC="img64.png"
|
|
|
|
ALT="$S[m, k]$">.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
Three other applications of Fourier analysis/resynthesis, not pictured here,
|
|
|
|
are provided in the Pd examples. First, Example I08.pvoc.reverb.pd shows how to make a
|
|
|
|
phase vocoder whose output recirculates as in a reverberator, except that
|
|
|
|
individual channels are replaced by the input when it is more powerful than
|
|
|
|
what is already recirculating. The result is a more coherent-sounding reverberation
|
|
|
|
effect than can be made in the classical way using delay lines.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
Example I09.sheep.from.goats.pd demonstrates the (imperfect) technique of separating pitched
|
|
|
|
signals from noisy ones, channel by channel, based on the phase coherence we
|
|
|
|
should expect from a Hann-windowed sinusoid. If three adjacent channels are
|
|
|
|
approximately <IMG
|
|
|
|
WIDTH="13" HEIGHT="13" ALIGN="BOTTOM" BORDER="0"
|
|
|
|
SRC="img41.png"
|
|
|
|
ALT="$\pi $"> radians out of phase from each other, they are judged to
|
|
|
|
belong to a sinusoidal peak. Channels belonging to sinusoidal peaks are
|
|
|
|
replaced with zero to extract the noisy portion of the signal, or all others
|
|
|
|
are replaced with zero to give the sinusoidal portion.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
Example I10.phase.bash.pd returns to the wavetable looping sampler of Figure
|
|
|
|
<A HREF="node29.html#fig02.07">2.7</A>, and shows how to align the phases of the sample so that all
|
|
|
|
components of the signal have zero phase at points 0, <IMG
|
|
|
|
WIDTH="18" HEIGHT="14" ALIGN="BOTTOM" BORDER="0"
|
|
|
|
SRC="img3.png"
|
|
|
|
ALT="$N$">, <IMG
|
|
|
|
WIDTH="26" HEIGHT="14" ALIGN="BOTTOM" BORDER="0"
|
|
|
|
SRC="img1200.png"
|
|
|
|
ALT="$2N$">, and so on. In
|
|
|
|
this way, two copies of a looping sampler placed <IMG
|
|
|
|
WIDTH="18" HEIGHT="14" ALIGN="BOTTOM" BORDER="0"
|
|
|
|
SRC="img3.png"
|
|
|
|
ALT="$N$"> samples apart can be
|
|
|
|
coherently cross-faded. A synthetic, pitched version of the original soundfile
|
|
|
|
can be made using daisy-chained cross-fades.
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
|
|
<!--Navigation Panel-->
|
|
|
|
<A NAME="tex2html3285"
|
|
|
|
HREF="node183.html">
|
|
|
|
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
|
2022-04-12 22:02:59 -03:00
|
|
|
SRC="next.png"></A>
|
2022-04-12 21:54:18 -03:00
|
|
|
<A NAME="tex2html3279"
|
|
|
|
HREF="node178.html">
|
|
|
|
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
|
2022-04-12 22:02:59 -03:00
|
|
|
SRC="up.png"></A>
|
2022-04-12 21:54:18 -03:00
|
|
|
<A NAME="tex2html3275"
|
|
|
|
HREF="node181.html">
|
|
|
|
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
|
2022-04-12 22:02:59 -03:00
|
|
|
SRC="prev.png"></A>
|
2022-04-12 21:54:18 -03:00
|
|
|
<A NAME="tex2html3281"
|
|
|
|
HREF="node4.html">
|
|
|
|
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
|
2022-04-12 22:02:59 -03:00
|
|
|
SRC="contents.png"></A>
|
2022-04-12 21:54:18 -03:00
|
|
|
<A NAME="tex2html3283"
|
|
|
|
HREF="node201.html">
|
|
|
|
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
|
2022-04-12 22:02:59 -03:00
|
|
|
SRC="index.png"></A>
|
2022-04-12 21:54:18 -03:00
|
|
|
<BR>
|
|
|
|
<B> Next:</B> <A NAME="tex2html3286"
|
|
|
|
HREF="node183.html">Exercises</A>
|
|
|
|
<B> Up:</B> <A NAME="tex2html3280"
|
|
|
|
HREF="node178.html">Examples</A>
|
|
|
|
<B> Previous:</B> <A NAME="tex2html3276"
|
2022-04-12 23:17:03 -03:00
|
|
|
HREF="node181.html">Timbre stamp ("vocoder")</A>
|
2022-04-12 21:54:18 -03:00
|
|
|
<B> <A NAME="tex2html3282"
|
|
|
|
HREF="node4.html">Contents</A></B>
|
|
|
|
<B> <A NAME="tex2html3284"
|
|
|
|
HREF="node201.html">Index</A></B>
|
|
|
|
<!--End of Navigation Panel-->
|
|
|
|
<ADDRESS>
|
|
|
|
Miller Puckette
|
|
|
|
2006-12-30
|
|
|
|
</ADDRESS>
|
|
|
|
</BODY>
|
|
|
|
</HTML>
|