User Tools

Site Tools


cs276:spc.synth

CS 276 - Synthesis Lab (obsolete - Ess version)


The purpose of this lab is to learn how to work with Unit Generators (UGens) such as classes AudioSamples and SinOsc.

  1. Start up Processing and copy in the GenerateSines example from the sample code page.  Try running it, but make sure your computer's volume is set at a reasonable level first.  Your should hear two pure tones, both at the same pitch and separated by about a second of silence.

    Briefly, this sketch creates an empty AudioSamples, initializes it to hold 6 seconds of sound (though note the parameters are always expressed in milliseconds), and has two sine waves of varying duration copied into it, then played.  The SineOsc ugen is initialized to play a pitch based on a frequency of 480 Hz, at an amplitude of 0.1 units.

  2. Modify your copy of GenerateSine as described below.  I recommend making one change one at a time, making sure each works, then demonstrating them all together.

    • Create a second SineWave object, with a higher volume (so it is louder), and pitched an octave higher than the first (in other words, double the frequency).

    • Add two additional seconds of silence to the AudioChannel, then generate a few more seconds of sound with the second SineWave generator.

    • Add a second call to your new SineWave generator method to sum the output of the new generator with the original one (used for the first three seconds).  For example if the second SineWave were called myWave2:
         myWave2.generate(myChannel, Ess.ADD, begin, end); // adds one harmonic     
    You've just created a simple software synthesizer, using a very basic additive synthesis technique.  Demonstrate the code and results to the instructor.

  3. For help with the methods, check the documentation for the SinOsc and AudioSamples constructor and methods,   especially:

    • frames (Ess method)
    • SinOsc constructor
    • generate (SineWave method)

    Note: the docs don't mention it, but SinOsc is a subclass of AudioSamples

  4. Switch drivers. Make a new sketch and copy in the full-blown AdditiveSynthesis example from the sample code page.  Run this example as well.  Experiment with different unit generators; for example, you can try changing the SineWave objects to TriangleWave objects. Or combine SineWave with TriangleWave UGens in any combination (or any other subclass of AudioGenerator). Demonstrate what you get.
     

cs276/spc.synth.txt · Last modified: 2019/11/25 18:23 by scarl