Smith College CSC354: Spring, 2011, Lab2=Hw2

More on Learning to Use Pure Data (pd)

If you want to download your own version of pure data
Click here for the instructions

Now we will write out to a wav file, play with randomness, and amplitude envelopes.
  1. You may wish to review the two Hernandez video tutorials:
  2. Read Section 2.2.3 (Time Operations) of Kreidler's on-line text, and Implement the Applications in section 2.2.3.2 (Automatic Random Melody, Glissando, and the Combination). The Combination can be done with two copy and pastes and a little editing. Keep all three applications intact and save the patch.
  3. Notice that the Glissando Application uses the line object to change the frequency of the oscillator. The line object works at the control rate. Ctrl-Click or Right-click to look at the help information on the line object.

    The line~ object, with the tilda, works at the signal or audio rate, and can be used to control the amplitude of an oscillator. A related object is the vline~, which allows more than one ramp.
    If you put a line~ object on a pd patch and Ctrl-Click or Right-click on it you can read the help file and how to use it.
  4. Open pd and open a new file, save it is lab2.pd
  5. Make your lab2.pd screen larger by dragging on the bottom right of its window.
  6. Make a 2-inch by 2-inch empty space in the middle.
  7. PUT an object called writesf~ in your lab2.pd, and then right click on it to get help.
  8. Read the information on the writesf~help.pd screen. Then copy the whole set of objects in the top left of the help screen, including the bang and del 1000.
  9. Paste this subpatch in your lab2.pd. You can delete the first writesf~ object you PUT there since the new subpatch already has one.
  10. Also, delete the osc~ 440 object that came with the new subpatch.
  11. Delete the second 2 "open" message boxes, starting with open -bytes.
  12. Change the file name remaining open message box to lab2.wav.
  13. Change del 1000 to del 30000 so we record 30 second of sound instead of just 1 (i.e. we now delay 30000 milliseconds).
  14. Add a print object under the del 30000 with the label wait. i.e. PUT an object and type
    print wait
    in it. Then make a connection from the outlet of del 30000 to the left inlet of the print wait object.
  15. PUT another del object under the print wait for 60000 milliseconds, and connect the outlet of the first del 30000 to the left (hot) inlet of the second del 60000.
    We are engineering a way to make ourselves be patient while writesf~ flushes its buffer out to the wav file.
  16. Now PUT another object under the second del 60000 object and this one will be print done.
    Connect the outlet of the second del 60000 to the inlet of the print done.
  17. Add a connection from your osc~ object so it also goes into the left inlet of the writesf~ object as well as to the dac~.
Now we get to run our program
  1. Leave edit mode (Ctrl-e) and click ON.
  2. Click on the message box "open lab2.wav"
  3. Click ON
  4. Click bang, and then change the frequency and amplitude by mousing the number boxes. You have 30 seconds of fun.
  5. Wait until you see print done in the main pd window
  6. listen to lab2.wav
Place the wav file on your web page along with hw1.pd.

hw2 - Make 45 second composition.

  • Read Section 3.1.2 Volume of Kreidler's on-line text. All about controlling amplitude/volume.
  • open a file in pd and save it as hw2.pd
    Use the Automatic Random Melody, Glissando, and the Combination examples, along with volume control elements, and elements from y our first pd patch if you like them. Generate a 45 second composition. Write it to a file called hw2.wav.
  • put hw2.wav and hw2.pd on your web site.