<?php require_once "fs_inner_context.inc"; ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
     "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">

<title><?php echo $HTML_TITLE; ?></title>

</head>

<?php echo html_bgcolor_body($BG_COLOR); ?>

<!-- Standard hierarchical header structure -->

<?php echo $CS_HEADER_HTML; ?>

<?php echo html_linked_text("<em>Courses</em>", $CS_COURSES_ROOT_URL); ?>

<?php echo $HTML_HEADER; ?>

<img src="http://www.cs.uchicago.edu/~odonnell/OData/Images/waveline.gif"
     alt="------------------------------------------------"
>

<?php echo html_linked_header($HTML_HEADER_LEVEL + 1,
                              "Schedule for Final Interviews",
                              "Interviews"); ?>

<?php echo html_header($HTML_HEADER_LEVEL + 1,
                       "Open Project (Non)Rules"); ?>

<p>The class project for Com Sci 295 is an <em>open project</em>. It
is open in two senses.</p>

<ol>

  <li>There are no restrictions on how you accomplish project
  work. You are encouraged to collaborate, share work, use ideas that
  you hear from others, find information in books and articles or
  figure out for yourself, whatever works. I will evaluate your
  project work entirely from your presentation of the insights that
  you gain. You may present the work of others, as well as your own,
  but you must explain what it means. Of course, you must acknowledge
  the source of each idea that you use. You must share your own work
  freely with the class.<br><br></li>

  <li>You may change the definition of the project. I will provide a
  default work schedule, but you are at liberty to vary any parts of
  it that you like. In order to get useful credit toward a grade,
  though, you must be able to demonstrate the materials that you
  develop. I will provide a sound-capable <em>Linux</em> system with
  all of the software that comes up in class. If you want any other
  facilities, you must take the initiative to arrange them for the
  final interview. If you make serious changes in the standard
  project, it's a good idea to discuss them with me, to make sure that
  I will appreciate their value in the final interview.</li>

</ol>

<?php echo html_header($HTML_HEADER_LEVEL + 1,
                       "Basic Goal of the Project"); ?>

<p>The goal of the project is to evaluate intuitively the quality of
several common models for synthesizing sound, by simulating a small
number of musical instruments with some of those models, interpolating
between the qualities of instruments using the <em>Loris</em> tool
library, and listening carefully to the results. With each synthesis
model, the idea is to discover its natural good and bad qualities. So,
there's no point in trying to
perfect the instrument simulation with each model. Rather, we want to
find the best simulation that uses the model in an intuitively natural
fashion.</p>

<p><strong>I haven't updated beyond this point. The remainder reflects the
spring 2002 project. [O'D]</strong></p>

<?php echo html_header($HTML_HEADER_LEVEL + 1,
                       "The Simulation Exercises"); ?>

<p>We will simulate the sound of the trumpet using 4 or 5 different
synthesis models. In each case, we will create a simulation that can
play individual notes of a second or two at a moderate articulation
and dynamic, for each pitch of the chromatic scale over the normal
range of the instrument. The 5 types of synthesis are:</p>

<ol>

<li>Hacking around with a recorded sample using sound editors, such as
<em>MixView</em>, <em>DAP</em>, <em>snd</em>. (Accomplish by Monday 9
April 2002)<br><br></li>

<li>Wavetable synthesis, using a single sampled period of sound,
playing it at various speeds to produce different pitches, and using a
single amplitude envelope for the articulation. (Accomplish by Thursday
18 April 2002)<br><br></li>

<li>Additive sinusoidal synthesis with a single amplitude
envelope. This will sound just like step 2, but prepare us for step
4. (Accomplish by Thursday 25 April 2002)<br><br></li>

<li>Additive sinusoidal synthesis with a separate amplitude envelope
for each partial. (Have a working start by Monday 6 May 2002)<br><br></li>

<li>Pass the results of step 4 through a broadband filter to eliminate
the chipmunk effect.<br><br></li>

<li>(Maybe we'll get this far) Adding a bit of randomness to the
results of 5, to make them more lifelike.</li>

</ol>

<?php echo html_header($HTML_HEADER_LEVEL + 1,
                       "Project Steps"); ?>

<?php echo html_header($HTML_HEADER_LEVEL + 2,
                "<a name=\"step 1\">Step 1: soundfile editing</a>"); ?>

<p>You should accomplish step 1 by Monday, 9 April 2002.</p>

<ol>

<li>Choose one recorded trumpet note.<br><br></li>

<li>Use waveform editors, such as <em>MixView</em>, <em>DAP</em>, and
<em>snd</em>, to produce a short sequence of notes with different
lengths and pitches. Make sure that you include some notes near each
end of the instrument's normal range---you might even decide to go
beyond that range. You can produce a scale, an arpeggio, or a short
musical piece according to your own taste. I had my best results using
<em>DAP</em>'s ``Resample Non Time'' feature to create different
pitches, cut &amp; paste to shorten/lengthen notes, ``Amp Ramp'' to
smooth out the joints. You might enjoy trying the ``Resample Time''
feature to shift pitches and control lengths. But that's a rather
sophisticated feature, and I'd like you to also observe what
can/cannot be accomplished with primitive editing.<br><br></li>

<li>Try creating some waveforms freehand. You can do this by starting
with no sound file in <em>DAP</em>, setting the ``Edit'' button on the
right upper side of the window, pushing values around with the mouse,
then playing with the ``Loop'' feature. This probably won't work very
well. The interesting thing is to observe that it doesn't work.<br><br></li>

<li><strong>Listen and critique.</strong> This is the most important
part. Describe as clearly as you can the qualities of trumpet sound
that are captured by your simulation, and those that are not.</li>

</ol>

<?php echo html_header($HTML_HEADER_LEVEL + 3,
                       "Resources"); ?>

<ul>

<li><a href="http://people.cs.uchicago.edu/~ilia/samples/C_trumpet/">Recorded notes</a>
from the McGill CD.<br><br></li>

<li><a href="http://ccrma-www.stanford.edu/CCRMA/Software/snd/snd-manual/snd.html">Snd manual</a><br><br></li>

<li><a href="http://www.create.ucsb.edu/~doug/htmls/mxv-manual.html">MXV manual</a><br><br></li>

<li><a href="http://www.cee.hw.ac.uk/~richardk/about.htm">DAP features</a></li>

</ul>

<?php echo html_header($HTML_HEADER_LEVEL + 2,
                "<a name=\"step 2\">Step 2: wavetable synthesis</a>"); ?>

<p>You should accomplish Step 2 by Thursday 18 April.</p>

<ol>

  <li>Take a low recorded trumpet note from the
  <a href="http://people.cs.uchicago.edu/~ilia/samples/C_trumpet/">McGill
  recordings</a>. Inspect it and listen to it with <em>DAP</em> (the
  ``Loop'' function is especially helpful) and any other tools that
  you like. Find a region in the middle of the note that seems to
  represent the overall quality of the sustained portion of the sound
  reasonably well.<br><br></li>

  <li>Save a single period from the chosen region as a separate file,
  and make it into a wavetable in <em>Csound</em>. Unfortunately,
  <em>CSound</em> only uses wavetables containing numbers of samples
  that are powers of two. Use <em>DAP</em>'s ``Resample Time''
  function, specifying ``Frame'' units to resample up to the next
  higher power of two.<br><br></li>

  <li>Create a <em>Csound</em> amplitude envelope for the trumpet
  note. You may do this intuitively by eye, or you may use software
  tools.<br><br></li>

  <li>Use <em>Csound</em> to play simulated trumpet scales,
  arpeggios, songs, or whatever.<br><br></li>

  <li><strong>Listen and critique.</strong> This is the most important
  part. Describe as clearly as you can the qualities of trumpet sound
  that are captured by your simulation, and those that are not.</li>

</ol>

<?php echo html_header($HTML_HEADER_LEVEL + 3,
                       "Resources"); ?>

<p>
<ul>

  <li><a href="http://people.cs.uchicago.edu/~ilia/samples/C_trumpet/">Recorded notes</a>
  from the McGill CD.<br><br></li>

  <li><a href="http://www.lakewoodsound.com/csound/hypertext/manual2.htm"><em>Csound</em>
  manual</a><br><br></li>

  <li><a href="Examples/CSound/">Trivial
  <em>Csound</em></a> example for you to modify<br><br></li>

  <li>Discussion of a similar project step from
  <a href="http://satisfaction.cs.uchicago.edu:8080/HyperNews/get/odonnell/Courses/CS295/class.html/6.html">1996</a>,
  <a href="http://satisfaction.cs.uchicago.edu:8080/HyperNews/get/odonnell/Courses/CS295/1999/class/14.html">1999</a>, and
  <a href="http://satisfaction.cs.uchicago.edu:8080/HyperNews/get/odonnell/Courses/CS295/2000/class/7.html">2000</a>, and
  <a href="http://satisfaction.cs.uchicago.edu:8080/HyperNews/get/Courses/CS295/Spring_2001/classwork/9.html">2001</a>.<br><br></li>

  <li><a name="ste 1 example 2">My own preliminary work on the horn<br><br></a>.

  <ul>
    <li>I used <em>MixView</em> (<code>mxv</code>, but if I were doing
    it now, I'd use <em>DAP</em>) to select a 726-sample period from a
    low horn note, resampled it to 1024 samples (using the phony
    sample rate 44100*1024/726=62201), and saved it as a
    <code>wav</code> file. Then, I used the
    <a href="http://www.lakewoodsound.com/csound/hypertext/gen/gen01.htm">``<code>GEN01</code>''</a>
    routine in <em>Csound</em> to read it in as a wave table, and
    played a 3-octave scale. Here are my files:

<br><br>

    <ul>
      <li><a href="Examples/CSound/horn_sample_1.orc"><code>horn_sample_1.orc</code></a><br><br></li>

      <li><a href="Examples/CSound/horn_sample_1.sco"><code>horn_sample_1.sco</code></a><br><br></li>

      <li><a href="Examples/CSound/horn_period_1024.wav"><code>horn_period_1024.wav</code></a> (temporarily missing---I'll retrieve it soon)</li>
    </ul>

  </ul>
  </li>

</ul>

<?php echo html_header($HTML_HEADER_LEVEL + 3,
                       "Optional variations"); ?>

<ul>

  <li>Compare different amplitude envelopes. In particular, try more
  and less accurate envelopes, using more and less break points.<br><br></li>

  <li>Study a number of different trumpet notes, and consider how
  much the envelope shape depends on the pitch of the note. Experiment
  with <em>CSound</em> instrument definitions that adjust the envelope
  depending on the pitch.<br><br></li>

  <li>Try wavetables taken from recorded notes at different pitches.</li>

</ul>

<strong>From here on, I haven't edited last year's description.</strong>

<?php echo html_header($HTML_HEADER_LEVEL + 2,
           "<a name=\"step 3\">Step 3: simple additive synthesis</a>"); ?>

<p>You should do this step quickly, by Thursday 25 April. It won't
produce much in the way of interesting new sounds---it's mostly just a
programming step to position you for step 4, which has the most
interesting listening exercises.</p>

<ol>

  <li>Choose one period from a recording of a trumpet note, and find
  its sinusoidal components by taking a Fourier Transform. Lots of
  different software tools will do a Fourier Transform for you, but I
  found <em>Scilab</em> to be most convenient. You may also try out
  data from the
  <a href="http://sparky.parmly.luc.edu/sharc/">SHARC</a>
  database.<br><br></li>

  <li>Construct a simulation of the trumpet in <em>Csound</em> by
  additive synthesis, adding up some reasonable number of the partials
  analyzed by the Fourier Transform above. Ignore the phase of the
  partials, and use only the amplitude information in the magnitude of
  the Fourier Transform. Use a single envelope to control the attack,
  sustain, and decay of each note, just as you did in step 1. Add more
  partials until you can't hear the difference.<br><br></li>

  <li>Improve the simulation to avoid aliasing, by omitting partials
  above about 20,000 Hz. This requires a conditional form, since the
  actual frequency of a partial depends on the pitch of the note.<br><br></li>

  <li>Add phase information.<br><br></li>

  <li><strong>Listen and critique.</strong> Given the same recorded
  period and the same amplitude envelope, the results of this step
  should sound almost the same as the results of step 1. You may be
  able to hear some differences due to

<br><br>

  <ol>

    <li>omission of some partials,<br><br></li>

    <li>approximation of the amplitudes of partials,<br><br></li>

    <li>omission and approximation of the phase of partials,<br><br></li>

    <li>aliasing in the wavetable synthesis, which is avoided in the
    additive synthesis.</li>

  </ol>

<br><br>

  You should also look at the waveforms resulting from different
  styles of additive synthesis, and correlate the visible differences
  with the audible differences.
  </li>

</ol>

<?php echo html_header($HTML_HEADER_LEVEL + 3,
                       "Resources"); ?>

<p>Here is my preliminary work with the horn from 1999. You should be
able to update it with trumpet data.</p>

<ol>

  <li>My Csound score file,
  <a href="Examples/CSound/adsyn_horn.sco"><code>adsyn_horn.sco</code></a>.
  <br><br></li>

  <li>My recorded period,
  <a href="Examples/Samples/horn_period_1.wav"><code>horn_period_1.wav</code></a>.
  Since the Fourier Transform function in <em>Scilab</em> does not
  require the number of samples to be a power of 2, I did not resample
  the period.<br><br></li>

  <li>A <a href="Examples/Scilab/fft_scilab.html">transcript</a> of my
  <em>Scilab</em> session to compute partial amplitudes and phases
  from my horn period. I defined special functions
  <code>plot_spectrum</code> and <code>arg</code> to help. They are
  in the file
  <?php echo html_linked_text("<code>fourier_demo.sci</code>",
                              $GLOBALS["OD_ROOT_URL_PATH"] .
                              "/Scholar/Work_in_progress/Digital_Sound_Modelling/Scilab_demos/fourier_demo.sci") . " ";
  ?>
  described with the
  <?php echo html_linked_text("lecture notes",
                              $GLOBALS["OD_ROOT_URL_PATH"] .
                              "/Scholar/Work_in_progress/Digital_Sound_Modelling/");
  ?>.
  <br><br></li>

  <li>My <em>Csound</em> orchestra file,
  <a href="Examples/CSound/adsyn_horn_1.orc"><code>adsyn_horn_1.orc</code></a>,
  performing additive synthesis with 18 partials. The higher partials
  appear to be so small that they probably don't have much audible
  impact. I ignored the phase information, and used only the
  magnitudes from the Fourier Transform.<br><br></li>

  <li>My <em>Csound</em> orchestra file,
  <a href="Examples/CSound/adsyn_horn_2.orc"><code>adsyn_horn_2.orc</code></a>,
  with conditional code to avoid aliasing problems.<br><br></li>

  <li>My <em>Csound</em> orchestra file,
  <a href="Examples/CSound/adsyn_horn_3.orc"><code>adsyn_horn_3.orc</code></a>,
  using the measured phase of each partial</li>

</ol>

<p>I structured the <em>Csound</em> orchestra files fairly carefully for
convenient experimentation with different variations. I normalized the
size of the envelope <code>kenv</code> to 1, so that the amplitude
value from the note is mentioned only once. To avoid scaling the
amplitude of each individual partial, I divided by the sum of all the
partial amplitudes (391.34) in the final calculuation of
<code>aout</code>. You should be able to do lots of interesting
experiments just by changing the numbers in my orchestra files, and
possibly adding or deleting lines to handle more or fewer partials,
but without changing the basic structure in any way.</p>

<?php echo html_header($HTML_HEADER_LEVEL + 2,
  "<a name=\"step 4\">Step 4: additive synthesis with separate envelope for each partial</a>"); ?>

<p>This step is the most complicated and labor intensive in the
project. You should have a basic structure to work with by Monday 6
May. Then you can spend another 1-2 weeks refining and
experimenting.</p>

<ol>

  <li>Study the recorded trumpet notes, especially the attack portion of
  each note, both by listening and by looking at plots of the
  waveforms. Try to identify a few interesting notes and some
  characteristics of those notes to try to reproduce by additive
  synthesis.<br><br></li>

  <li>Perform time-frequency analysis of one or more interesting
  notes. Since the trumpet notes are highly periodic, and they are
  played with very little variation in pitch, you can get pretty good
  results by taking discrete Fourier transforms of individual periods,
  using the <em>Scilab</em> functions that I designed.<br><br></li>

  <li>Synthesize scales of trumpet-like notes in <em>Csound</em>, using
  additive synthesis with separate amplitude envelope (programmed
  using
  <a href="http://www.classes.cs.uchicago.edu/classes/archive/2000/spring/CS295/Computing_Resources/Csound/CsManual3.48b1.HTML/Generate/line.html"><code>linseg</code></a>
  for different partials. Start with the minimum number of partials
  that produced reasonably satisfying results in step 2.<br><br></li>

  <li>Try more vs. fewer partials, and different approximations to the
  amplitude envelopes, to discover how much audible difference such
  details produce. Try grouping several partials together with a
  single envelope.</li>

</ol>

<?php echo html_header($HTML_HEADER_LEVEL + 3,
                       "Resources"); ?>

<ol>

  <li>My Csound score file,
  <a href="Examples/CSound/adsyn_horn.sco"><code>adsyn_horn.sco</code></a>,
  the same as the one I used in step 3.<br><br></li>

  <li>My recorded horn note,
  <a href="Examples/Samples/horn_mf_B2.wav"><code>horn_mf_B2.wav</code></a>.
  <br><br></li>

  <li>A <a href="Examples/Scilab/time-freq_scilab.html">transcript</a> of my
  <em>Scilab</em> session to compute time-frequency analyses from my
  trumpet note.<br><br></li>

  <li><a href="Examples/Scilab/time-freq.sci"><em>Scilab</em> function
  definitions</a> to help with your time-frequency analysis.<br><br></li>

  <li>My <em>Csound</em> orchestra file,
  <a href="Examples/CSound/adsyn_horn_se_1.orc"><code>adsyn_horn_se_1.orc</code></a>,
  performing additive synthesis with 6 partials, using a separate
  amplitude envelope for each partial, and leaving all the phases at
  the default.</li>

</ol>

<?php echo html_header($HTML_HEADER_LEVEL + 3,
                       "Optional variations"); ?>

<ol>

  <li>Vary the frequencies of partials, as well as their amplitudes,
  in the early stages of the attack.<br><br></li>

  <li>Add a small amount of noise at the initiation of the note.<br><br></li>

  <li>Vary the decay characteristics of different partials.</li>

</ol>

<?php echo html_header($HTML_HEADER_LEVEL + 2,
                       "<a name=\"step 5\">Step 5: add a noise component or a formant filter</a>"); ?>

<?php echo html_header($HTML_HEADER_LEVEL + 3, "Formant filter"); ?>

<p>Usually, the next recommended step is to add a filter to shape the
spectra of notes at different pitches and eliminate the chipmunk
effect. Many instruments have low notes that sound far too buzzy or
nasal when shifted up to high pitches with the same relative strengths
of different partials. To get a useful estimate of the right spectral
profile for this filter, you need to compare spectra of several notes
across the whole range of the trumpet. Greg Sandell's SHARC project
has some average spectra that you can use for this purpose. You can
compute your own averages using the FT function in <em>Scilab</em>. Or
you can use some more sophisticated software that my Ph.D. student,
Ilia Bisnovatyi, created. If you would like to work on a formant
filter for the trumpet, please post questions and comments, and I
will help you work out your methods in more detail. Since the chipmunk
effect is not very dramatic in the trumpet, I expect a greater
interest in the noise component.</p>

<?php echo html_header($HTML_HEADER_LEVEL + 3, "Noise"); ?>

<p>In the best harmonic additive synthesis that we've achieved so far,
we are still missing a certain high-frequency nasal or buzzy quality
in some of the recorded notes. We have some indication that part of
this quality can be produced by adding more of the higher
harmonics. But some of those higher harmonics seem to stand out too
much in the synthesized sound.</p>

<p>I suspect that there is a broadband noisy component to typical
trumpet notes, derived physically from the hissing of air through the
instrument. Such a noisy component might produce the buzzy quality
that we've observed, and it might also soften the impact of higher
partials by masking them.</p>

<p>Analyzing the noise component is a bit challenging. The basic idea
is to take a very accurate harmonic synthesis, subtract it from the
recorded note, and analyze the difference. If the harmonic synthesis
is accurate enough, the remainder is essentially the noise
component. Unfortunately, since the noise component is spread over a
large range of frequencies, it can be perceptually loud even though it
is numerically small. So the harmonic synthesis may need to be
numerically accurate even beyond the requirements of perceptual
accuracy.</p>

<p>I suggest that you take a substantial number of periods (perhaps
10, perhaps 100) from the sustain portion of a chosen trumpet
note. Try to find a segment with very little amplitude or frequency
variation. I think that there is very little frequency variation
overall, but amplitude may be a problem. Set the endpoints of your
segment carefully to get a precise integer number of periods.</p>

<p>Take a Fourier transform of your chosen segment, and find the peaks
corresponding to harmonic partials. Zero them (or set them to some
arbitrary very small value, in case division by 0 becomes a problem)
by just reassigning their values in the spectrum vector. Look at the
remaining part of the spectrum. If it has a fairly flat magnitude, and
random-looking phase values, then you have a reasonable basis for
estimating a noise component.</p>

<p>Complication: any amplitude modulation in the sequence of periods
will spread out the harmonic peaks. You may have to remove a few
frequency bins to each side of each peak in order to squelch the
harmonic component. If the AM sidebands spread so far that they mask
the noise component even halfway between harmonic peaks, then we'll
have to try something more sophisticated. I'll reserve comment on that
something until someone reports on an attempt with the simpler
approach.</p>

<p>Why not analyze a single period, to avoid the AM sidebands? The
analysis of a single period only provides the harmonic partials, and
loses the indication of noise. Why not perform a higher
frequency-resolution analysis of a single period, by padding with 0s?
That gives you an analysis of a pulse containing a single period. The
sharp turning on and off of that pulse amounts to a very severe sort
of AM. Each harmonic partial generates a sinc-shaped spectral
component, which will mask the evidence of a low-amplitude noise.</p>

<p>Variation: from a visual inspection of a trumpet recording, it
appears that noise content might occur in very short pulses around the
fundamental frequency. It makes sense that such pulses could result
from turbulence in the air flowing through the reed, since the reed
opens for one or a small number of very short pulses each period. It's
not clear how best to try to analyze this possibility. You could
select the apparent pulse regions by eyeball, and compute spectra. But
they are so short that I'm not optimistic about getting useful
results. You could work constructively: make a reasonable guess,
compute such a sequence of pulses, and listen to the result.</p>

<?php echo html_header($HTML_HEADER_LEVEL + 2,
  "<a name=\"step 6\">Optional step 6: add random jitter for liveness</a>"); ?>

<?php echo html_footer("index", 0, 1); ?>
<!-- hhmts start -->
Last modified: Mon May 20 10:29:03 CDT 2002
<!-- hhmts end -->

</body>

</html>
