CSC354: Spring, 2007, Lab2

Learning to Use Pure Data (pd)

  1. Trying out a patch in pure data.
    1. Open Pure Data (pd)
    2. Under the Help Menu item, select browser. Click only once!
    3. Now select 3. audio examples (click once).
    4. Finally, select A01. sinewave.pd. Click ON, and you'll hear the 440Hz sound. is going on.
    5. Click OFF
    6. In the file menu of the sinewave.pd patch, choose Save-as and save it as lab2.pd. Save it in your H:/ drive.
  2. Now let's change the frequency and amplitude.
    1. Change to Edit-mode, either by typing Ctrl-e or by going into the Edit menu and choosing Edit mode. (Note: Ctrl-e toggles back and forth: in edit mode and out of edit mode).
    2. Now, under the PUT menu, choose Number and you'll see a blue number box that follows your mouse until you click. You can still drag it wherever you want it. Place it above the osc~ object. (You can drag the others object around one by one or drag to hightlight a few and reposition the bunch).
    3. At the top of a number box or object, there are inlets. At the bottom, there are outlets. Connect the outlet of the number box to the left inlet (also called the hot inlet) of the osc~ object.
    4. PUT a second number box in the lab2 patch and connect its outlet to the right inlet (also called the cold inlet) of the signal multiplier *~ object.
    5. Now, PUT a comment by the number box that says
      <-- shift-click and drag to change by hundreths
      
      By following the instructions in this commen, the user (you) can change the amplitude by small increments.
    6. Leave edit mode (Ctrl-e) and click ON. Drag the mouse over both numbers a few times and listen.
    7. Click OFF.
  3. Now carefully read and try out the Help->Browser 2. control examples, 00,01,02,03,04, and 05. (Remember to click once only on each).
  4. Next, add a counter to your lab2.
    1. Copy the counter from example 05 into your lab2.pd patch. You may want to clear out some of the comments first to make room for it. To delete something, make sure you are in edit mode (the cursor is a hand) and highlight the comment to delete and the hit Backspace. To copy and paste, highlight over the objects you want to copy then do Ctrl-C and Ctrl-V to paste them. When you paste, pd puts the objects in the middle of the patch screen so next, drag the objects one by one so they are parallel to your osc~ and dac~ objects. Notice that the coonections between objects stretch for you.
    2. Change the initial value of the number box of the counter under the + 1 object so it starts at 200 instead of 0. Then connect the outlet of this number box into the inlet of the number box you have been using to change the frequency.
    3. Click ON.
    4. Click on the Bang message box and wait.
    5. Click OFF when you are ready.
    6. You can decide whether you want to keep the counter connected to your osc~ or not for the next part. Perhaps try it both ways.
  5. Now we will write out to a wav file.
    1. Make your lab2.pd screen larger by dragging on the bottom right of its window.
    2. Make a 2inch by 2inch empty space in the middle.
    3. Place an object called writesf~ in your lab2.pd, and then right click on it to get help.
    4. Read the information on the writesf~help.pd screen. Then copy the whole set of objects in the top left of the screen, including the bang and del 1000.
    5. Paste this subpatch in your lab2.pd. You can delete the writesf~ object you PUT there since the new subpatch already has one.
    6. Also, delete the osc~ 440 object that came with the new subpatch.
    7. Delete the second 2 open message boxes, starting with open -bytes.
    8. Change the file name in the top and now only open message box to lab2.wav.
    9. Change del 1000 to del 30000 so we record 30 second of sound instead of just 1.
    10. Add a print object under the del 30000. i.e. PUT an object and type print done in it. Then make a connection from the outlet of del 30000 to the left inlet of the print done object.
    11. 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~.
    12. Click ON
    13. Click bang, and then change the frequency and amplitude by mousing the number boxes.
    Place the wav file on your web page along with lab2.pd.