Author Archives: Keith Kothman

(maxmsp) recording to a buffer, more groove

Demo patcher: RecordNGroove.maxpat

Today’s demo patcher is based on grooveplay, from the buffer~ and groove~ post.

Some minor changes, before diving into the new stuff. The buffer~ object (in the green section) is getting audio from the record~ object. I’ve deleted the read messages. You can put them back in, of course. In the groove section I changed sig~ to line~. The float feeding the right inlet sets a slew time (or portamento time) between ratio changes that come in the left inlet. This smooths out changes in playback ratio.

recording (ezadc~, record~)

The recording section has an ezdac~ (microphone) for input, feeding a record~ object (buffer name, length in ms, number of channels). Starting and stopping of recording is controlled by a toggle. The toggle can be controlled by a CC (sustain pedals/foot switches work really well). The timer section to the right keeps time between the toggle turning on (any non-zero number) and the toggle turning off (zero). Timing information sets the ending loop point for groove~, and triggers a bang to set the play position of groove~ back to the beginning of the sound buffer.

Since we’re recording into a buffer, we can’t resize the buffer to match our recorded input. There is a resize message for buffer~, but it erases the buffer~. The trick is to set the buffer~ size comfortably larger than you intend to use, and set the end loop point to the end of the recording.

groove

The groove section (red/pink) gets playback ratio from either a CC (like before) or a MIDI keyboard (discussed later). You have loop control being sent from the timer in the record section. This section is mostly the same as the last demo.

midi keyboard control

The blue section in the lower right contains a collection of objects designed to let you specify playback ratios by playing on a midi keyboard. The kslider lets you pick a root key, or key that sets unity ratio (1.) playback. The midi note number is converted to frequency, and that frequency is used as the denominator in our division operation. Incoming noteon messages provide a note number that is also converted to frequency and used as the numerator in the division operation. The result is a ratio that matches equal temperament** intervals and is sent via kbRatio.

Key velocity is being used to start and stop playback of groove~. On velocities coming from stripnote are sent via startBang to “rewind” the buffer, with a playback ratio following quickly afterwards. All velocities are sent to a select 0 object. Off velocities send out a bang, triggering the 0. message to be sent as the kbRatio. A playback ratio of zero stops playback.

**If you want to generate ratios for non-12-tone equal temperament you can generate any ratio you like as part of an expression object. Just intonation can be derived from integer ratios. Microtonal intervals can be generated with a formula of 2 to the x/y power, where y is the number of steps in the octave and x is the number of steps of your interval from the root key.

(maxmsp) buffer~ and groove~

I included the example patcher (grooveplay.maxpat) in the zipped soundfilepatcher archive from Monday.

buffer~

Preliminary stuff first. buffer~ allows you to load a sound file into RAM. You can play it back with a number of objects, get information about it, etc., but it is in effect like sampler memory.

The object takes arguments for buffer name, length (in ms), and number of channels. You “read” files into a buffer (instead of sfplay~’s open), but it is more beneficial to use a replace message. The replace message resizes the buffer to match the length of the sound file loaded.

You can double-click the buffer to see a graphic waveform display of the loaded sound file. The left outlet of buffer will report mouse position (in ms) when you click on the graphic display. The right outlet sends a bang when a sound file is finished loading. This bang is useful for sending to objects that provide info about the sound, and for other uses.

groove~

I just love the name of this object! The groove~ object plays sound from a buffer. It needs an argument for the buffer name to read from, and for the number of channels. The number of outlets depends on the number of channels for playback — there will always be one more than the number of channels. (The last outlet sends out a sync signal, which we will seldom if ever use.)

groove~ takes a signal-rate input for playback speed, expressed as a decimal ratio. Unity playback is the ratio 1. Negative ratios play backwards. I’m scaling a CC and sending it to a sig~ object (converts a float to a signal). The output of the sig~ object is sent to groove~. The toggle can be used to start and stop playback, although it won’t change playback speeds. The extra 0. message is included as a simple stop button.

groove~ has one big gotcha to get it to start playing. You have to tell it where to start in the buffer (time in ms). I’m using the message with “0.” to do that (it’s marked with the rewind comment). If you aren’t looping playback, you’ll need to “rewind” the playback position to play the sound again.

Looping status is set with the loop message. Loop 1 (or true) turns looping on; loop 0 (false) turns looping off. The second inlet can be used to set the minimum loop position (loop start); the third inlet sets the maximum loop position (loop end). If neither min or max points have been set, groove~ will loop the entire sound file.

(maxmsp) sfplay~ and dropfile

I’ve zipped the example patcher, CtlnAssign, and a couple of sound files into one downloadable folder.

sfplay~

MaxMSP has an excellent tutorial and help patchers. My example doesn’t try to recreate everything you can do with sfplay~. I’m focusing on basic playback, the loading of files, and how to create a useful start/stop mechanism with the spacebar. Most of the advanced features of sfplay~ are better handled with buffer~ and objects like groove~, etc., which will talk more about.

The heart of the patcher is in the blue box. The object uses an argument to specify number of channels (above 1) — it can play up to 8-channel files. sfplay~ takes an open message to bring up a standard file dialog box. A toggle is useful for starting and stopping playback. 1 starts playback from the beginning of the file; 0 stops. When the file is done playing (either by reaching the end of the file, or by having the user stop it manually) the object outputs a bang out its right-most outlet. The [open Cave_Water_Drops.aif] message loads that file for sfplay~ without a dialog box. This message only works if the file is either in the same folder as the patcher, or in anther folder in the MaxMSP search path.

In this example patcher I’m using the space bar to control starting and stopping of playback, much like commercial audio software. The key object leads to [select 32] (32 is the ascii code for the spacebar). The output of select feeds into a gate object so that I can control when the spacebar affects playback (don’t want the file to start when I’m typing new objects).

The toggle that starts and stops file playback also gates whether the stop bang will get sent back to the toggle. If the sound file reaches its end, the gate will be open and the bang will go to the toggle and reverse its state (showing that the file has stopped playing). If the user stops playback the gate is first closed, stopping the bang from reaching the toggle (which would restart playback).

dropfile

dropfile lets you drag-and-drop files from the finder to load into sfplay~ (or other file-based objects). The right outlet shows the file type that was dropped (could be used as a gate or error check message if you don’t drop a valid sound file). The left outlet gives the full path and name of the file. Sent to an [open $1] message, this will allow you to load that file into sfplay~.

(musTh 212) Classical Serialism

Classical serialism typically refers to the 12-tone composition technique developed by Schoenberg and his followers.

The basic premise of the 12-tone system is the row, which is an ordered arrangement, or set, of pitch classes. Each pitch class occurs once, and only once. The row has four basic forms:

  1. Prime (P): the original ordered set (row). The transposition of the prime form is determined by the first pitch class of the row. The prime form of the row is usually the first occurrence of the row.
  2. Retrograde (R): the original row in reverse order. The transposition of the retrograde is determined by the last pitch class of the row.
  3. Inversion (I): the original row with the ordered pitch-class intervals reversed. The first pitch class determines transposition.
  4. Retrograde Inversion (RI): the inversion in reverse order. Like the retrograde form, the last pitch class determines the transposition level.

The matrix contains all 48 versions of the row – the four basic forms, each with 12 transpositions. Although theorists disagree on how to construct and label rows, we will adopt the technique that begins with the prime form of the row transposed to pitch-class 0.

As an example, start with the initial row: 2 11 10 5 6 8 4 3 0 1 7 9.

Transposed to pitch class zero:  0 9 8 3 4 6 2 1 10 11 5 7.

Start by filling in the top row of a 12×12 matrix with the P-0 form of the row.

primerow.gif

Then fill in the inversion of P-0 going down the left-most column. Remember that you can invert either by reversing the ordered pitch-class intervals, or by subtracting each pitch class from 0.

primeinversion.gif

Finally, fill in the remaining prime transpositions of the rows, beginning with the pitch class in the first column, and using the interval between it and pitch class 0 as your interval of transposition.

matrix.gif

Notice how pitch class 0 moves diagonally through the matrix. You can use this property to check yourself. You shhould also check yourself by making sure that you haven’t repeated any pitch classes in any row or column (Sudoku-like).

The row across the middle, starting with 6 and moving left-to-right ending on 1, is P-6. The row moving across the bottom right-to-left starting with 0 and ending with 5 is R-5.

The row starting from the top with pitch class 6 is I-6. The reverse of that row (starting at the bottom with 11) is RI-6.

(maxmsp) midi poly and audio poly~

As indicated, this is a scaled-down post so that you have the demo patchers from class.

To use the PolyAudioDemo.maxpat you also need to download SimpleSynthKeith~.maxpat and place both patchers in the same folder.

Highlights

The poly object

The poly object takes incoming noteon and noteoff messages (note number and velocity), tracks them so as to allocate across multiple voices, and makes sure that corresponding noteon and noteoff messages go to the same voice. The incoming note number and velocity messages are tagged and outputted with a voice allocation number. Output = 1 60 127, where 1 is voice number 1 in a polyphonic synth, 60 is the note number for middle C, and 127 is the velocity.

Voice allocated noteon and noteoff messages are sent to a poly~ object that has a synthesizer subpatcher.

poly must specify the number of polyphonic voices to track, and whether to institute voice stealing (non-zero third argument).

The poly~ object

The audio poly~ object requires a patcher that has been designed to accept incoming messages from a parent patcher. It also requires an argument to set the number of polyphonic voices to play, which should correspond to the same number in poly.

Note messages should be sent to a free voice by using the voice allocation number assigned by poly. The message target $1, $2 $3 says to route items 2 and 3 from an incoming list to the voice number (instance of subpatcher) specified as the first item in the list. The formatting of the message is very important — watch out for the comma.

Preset selection messages should go to all instances of the subpatchers (usually), so the message target 0, $1 is used. If the target is 0, the subsequent message is sent to all instances.

The audio subpatcher: SimpleSynthKeith~maxpat

SimpleSynthKeith~.maxpat, and any subpatcher you would load into poly~, must be saved in the either Max’s search path, or saved  in the same folder as the parent patcher. Rookie mistake: trying to load a subpatcher without first saving the parent patcher.

SimpleSynthKeith~ has two gates: one to toggle MIDI input on and off within itself, and one to turn on/off sending of audio output to the dac~. When loaded as a subpatcher of poly~ these gates should be turned off. MIDI input and audio output are handled in the parent patcher. When you open SimpleSynthKeith~ as a standalone patcher, turn on the gates so that you can play and hear the patcher. This feature is useful for trying out different parameters and saving them as presets in SimpleSynth. You can them recall them from the parent patcher.

(maxmsp) delay (and degrade) demo patcher

My delay demo patcher is finally uploaded. It also includes a little section with a degrade~ object. I’m only doing bit reduction with the degrade~ object.

(musTh 212) Pitch Class Sets, Set Classes and Prime Forms

set class contains all the pitch-class sets (in normal order) that are related by transposition, and all the transpositions of the inversion of the set. For example, start with the randomly chosen set, [9,1,2]. The first twelve sets show all the transpositions of [9,1,2].

[9,1,2]
[10,2,3]
[11,3,4]
[0,4,5]
[1,5,6]
[2,6,7]
[3,7,8]
[4,8,9]
[5,9,10]
[6,10,11]
[7,11,0]
[8,0,1]

Now you add all the transpositions of the previous twelve sets.

[2,3,7]
[3,4,8]
[4,5,9]
[5,6,10]
[6,7,11]
[7,8,0]
[8,9,1]
[9,10,2]
[10,11,3]
[11,0,4]
[0,1,5]
[1,2,6]

The twelve transpositions and the twelve transpositions of the inversion form a single set class. We refer to a set class by its Prime Form. The prime form a set always starts on pitch class 0, and travels clockwise or counter-clockwise around the clock face by virtue of which direction is the most compressed and compact. In the above case, the inversion [0,1,5] is more compact than [0,4,5], so [0,1,5] is the prime form of this set class.

Prime forms are usually written in parentheses, without commas. In this system, use “t” and “e” for 10 and 11. Using this system, the prime form of the above set class would be written (015). Using this system we can distinguish between a specific pitch-class set as it appears in a piece of music and the set class to which it belongs.

(musTh 212) Pitch Class Sets, Transposition and Inversion

Transposition

Transposition of pitch-class sets is by ordered pitch-class interval. Before going any further, consider the implications of that first statement.

  • Transposition is by pitch class, which means that a transposition could contain octave displacements and still be a transposition.
  • Transposition is by ordered pitch-class interval, which means that we always count the transposition distance in a positive direction and the distance will be 11 or less.

Given a pitch-class set in normal form, the transposition number is the pitch-class interval that must be added to all the pitch classes to obtain the second set. If [5,7,8,11] is our starting set, then T8* is [5+8, 7+8, 8+8, 11+8] giving [13, 15, 16, 19], which reduces to [1,2,4,7].

*8 should be in sub-script, as should all transposition numbers.

Make sure to keep in mind that the transposition number is not the same as an integer representing a pitch class. The transposition number represents the relationship between two sets.

Inversion

Inverting a pitch-class set simply involves reversing the succession of ordered pitch intervals in a set. If you have the set [4,5,8], the order of pitch intervals is +1, +3. If you start of pitch class 8, the resulting inversion is [8, 11, 0], with the order of intervals +3, +1. You could also start the inversion of pitch class 4, resulting in [4,7,8].

You might have already noticed that [8,11,0] is T4 of [4,7,8]. Properly labeling inversions means that you have to also label the transposition number. T0I is obtained by inverting pitch classes around 12 (0). Subtract each pitch class in the first set by 12 to get the pitch class of the inversion.

[4,5,8] = [12-4, 12-5, 12-8] = T0I=[8, 7, 4]

The pitch classes need to be reversed after this procedure to obtain normal form. [4,7,8] You can also perform your inversion step in reverse on the original pitch class ((12 – 8, 12 – 5, 12 – 4)) and you will won’t have to reverse the inverted set.

If you are given two pitch class sets that are related by inversion you can calculate the transposition number by adding their corresponding elements. Remember that corresponding elements of inverted pitch-class sets are in reverse order. Given [4,5,8] and [8,11,0], you obtain the transposition number by adding 4 and 0, 5 and 11, and 8 and 8. Each pair adds up to interval 4, so the two sets are related by T4I.

(musTh 212) Listening/Look – Atonal Music

We’re going to focus on three (freely) atonal works for class discussion. You should listen to all three with the score. Your goal is to gain overall familiarity with the work. Try to discover if there are repeating gestures that suggest importance, musical contrasts that suggest sections, and an overall formal grouping for each work. In class we will talk about how the works are organized with regards to pitch class sets. You will need to listen to each piece more than once outside of class. Like before, these works will be fair game to ask about on tests and the final exam.

  • Schoenberg, No. 1 of Three Piano Pieces, op. 11 (pp. 460 – 463)
  • Varese, Octandre, Mov’t I (pp. 516 – 520)
  • Carter, Fratibute (pp. 554 – 556)

 

(musTh 212) Pitch Class Sets, Normal Form

We will continue to talk about this on Friday, but what follows are the rules for arranging pitch classes into a set in normal form.

The first thing to do with a collection of pitches, a pitch-class set, is to arrange the pitch classes into a form that can be used to compare one set to another. The first order of arrangement is Normal Form, which arranges the pitch classes in ascending order, starting with the pitch class that gives the most compact and compressed arrangement.

Let’s use the pitch classes C, G#, B, E, and A.

  1. First, convert the pitch classes into integer notation, excluding any pitch-class doublings. (giving you 0,8,11,4,9)
  2. Order the pitch classes into ascending order within an octave.
    0,4,8,9,11 is one possible order
  3. Find the rotation that has the smallest interval from first to last pitch class.
    0,4,8,9,11 = 11
    4,8,9,11,0 = 8
    8,9,11,0,4 = 8
    9,11,0,4,8 = 11
    11,0,4,8,9 = 10
    Five pitch classes will give your five possible rotations. In this case, there is a tie between 4,8,9,11,0 and 8,9,11,0,4 (both at 8).
  4. If there is a tie with rule 3, compare the interval size from first pc to next-to-last pitch class. (If there is a tie, keep moving left and comparing.)
    4,8,9,11,0: 4 to 11 = 7
    8,9,11,0,4: 8 to 0 = 4 (smallest!)
  5. If there is a tie with rule 4, start with the smallest pc integer number. For example, comparing augmented triads will always yield ties through rule 4. If you have 1,5,9 you should start with 1.

From our rules above, the normal form of the collection is [8,9,11,0,4], which you will always write with brackets surrounding the pitch-class numbers.