Tutorial

Using the Player Modules

Player modules create sound using either synthesis or existing soundfiles. A complete list of player modules, with descriptive annotations, is included with the toolbox. For this tutorial, we'll start by creating an FM synthesis player (FMBP) to synthesize a sound, and later add another player module to playback a soundfile (sfPlayerBP).

FM Player

bpatcher icon empty bpatcher bpatcher inspector FM bpatcher

Player modules receive a variety of messages controlling their behaviour; further, we can pass those messages in different ways. All player modules have certain behaviours in common - responding to messages that turn the module on, set its volume, and so on. Other behaviours are specific to some modules, such as selecting a preset, while still other messages are exclusive to a given module; in our case, a message to change the C:M ratio.

As previously mentioned, it is possible to pass messages to a player module in different ways, including from another Max/MSP patch, a qlist, or even another application, such as NoteAbilityPro. For simplicity, we'll use a message box.

FM bpatcher message pre

Note the current state of the FMBP module, specifically the "On/Off" switch, the volume slider, the preset, and the "C:M Ratio" dial and number box.

Clicking on the message box sends its text to the FMBP module, resulting in changes to the aforementioned interface widgets followed by a brief sound (if you didn't hear anything, there is an issue with either your audio equipment, your operating system audio setup, your Max/MSP environment, your UBC Max/MSP/Jitter Toolbox installation, or the execution of this tutorial).

FM bpatcher message post

Examining the message text in detail, we find that a group of four messages was sent - the first turned the FMBP module on, the second set its volume to 63, and the third selected preset 3. The last message is more complex - it is the Note Data List, a data structure used throughout the UBC Max/MSP/Jitter Toolbox.

Soundfile Player

Adding a player module to our patcher to playback a soundfile is a somewhat different process than that of creating a player module that uses synthesis, though the initial steps are the same.

FM bpatcher soundfile bpatcher

The sfPlayerBP module requires information about the soundfiles it plays, specifically their numbers, durations, buffer names, and filenames. By default, a soundfile's number is the MIDI number modulo 48 in an incoming Note Data List that triggers performance of that soundfile, and the buffer name is of the form "sn" where "n" is the MIDI number (again, modulo 48). It is possible to change this mapping of MIDI to soundfile numbers by altering the table "sfTable" belonging to the sfPlayerBP module, though we'll remain with the default.

sfdata FMBP sfPlayerBP pre Max

Prior to leaving this section, there are a couple of points to consider. Whenever the sfPlayerBP module receives a Note Data List with MIDI number 12, or its modulo 48 equivalents, it will perform this soundfile. (Quick modulo 48 refresher - it is the remainder of the equation 48 / MIDI number.) In other words, we could send the module these Note Data Lists instead, and the same soundfile would play:

Finally, it's important to observe that unlike the FMBP module, we sent a Note Data List directly to the Note Data input of the sfPlayerBP module. In the former case, we broadcast the Note Data List using the fmNote message; there is an equivalent message for sfPlayerBP, sfPlayerNote.