Transport-based tempo-relative timing in Max allows you to specify any rhythmic value. The musical time value syntax allows you to specify duple divisions (1n, 2n, 4n, 8n, 16n, 32n), dotted notes (2nd, 4nd, 8nd, etc.), and triplets (2nt, 4nt, 8nt, etc.).
You can use a MIDI "program change" message to tell a synthesizer to change to a different sound. The Max object for that is pgmout.
In the MIDI specification, and in most DAW software, and in Max, the smallest unit of metric timing is expressed in "ticks", which is to say, partial units of a beat. Commonly the number of ticks used is 480 or 960 parts per quarter note. That number makes sense because it's divisible by 2, 3, 4, or 5 (and multiples of those).
This patch shows a simple use of a transport-governed metronome to trigger events at a constant rate. The metro object that has the argument '4n' will be governed by the transport because its interval is specified in a tempo-relative, music-based "note values" format. (Just for the sake of comparison, the patch includes another metro that is unaffected by the transport because its interval is specified in milliseconds.) The transport-governed metro will only run when the transport is on.
This patch demonstrates several capabilities, features, and techniques of the transport object for managing tempo-relative time, the translate object for converting between tempo-relative time and absolute time values, and the timing objects that can use tempo-relative timing such as metro, delay, timepoint, phasor~, and line~.
To achieve delays that are quantized to a named transport, use a combination of pipe (delay numbers by the desired amount), translate (to set the pipe to the desired delay time), zl group (hold onto numbers as they come out of the pipe) and metro (following a particular named transport and quantized to the time unit you want).
In order for this patch to work properly, you'll need to first download the attached .zip archive of six short soundfiles, uncompress it, and put the sound files in the Max search path.
You'll also need to download the patch from the example Subpatch for paying sound cues from sflist~. Save it with the name "playsamples.maxpat" in the Max file search path.
To schedule timepoints in straight clock time, it’s easy enough to do, and if I want transport to report the current time to me in straight clock time, that’s easy enough to do, too. In the following example, when you start the transport with the toggle, it rewinds to time 0 and schedules a timepoint to occur at time 5.5 seconds. By default the transport’s tempo is 120 bpm, so we would expect that timepoint to happen 11 beats later, i.e., after 5280 ticks, i.e.
The examples above show two different ways that you can trigger sound files while keeping in sync with a particular beat when the durations of the sound files are not perfect multiples of the beat duration, hence triggering the next sound file at the ending point of the current sound file results in the next sound file being started off the beat.