CS 198: Project #2

Project 3: Multi-player Rhythms

Due midnight, Monday 1 March, 2010

In lab we made a function playtune that let us define a tune as a sequence of pitches and durations. By calling the function twice with different arguments, we enabled two simultaneous players. For this assignment, the goal is to end up with a 4-part rhythm sound machine where you control the speed of the sound machine in Max.


Tasks

For this assignment, continue to use the same patcher and python file from lab.

  1. Create two more tune variables, similar to the ones we created in lab. Each tune variable should be a list with three elements. Set the first two elements to zero, and put your list of pitch/duration pairs in the third element. The easiest thing to do is copy one of the tunes from lab and then edit the sequence of pitch/duration values. Make sure you have four different sequences. When you are done with this step, you should have four variables, tune1 through tune4.
  2. Edit your patcher so that the script engine has eight outputs. Duplicate the makenote/noteout objects so there are four copies. You can set each noteout t a different channel if you wish. Connect them appropriately to the script engine outputs.
  3. Edit your play function so that it calls the playtune function for all four of your tune variables. Make sure you send each tune to a different pair of outputs. Then load your script and try running it with the four rhythm sections.
  4. Edit your patcher so that you can control the speed of the metronome with a slider. Create the slider, connect its output to the metronome's right input. Then use the inspector window on the slider to set its minimum value to 100 and range to 900. Does it work?

    Next, add a new object under the slider and give it the text prepend play. Route the slider's output to its input, and then route the prepend output to the right input of the play message box. Now the time unit sent to the metronome should also go to the python engine.

  5. Create a new python function called solo, that calls playtune for just one tune (pick your favorite). It should have two lines in it. One global statement, and one call to playtune.

    In Max, create a message box for calling the solo function. Then create a gswitch2 object to route the metronome to either the play message box or the solo message box. Use a checkbox to control the switch. Now you should be able to switch between one tune and all the tunes.

  6. Pick one of your tunes to be the lead ( or make a new one), letting the rest be conceptually rhythm and/or accompaniment. In other words, the lead should be the most interesting player. Make the lead do two things differently than the other tunes. First, make it louder. Second, make the lead pattern move between different base pitches.

    One way to implement the lead is to copy your playtune function, rename it playlead, and then edit it to implement the changes. The key change in the python function is to generate a random offset to the pitch that should change once per loop through the pattern. You will need to store it in a new global variable, or better as a value at the end of the list holding the tune data. The change in volume you can implement by editing the makenote object that is playing the lead tune.


Extensions

Here are some suggested extensions

Once you are finished with your work, put the python and Max files, and anything else you want to hand in, into your handin folder on the Academic server.


Writeup

Each of you should create your own wiki page for your writeup.

Colby Wiki

The title of your page should be something appropriate, like Project 3 and your name. Please put the label cs198s10proj3 on your writeup page (labels are down below the editing window on the edit tab).

For this week, your writeup should consist of your answers to the following questions.