Assignment 4 Additive synthesis using Csound

 

Goal

To reproduce the sound of a sampled instrument using additive synthesis.

Tasks

  1. Download this sample of a single clarinet note.
  2. Load the file into Rezound. You will need to load jack first using qjackctl. Mke sure jack has started before running Rezound.
  3. The sample is in stereo, but you can reduce it to one channel using Edit/Remove Channels.
  4. Use the editor to extract a single cycle of the waveform. Try to choose a cycle from the stable part of the note. i.e. where all of the cycles appear identical. Try to choose a cycle that starts at zero and ends at zero. Blow up the display horizontally so that only a few cycles fit in the window by clicking on the + button to the right of the “wheel” below the waveform. Define the start and end of the cycle using the left mouse button for the start and the right mouse button for the end. Then use Edit/Cut to New to make a new waveform with just one cycle.
  5. Save the single cycle as a wav file (File/Save As and select .wav).
  6. Create a Csound .ORC file to use the loscil opcode, and a GEN01 table in the .SCO file loaded from the single cycle file. Add a suitable amplitude envelope using the linen or linseg opcode to approximate the envelope of the original sample.
  7. Use the .SCO file to play a long note (4 seconds) and report on a comparison of  the sound of the original sample file and the synthesized sound. They should be similar in some ways and different in others.
  8. Go back to the original file in Rezound (don’t forget to run Qjackctl first) and select roughly one second from the steady part of the waveform. Use Edit/Crop to remove everything except the selected portion.
  9. Run the Jack Audio Analysis program with “jaaa –J&” from a shell terminal window. Use the Connect button in Jack to connect the output of Rezound to the input of Jaaa. Jaaa runs in real time so its display will change when the waveform is played in Rezound. Select the button Vid. Av. in Jaaa, which will then display the average over time. Try to display both windows, of Rezound and Jaaa side by side by resizing them appropriately (Rezound can be resized to just show the transport controls). Play the waveform in Rezound, then click the Freeze button in Jaaa when it has finished.
  10. Click the Peak button in Jaaa, and click on each peak in the display in turn. The numbers shown will change to give the peak’s frequency and its amplitude in dBs. Record the amplitudes and frequencies for each harmonic in turn.
  11. Create a .ORC file to synthesize an instrument using the addition of a number of oscil opcodes. You should use the same number as the number of peaks in the spectrum from part 10. The amplitudes of each oscillator will come from the recorded peaks. Use the opcode ampdbfs to convert dB to an amplitude. This opcode uses 0dB as equivalent to full scale amplitude, so the negative amplitudes from Jaaa will work well. Again use a suitable amplitude envelope.
  12. Repeat step 7.
  13. Use Csound to create an output file and show the spectrum of this sound using Rezound and Jaaa. Compare the two spectra – of the original sample and of your synthesized sound – and report the differences.
  14. Repeat step 6 using a GEN10 table in the .SCO file and calculated amplitudes for each harmonic. Use the formula:
          R = 20log10(A1/A2) dB and its inverse:
          A1/A2 = log-110(R/20)
    to calculate the amplitudes.
  15. Repeat step 7.

 

Resources

The Csound manual is available online at http://www.lakewoodsound.com/csound/ and the alternative manual is at http://kevindumpscore.com/docs/csound-manual/. The alternative manual is a little better organized and has better examples. You can, of course, use the example file for loscil and the GEN01 table to give you a start on the .ORC and .SCO files.

Csound itself can be run from the command line on our Linux machines. Typing ‘csound’ will give you the command line flags and they are also discussed in the manual. You will need the –o and –W flag for .WAV output.

Deliverables

The .ORC and .SCO files for each of the three instruments, and reports on the sound they produce as compared to the original sample.

Due Date

Wednesday March 29th before midnight.