You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
miller-book/node7.html

342 lines
10 KiB

<!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>Sinusoids, amplitude and frequency</TITLE>
<META NAME="description" CONTENT="Sinusoids, amplitude and frequency">
<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="node26.html">
<LINK REL="previous" HREF="node6.html">
<LINK REL="up" HREF="book.html">
<LINK REL="next" HREF="node8.html">
</HEAD>
<BODY >
<!--Navigation Panel-->
<A ID="tex2html633"
HREF="node8.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
SRC="next.png"></A>
<A ID="tex2html627"
HREF="book.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
SRC="up.png"></A>
<A ID="tex2html621"
HREF="node6.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
SRC="prev.png"></A>
<A ID="tex2html629"
HREF="node4.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
SRC="contents.png"></A>
<A ID="tex2html631"
HREF="node201.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
SRC="index.png"></A>
<BR>
<B> Next:</B> <A ID="tex2html634"
HREF="node8.html">Measures of Amplitude</A>
<B> Up:</B> <A ID="tex2html628"
HREF="book.html">book</A>
<B> Previous:</B> <A ID="tex2html622"
HREF="node6.html">Preface</A>
&nbsp; <B> <A ID="tex2html630"
HREF="node4.html">Contents</A></B>
&nbsp; <B> <A ID="tex2html632"
HREF="node201.html">Index</A></B>
<BR>
<BR>
<!--End of Navigation Panel-->
<H1><A ID="SECTION00500000000000000000">
Sinusoids, amplitude and frequency</A>
</H1>
<P>
Electronic music is usually made using a computer, by synthesizing or processing
<A ID="1011"></A><A ID="1012"></A><A ID="1013"></A><EM>digital audio signals</EM>. These are sequences of numbers,
<P>
<BR><P></P>
<DIV ALIGN="CENTER">
<!-- MATH
\begin{displaymath}
..., x[n-1], x[n], x[n+1], ...
\end{displaymath}
-->
<IMG
WIDTH="189" HEIGHT="28" BORDER="0"
SRC="img74.png"
ALT="\begin{displaymath}
..., x[n-1], x[n], x[n+1], ...
\end{displaymath}">
</DIV>
<BR CLEAR="ALL">
<P></P>
where the index <IMG
WIDTH="13" HEIGHT="13" ALIGN="BOTTOM" BORDER="0"
SRC="img75.png"
ALT="$n$">, called the
<A ID="1015"></A><I>sample number</I>, may range over some or all the integers. A single
number in the sequence is called a <I>sample</I>.
An example of a digital audio signal is the <I>Sinusoid</I>:
<A ID="eq-realsinusoid"></A>
<BR><P></P>
<DIV ALIGN="CENTER">
<!-- MATH
\begin{displaymath}
x[n] = a \cos (\omega n + \phi )
\end{displaymath}
-->
<IMG
WIDTH="140" HEIGHT="28" BORDER="0"
SRC="img76.png"
ALT="\begin{displaymath}
x[n] = a \cos (\omega n + \phi )
\end{displaymath}">
</DIV>
<BR CLEAR="ALL">
<P></P>
where <IMG
WIDTH="11" HEIGHT="13" ALIGN="BOTTOM" BORDER="0"
SRC="img4.png"
ALT="$a$"> is the
<A ID="1020"></A><EM>amplitude</EM>, <IMG
WIDTH="14" HEIGHT="13" ALIGN="BOTTOM" BORDER="0"
SRC="img27.png"
ALT="$\omega $"> is the
<A ID="1022"></A><EM>angular frequency</EM>, and
<IMG
WIDTH="13" HEIGHT="30" ALIGN="MIDDLE" BORDER="0"
SRC="img77.png"
ALT="$\phi$"> is the initial
<EM>phase</EM>.
The phase is a function of the sample number <IMG
WIDTH="13" HEIGHT="13" ALIGN="BOTTOM" BORDER="0"
SRC="img75.png"
ALT="$n$">, equal to
<!-- MATH
$\omega n + \phi$
-->
<IMG
WIDTH="52" HEIGHT="30" ALIGN="MIDDLE" BORDER="0"
SRC="img78.png"
ALT="$\omega n + \phi$">. The initial phase is the phase at the zeroth sample (<IMG
WIDTH="42" HEIGHT="13" ALIGN="BOTTOM" BORDER="0"
SRC="img79.png"
ALT="$n=0$">).
<P>
Figure <A HREF="#fig01.01">1.1</A> (part a) shows a sinusoid graphically.
The
horizontal axis shows successive values of <IMG
WIDTH="13" HEIGHT="13" ALIGN="BOTTOM" BORDER="0"
SRC="img75.png"
ALT="$n$"> and the vertical axis shows the
corresponding values of <IMG
WIDTH="31" HEIGHT="32" ALIGN="MIDDLE" BORDER="0"
SRC="img80.png"
ALT="$x[n]$">. The graph is drawn in such a way as to
emphasize the sampled nature of the signal. Alternatively, we could draw it
more simply as a continuous curve (part b). The upper drawing is the most
faithful representation of the (digital audio) sinusoid, whereas the lower
one can be considered an idealization of it.
<P>
<DIV ALIGN="CENTER"><A ID="fig01.01"></A><A ID="1028"></A>
<TABLE>
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 1.1:</STRONG>
A digital audio signal, showing its discrete-time nature (part a), and
idealized as a continuous function (part b). This signal is
a (real-valued) sinusoid, fifty points long, with amplitude 1, angular frequency
0.24, and initial phase zero.</CAPTION>
<TR><TD><IMG
WIDTH="439" HEIGHT="336" BORDER="0"
SRC="img81.png"
ALT="\begin{figure}\psfig{file=figs/fig01.01.ps}\end{figure}"></TD></TR>
</TABLE>
</DIV>
<P>
Sinusoids play a key role in audio processing because, if you shift one of them
left or right by any number of samples, you get another one. This makes it
easy to calculate the effect of all sorts of operations on sinusoids. Our ears
use this same special property to help us parse incoming sounds, which is why
sinusoids, and combinations of sinusoids, can be used to achieve many musical
effects.
<P>
Digital audio signals do not have any intrinsic relationship with time, but
to listen to them we must choose a
<A ID="1031"></A><I>sample rate</I>, usually given the variable name <IMG
WIDTH="15" HEIGHT="14" ALIGN="BOTTOM" BORDER="0"
SRC="img36.png"
ALT="$R$">, which is the number
of samples that fit into a second. The time <IMG
WIDTH="9" HEIGHT="13" ALIGN="BOTTOM" BORDER="0"
SRC="img82.png"
ALT="$t$"> is related to the sample number
<IMG
WIDTH="13" HEIGHT="13" ALIGN="BOTTOM" BORDER="0"
SRC="img75.png"
ALT="$n$"> by
<IMG
WIDTH="52" HEIGHT="14" ALIGN="BOTTOM" BORDER="0"
SRC="img83.png"
ALT="$Rt = n$">, or <IMG
WIDTH="60" HEIGHT="32" ALIGN="MIDDLE" BORDER="0"
SRC="img84.png"
ALT="$t = n/R$">. A sinusoidal signal with angular frequency <IMG
WIDTH="14" HEIGHT="13" ALIGN="BOTTOM" BORDER="0"
SRC="img27.png"
ALT="$\omega $">
has a real-time frequency equal to
<BR><P></P>
<DIV ALIGN="CENTER">
<!-- MATH
\begin{displaymath}
f = {{\omega R} \over {2 \pi}}
\end{displaymath}
-->
<IMG
WIDTH="55" HEIGHT="39" BORDER="0"
SRC="img85.png"
ALT="\begin{displaymath}
f = {{\omega R} \over {2 \pi}}
\end{displaymath}">
</DIV>
<BR CLEAR="ALL">
<P></P>
in Hertz (i.e., cycles per second), because a cycle is <IMG
WIDTH="21" HEIGHT="13" ALIGN="BOTTOM" BORDER="0"
SRC="img16.png"
ALT="$2\pi $"> radians and a
second is <IMG
WIDTH="15" HEIGHT="14" ALIGN="BOTTOM" BORDER="0"
SRC="img36.png"
ALT="$R$"> samples.
<P>
A real-world audio signal's amplitude might be expressed as a time-varying
voltage or air pressure, but the samples of a digital audio signal are unitless
numbers. We'll casually assume here that there is ample numerical accuracy
so that we can ignore round-off errors, and that the numerical format is
unlimited in range, so that samples may take any value we wish. However, most
digital audio hardware works only over a fixed range of input and output
values, most often between -1 and 1. Modern digital audio processing software
usually uses a floating-point representation for signals. This allows us to
use whatever units are most convenient for any given task, as long as the final
audio output is within the hardware's range [<A
HREF="node202.html#r-mathews69">Mat69</A>, pp. 4-10].
<P>
<BR><HR>
<!--Table of Child-Links-->
<A ID="CHILD_LINKS"><STRONG>Subsections</STRONG></A>
<UL>
<LI><A ID="tex2html635"
HREF="node8.html">Measures of Amplitude</A>
<LI><A ID="tex2html636"
HREF="node9.html">Units of Amplitude</A>
<LI><A ID="tex2html637"
HREF="node10.html">Controlling Amplitude</A>
<LI><A ID="tex2html638"
HREF="node11.html">Frequency</A>
<LI><A ID="tex2html639"
HREF="node12.html">Synthesizing a sinusoid</A>
<LI><A ID="tex2html640"
HREF="node13.html">Superposing Signals</A>
<LI><A ID="tex2html641"
HREF="node14.html">Periodic Signals</A>
<LI><A ID="tex2html642"
HREF="node15.html">About the Software Examples</A>
<UL>
<LI><A ID="tex2html643"
HREF="node16.html">Quick Introduction to Pd</A>
<LI><A ID="tex2html644"
HREF="node17.html">How to find and run the examples</A>
</UL>
<BR>
<LI><A ID="tex2html645"
HREF="node18.html">Examples</A>
<UL>
<LI><A ID="tex2html646"
HREF="node19.html">Constant amplitude scaler</A>
<LI><A ID="tex2html647"
HREF="node20.html">Amplitude control in decibels</A>
<LI><A ID="tex2html648"
HREF="node21.html">Smoothed amplitude control with an envelope generator</A>
<LI><A ID="tex2html649"
HREF="node22.html">Major triad</A>
<LI><A ID="tex2html650"
HREF="node23.html">Conversion between frequency and pitch</A>
<LI><A ID="tex2html651"
HREF="node24.html">More additive synthesis</A>
</UL>
<BR>
<LI><A ID="tex2html652"
HREF="node25.html">Exercises</A>
</UL>
<!--End of Table of Child-Links-->
<HR>
<!--Navigation Panel-->
<A ID="tex2html633"
HREF="node8.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
SRC="next.png"></A>
<A ID="tex2html627"
HREF="book.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
SRC="up.png"></A>
<A ID="tex2html621"
HREF="node6.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
SRC="prev.png"></A>
<A ID="tex2html629"
HREF="node4.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
SRC="contents.png"></A>
<A ID="tex2html631"
HREF="node201.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
SRC="index.png"></A>
<BR>
<B> Next:</B> <A ID="tex2html634"
HREF="node8.html">Measures of Amplitude</A>
<B> Up:</B> <A ID="tex2html628"
HREF="book.html">book</A>
<B> Previous:</B> <A ID="tex2html622"
HREF="node6.html">Preface</A>
&nbsp; <B> <A ID="tex2html630"
HREF="node4.html">Contents</A></B>
&nbsp; <B> <A ID="tex2html632"
HREF="node201.html">Index</A></B>
<!--End of Navigation Panel-->
<ADDRESS>
Miller Puckette
2006-12-30
</ADDRESS>
</BODY>
</HTML>