\documentstyle[12pt]{article}
\input{psfig.tex}
\begin{document}
\begin{center}
\vspace {0.05in}
{\large{\bf Elementary Music Synthesis }}\\
\end{center}
\vspace{.1in}
\noindent This lab is by Professor Virginia Stonick of
Oregon State University.
The purpose of this lab is to construct physically meaningful signals
mathematically in MATLAB using your knowledge of signals.
You will gain some understanding of the physical meaning of the
signals you construct by using audio playback. Also, we hope
you have fun!
\section{Background}
In this section, we explore how to use simple tones to compose a
segment of music. By using tones of various frequencies, you will
construct the first few bars of Beethoven's famous piece ``Symphony No. 5
in C-Minor.'' In addition, you will get to construct a simple scale
and then play it backwards.
{\bf IMPORTANT: Each musical note can be simply represented by a sinusoid
whose frequency depends on the note pitch. Assume a sampling rate of
8KHz and that an eighth note = 1000 samples.}
Musical notes are arranged in groups of twelve notes called {\it
octaves}. The notes that we'll be using for
Beethoven's Fifth are in the octave containing
frequencies from 220 Hz to 440 Hz. When we construct our scale,
we'll include notes from the octave containing frequencies from
440 Hz to 880 Hz.
The twelve notes in each octave are logarithmically spaced in
frequency, with each note being of a frequency $2^{1/12}$ times the
frequency of the note of lower frequency.
Thus, a 1-octave pitch shift corresponds to a doubling of the frequencies
of the notes in the original octave.
Table 1 shows the ordering of notes in the octave to be used to
synthesize the opening of Beethoven's fifth,
as well as the fundamental frequencies for these notes. When you do your
scale, you will have to determine the frequencies of three
of the higher notes on your own.
\[ \left. \begin{array}{|l|l|}
\hline
\mbox{Note} & \mbox{Frequency (Hz)} \\
\hline
A& 220 \\
\hline
A^{\sharp},B^{\flat} & 220 \ast 2^{\frac{1}{12}}\\
\hline
B & 220 \ast 2^{\frac{2}{12}}\\
\hline
C & 220 \ast 2^{\frac{3}{12}}\\
\hline
C^{\sharp},D^{\flat} & 220 \ast 2^{\frac{4}{12}}\\
\hline
D & 220 \ast 2^{\frac{5}{12}}\\
\hline
D^{\sharp},E^{\flat} & 220 \ast 2^{\frac{6}{12}}\\
\hline
E & 220 \ast 2^{\frac{7}{12}}\\
\hline
F & 220 \ast 2^{\frac{8}{12}}\\
\hline
F^{\sharp},G^{\flat} & 220 \ast 2^{\frac{9}{12}}\\
\hline
G & 220 \ast 2^{\frac{10}{12}}\\
\hline
G^{\sharp},A^{\flat} &220 \ast 2^{\frac{11}{12}}\\
\hline
\end{array}
\right.
\]
Table 1: Notes in the 220-440 Hz Octave\\
A musical score is essentially a plot of frequencies (notes, on
the vertical scale for you musician types) versus time (measures, on
the horizontal scale). The musical sequence of notes to the piece
you will synthesize is given in Figure~\ref{fig:music}. The following
discussion identifies how musical scores can be mapped to
tones of specific pitch and duration.
\begin{figure}[hbtp]
\centerline{\psfig{figure=music.ps,height=2.5in,width=6in}}
\caption{Musical Score for Beethoven's Fifth.}
\label{fig:music}
\end{figure}
\section{Note Frequency}
In the simplest case, each note may be represented by a burst of a
sinusoid followed by a shorter period of silence (a pause).
The pauses allow us to distinguish between separate notes
of the same pitch.
The horizontal lines in Figure 1 represent the notes E,G,B,D,F from
the bottom to the top. The spaces between the lines are used to
represent the notes F, A, C, and E, again from the bottom to the top.
Note that A-G only yields seven notes;
the additional notes are due to changes in pitch called sharps
(denoted by the symbol $\sharp$) or flats (denoted by the symbol
$\flat$) that follows a given note. A sharp increases the pitch
by $2^{\frac{1}{12}}$ and a flat decreases the pitch by
$2^{\frac{1}{12}}$.
In the musical score in Figure 1, the first three eighth notes
are all note G. The first half note is an E$^{\flat}$ due to the
inclusion of the three flat symbols at the left of the score,
since we are in the key of C-minor. After the half note, the
symbol is a rest of length equal to the duration of an eighth note.
The next three eighth notes
are all F, and the final half note is a D. You can get the
fundamental frequencies for these notes from Table 1.
\section{Note Durations}
The duration of each note burst is determined by whether the note
is a whole notes, half note, quarter note, eight note, etc.
Obviously, a quarter note has twice the duration of an eighth note,
and so on.
So your half notes should be four times the duration of your
eighth notes. The short pause you use to follow each note should
be of the same duration regardless of the length of the note.
\section{To Do}
\begin{enumerate}
\item Synthesize the piece appearing in Figure 1.
Play it back using the SOUND command in matlab. Type HELP SOUND
for more information.
You'll want to specify the sampling rate in the playback.
\underline{Save the
entire music synthesis in a .m-file}
\underline{Turn in a listing of your .m-file.}
\item Synthesize a scale in the key of C. This is simply eight notes
in order starting with C. They are
\[\mbox{C D E F G A B C.}\]
The key of C is simple because there are no sharps or flats.
Here, you will have to define the frequencies for A, B, and
the second occurrence of C
since they do not appear in Table 1.
\underline{What are the frequencies of the notes A, B,}
\underline{and the
second occurrence of C?}
\underline{Save your scale in a .m file}
\underline{ The .m file should play the scale and then ALSO,
PLAY IT BACKWARDS.}
\underline{Turn in a listing of your .m file.}
\end{enumerate}
\end{document}