Most Popular


The EM Poll




browse back issues

The Max Factor

Jun 1, 2002 12:00 PM, By Gary S. Hall



         Subscribe in NewsGator Online   Subscribe in Bloglines
 

CURRENT NEWSSTAND ISSUE

Read the full Table of Contents for the issue on sale now! Click here

Subscribe for only $1.84 an issue!

Please tell us about yourself so we can better serve you. Click here to take our user survey.

MixBooks Logo
Life in the Fast Lane

This collection of St.CroixÕs columns was assembled during the two years following his death of cancer in May 2006. Included are many of his most-read columns, as well as personal notes, drawings and photographs.

Click for more books
EM Podcasts

Listen to these latest podcasts and more:
Bela Fleck on recording Jingle All the Way.Go

What's New: software and sound products. Go

eDeals Newsletter for Discounts on Gear

Get First Dibs on Hot Gear Discounts, Manufacturer Close-Outs and Job Opportunities when you sign up to receive eDeals E-newsletter, sent twice a month. Check out an issue get advertising info or subscribe

FIG. 12: This Patcher fragment converts a bpm value into a delay value corresponding to a 16th note at the designated tempo. The send Object allows this value to be conveniently routed to any number of destinations.

FIG. 12: This Patcher fragment converts a bpm value into a delay value corresponding to a 16th note at the designated tempo. The send Object allows this value to be conveniently routed to any number of destinations.

ADDING BEAT SYNC

So far we've managed to create a fairly well-behaved audio delay line with an uncluttered user interface. You're probably thinking that there must be more to life than this.

There is. The good news is that because we've built up our delay line from scratch, we understand it well, and we are in a position to customize it however we like. To fulfill my original wish list, the next thing we are going to add is a way to synchronize delays with a defined tempo. The simplest way to do that is to provide a means for entering a tempo value in beats per minute (bpm) and then change the entry of delay time so that delays are expressed as a number of defined units, such as 16th notes.

Entering a tempo value is easy; it's just a number box. The trick is to convert the bpm number to a value in milliseconds per unit of time (we will use the 16th note for this). This value is then fed to the delay line, which next multiplies it by the defined number of delay units to get the actual delay value in milliseconds, as required by the tapout~ Object.

Fig. 12 shows a Patcher fragment that lets the user enter a tempo in bpm and converts it into a delay value corresponding to a 16th note in 4/4 time. This fragment will be incorporated into our delayline Patcher to provide simple beat synchronization. Take a moment to look over the diagram and read the notes in this example, as some things happening there may not be completely obvious.

To calculate the value in milliseconds, first divide the number of milliseconds in a minute (60 times 1,000, or 60,000) by the bpm value entered by the user. To get the 16th-note value, divide the quarter-note result by four. We can achieve the same thing in fewer steps by using 15,000 (60,000 divided by 4) as the dividend.

In this case, the Max divide (“/”) Object doesn't quite work as we'd like it to, so we have to do a little bit of extra work. In the Max / Object, the left input accepts the dividend value, which in this case is fixed at 15,000. To make sure this value gets loaded on startup, a loadbang Object is connected to a message box containing the value 15,000, and this is connected to the / Object's left input.

FIG. 13: The delayline Patcher Object must be modified to calculate a final delay value from the 16th note value generated by the bpm master calculation and a multiple of that pulse entered by the user.

FIG. 13: The delayline Patcher Object must be modified to calculate a final delay value from the 16th note value generated by the bpm master calculation and a multiple of that pulse entered by the user.

The bpm value entered by the user becomes the divisor and is sent to the right-hand input of the / Object. However, in Max the computation of a value is triggered by the receipt of a number or a bang at the left input. We can enter values all day at the right input, but no new values for the output will be generated until we send a message to the left input. This is the function of the “button” Object, which is connected to the bpm entry box. When this Object receives any message, it generates a bang in response. The bang output is connected to the left input of the / Object, and that causes it to generate a new value whenever the user enters a new value for bpm.

If you've built this Patcher fragment from scratch, you may also have noticed that it doesn't work right away. That is because the value “15,000” is not actually transmitted until the Patcher is saved, closed, and reopened. You can get around that by locking the Patcher and clicking on the message box, which triggers it to send its message to the / Object. After that all entries of bpm will generate a new value in the number box connected to the output of the / Object.

The final output of this fragment is provided by the “send” Object. Send and “receive” Objects are among Max's great gifts to help keep your complex Patchers legible and maintainable. Send and receive Objects always have a name. Any message sent to the input of a send Object will be routed automatically to any receive Object that has the same name. That makes it easy to send a single message to multiple destinations. Because we plan to create multiple delay lines tied to the same tempo, it's appropriate to use the send and receive Objects.

FIG. 14: This is the complete delay line with beat sync  calculation. All Objects and patch cords have been unhidden to help in  tracing, and a single loadbang Object is used.

FIG. 14: This is the complete delay line with beat sync calculation. All Objects and patch cords have been unhidden to help in tracing, and a single loadbang Object is used.

Now that we've derived a time value corresponding to a 16th-note pulse, we need to modify our delayline Patcher to receive this value and calculate delay times as a multiple of it. Fig. 13 shows the Max code that does that, first as a fragment and then incorporated into our delayline Patcher Object. Fig. 14 shows the complete Patcher that includes the bpm delay setting as well as specification of delays as a number of 16th-note units.

FIG. 15: This version of the delay has been  further simplified by incorporating I/O and control  scaling into the delayline Patcher  Object. This makes it easy to create  additional delay  sections by copying and pasting.

FIG. 15: This version of the delay has been further simplified by incorporating I/O and control scaling into the delayline Patcher Object. This makes it easy to create additional delay sections by copying and pasting.

MULTIPLE MODULES

Although this seems like a lot of work just to get an audio delay line, now the real fun can begin. Thanks to the wonders of software, we can turn our single delay loop into any number of delays, all synchronized to a common tempo.

Before doing that, we need to simplify our Patcher a little more by moving some of the functions that remain outside the delayline Patcher Object inside, as shown in Fig. 15. By moving the audio I/O and scaling for the controls into the Patcher Object, we've made our main delay section compact and self-contained.

FIG. 16: To duplicate delay lines, unlock the Patcher, select all the Objects to be copied, and hit Command + D on the keyboard. It is usually necessary to do some initialization of parameters after duplication.

FIG. 16: To duplicate delay lines, unlock the Patcher, select all the Objects to be copied, and hit Command + D on the keyboard. It is usually necessary to do some initialization of parameters after duplication.

It now becomes quite easy for us to duplicate the delay section using standard Duplicate or Copy-and-Paste commands (see Fig. 16). All you have to do is unlock the Patcher, select all the items in the Delay 1 unit, and hit Command + D. The selected items are duplicated, and you can move them as a group and change the label as needed.

When you duplicate a group of Objects, they come up without any parameter values set, so it's necessary to go to the controls and set them to something useful. You also need to reenter the bpm value so that it gets transmitted to the new, duplicate module. After doing those things, Shift-click on the first button in the preset Object we added earlier to create a valid setup that will be loaded the next time the modified Patcher is opened.



Acceptable Use Policy
blog comments powered by Disqus

Get Copyright ClearanceWant to use this article? Click here for options!
© 2009 Penton Media, Inc.

Back to Top