Exercise E

Exercise E: External Triggering of Sound in Max

We can use all sorts of external hardware to control sound generation in Max. There are two main aspects of this endeavor:

  1. the mechanics of connecting a device and accessing its data in real time, and
  2. the musical application of the data — how we map the data to the parameters that control sound generation.

An unusual aspect of controlling sound generation using devices that are not recognizable musical instruments is that there is no fixed association between actions taken on a device and the sound produced by them. The freedom this allows can be liberating, but we always want the actions taken on the device to be musically convincing.

In this exercise, we practice the mechanics of connecting devices to Max and playing sound files using them. While we do this, we will think about which mappings (of data to parameters) make the most musical sense.

Goals

We’re learning how to...

  • play sound files in Max,
  • use the computer keyboard and MIDI note input to trigger sound file playback,
  • access data from USB game controllers (HID devices), and
  • handle playback durations known in advance or only during playback.

How to Do This Exercise

Working on the assignment is a two-stage process.

  1. Download Exercise E Max Tips. This folder of Max patches shows you how to use external hardware to trigger sound files. Open them in Max in order (part 1, then part 2, etc.), reading the comments and operating the patches.
  2. Make a patch that plays sound files when you press buttons on either a Logitech F310 gamepad, a Logitech Extreme 3D Pro joystick, or a Novation Launchpad. You can find these devices in MC 304. Be ready to demonstrate your patch in tutorial by doing something musical with it.

See the Requirements and Suggestions section below for details.

Be sure you understand what each of these Max objects does:

  • playlist~
  • key, keyup
  • select (sel), route
  • notein, stripnote
  • delay (del)
  • hi, umenu

Requirements and Suggestions

  • The first step in using external hardware is to connect to it and make sure Max is receiving data. This is fairly straightforward with MIDI but can be challenging with HID devices.
  • Follow this procedure to get the Logitech F310 working in Max. (Note that this may not work in Windows.)
    1. Before plugging in the F310, be sure the switch on the bottom of the device is set to “D,” not “X.”
    2. Plug the USB connector of the F310 into a USB jack on the computer or on a USB hub.
    3. Press the “Logitech” button on top of the F310, holding it down for at least two seconds.
    4. Press the MODE button on top of the F310. You should see a green LED light up next to the button. If this doesn’t happen, the computer is not recognizing the F310.

      Press the MODE button again, so that the green LED no longer shines. (The MODE button swaps the left joystick with the left “D-pad.”)

    5. Launch Max, and choose HI Tester from the Extras menu. Choose “Logitech Dual Action” from the menu at the top of the HI Tester window, and press the Polling button next to the menu.
    6. Operate controls on the device, and be sure that data shows up in the HI Tester window. “Element” in this window is called “ID number” in the ExE Max Tips Part 4 patch.
  • The procedure for the Logitech joystick is similar, though a bit less complicated. (Skip steps 1, 3, and 4.)
  • Study the Max Tips patches for this week, and set up your Max code to recognize whatever data your hardware device is emitting.
  • Playing a sound file in response to a button press on a game controller — or a pad press on a MIDI grid controller, such as the Launchpad — means converting an incoming button value into a cue number for playlist~.

    In the case of most HID buttons, no conversion is necessary, as these values are often 1 and 0, and these will start and stop playback of the first (and maybe only) cue in a playlist~.

    When it is necessary to convert the data, you can do this by matching incoming data values using the select object and then sending a bang from the appropriate outlet of select to a message box containing the number 1, which can play a cue in playlist~.

  • Decide whether you want to control the duration of a sound in real time, so that your action stops, as well as starts, playback. (This is easy for HID buttons that send 1 when pressed and 0 when released.) Or you can treat the button press as a trigger for a fixed duration, and ignore the button release value. A fixed duration can be simply the full length of the sound file, a selected duration within the playlist~ waveform display, or the time difference between the playback start time and a duration given as an argument to a delay object.
  • If you like, you may use any continuous controls available on your chosen device, such as the joysticks on the two Logitech devices. (There are no continuous controls on a Launchpad.) Map the input range to your desired output range using scale.
  • Feel free to add Auzzie effects to your patch, though this is not required.

Submission

  • Be sure you satisfied the criteria listed above.
  • Submit your Max patch in Canvas.

Grading Criteria

This exercise is graded pass/fail. You must submit the exercise by Thursday midnight to be eligible for a pass.

Your patch must

  • operate correctly and
  • implement the functionality described in the “How To Do This Exercise” section above.