Sine Wave Modulation in Max for Live

As any audio engineer will tell you these days, automation in a Digital Audio Workstation is the greatest thing since sliced bread. Back in the old days, on an analog SSL console you would have to rid  

As any audio engineer will tell you these days, automation in a Digital Audio Workstation is the greatest thing since sliced bread. Back in the old days, on an analog SSL console you would have to ride the faders on a track to do volume swells and to add splashes of reverb sends. In the '70's when Bob Moog dispensed with selling Theremin kits and started manufacturing filters and oscillators, it became possible to modulate a parameter with control voltage. Morton Subotnick took this one step further with the Buchla sequencers shortly after, again using control voltage, and an era of automatic music composition took form.

I do believe that Max for Live is the first use case with it's ability to emulate voltage control for any parameter in a Digital Audio Workstation. I have tested this out for myself in the hopes of continuing my idea of a sine wave song and I am pleased to report that it is in fact possible to accomplish this non-trivial task!

After abandoning the idea of using the live.remote~ object in Max for Live, as it was much too processor intensive, I began experimenting with the counter object in Max to count from 0 to 127 (the range of midi) in an up and down way. Although this method more closely resembles a triangle wave than a sine wave, the result is conclusive evidence that any parameter that is modulatable in Ableton Live is a candidate for virtual voltage control.

For those interested in implementing a true sine wave as the source for modulating a parameter, there are new updates for Max that allow for the limitation of data density as a workaround for the existing dilemma of processor usage escalating to over 1000% when using the live.remote~ object.  This is exactly the problem that i was experiencing when trying to hook up a sine wave control signal to a volume parameter in my own synthesizer consisting of four sine waves in Max for Live. On the Cycling 74 forums, a very helpful developer pointed me to some update information new to Max in 5.1.5, with the change log as follows:

-parameters: new attribute to toggle deferral of automation and remote control output to the GUI thread; off by default, this attribute can be used to reduce the frequency of value changes resulting from automation and significantly reduce processor load. In combination with the new parameter_speedlim attribute, device developers now have fairly comprehensive control over the automation of their parameters.

This is great news! I will test this procedure in the future and report results back in a subsequent article related to this sine wave song project. You can see in Figure 1 that is is possible to generate perfectly smooth automation for a parameter in Live without having to do it by hand anymore.

Figure 1: automation generated by a custom max for live patch (via the counter object)

Furthermore, you can build on this theme by modulating the modulation, making for a more interesting shape, a slower sine wave changing the frequency of the regularly spaced sine wave over time, see Figure 2:

Figure 2: a slower sine wave at the bottom shaping the target sine wave

Dispensing with a high level description of parameter modulation and its attributes, let's examine in detail each component in the Max patch that causes this to happen. If you take a look at Figure 3, from the top right we have a button labeled mod on/off, this either checks or un-checks the toggle box marked with an "x" below it (x stands for "on"', technically a 1). This sends a flag to the metro, (metronome) objects beneath it which are set to trigger at 12 and 750 milliseconds, respectively. This sends out a "bang" to let the counter object know to update its total count, with the 2 meaning "go up and down" from the subsequent pair of numbers, indicating Min. and Max. range. So the counter counts from the Min. to the Max. at the rate determined by the metro and back down again over and over.

The numbers beneath the metro report the current count, and send the data to the knobs labeled volume and rate. There is a scale object in between the counter on the left and the knob on the left. This takes data from a wider range and scales it into a narrower range. This is because I wanted the volume not to get too quiet per cycle. The volume knob will fluctuate at the constant rate determined by the metro on the left, set to 12 ms, and this gives us the regularly shaped signal from Figure 1. However, to get the more interesting changing shape from Figure 2, I sent the output of rate to the right inlet of the metro on the left, the metro 12. This will make the metro 12 change at a rate specified by the rate knob's current value instead of 12 ms (the default argument that I had set initially). The rate knob cycles in its own unique rate, in this case 750 ms, or three-quarters of a second. By the same token you could create a third knob to change that sine wave into an even more complex shape, like an overall volume change fading in and out over the course of the song, facilitated by this process of adding new controls with unique rates in a chain. This would make for an interesting performance situation where you could specify these rates with knobs based on your creativity. That is the beauty of this new technology with Max for Live, it is performance meets composition!

Figure 3: a custom sine wave generator, providing both sound and control signals

Although Figure 3 may seem a little messy and complicated, it really is only made up of 2 major sections. The section at the top right is for the control signals, which I did have to create from individual objects such as metros and number boxes, counters and buttons. However, the lower left portion is something that I just copied from one of the tutorials which explained polyphony. I dropped a blank Max for Live instrument on a midi patch and hooked up the portion consisting of the sound generation aspects of the tutorial patch to the midi in and audio out of Ableton Live. The sound is coming from line segments that describe waveforms. I will update the patch so that the line segments become true sine waves, in keeping with the theme of serialized composition techniques. You can see that some of the patch cords that connect the objects in the Max patch look a little different in Figure 3. One kind is a solid line and one is striped yellow and black line. The solid black lines represent messages like data updates, and the striped patch cords represent audio rate signals. The solid black lines are analogous to virtual midi cables, in that you cannot send audio over a midi cable, but you can send data. The data must travel at a slower rate, something around the order of 9600 kilobaud, or 9600 kilobits per second. Audio rate signals are usually in the range of 44,100 samples per second per channel, equivalent to about 1480 kbps. It is exactly this reason that we are not using a signal cable to modulate our knob via a sine wave,  it is way too much data for our computer to handle. This is because the audio doesn't have to be just shuffled out of a sound card, it needs to be looked at and processed by the application according to each and every instruction per sample of audio that is being changed, and then the audio still has to be delivered in near-real time.

Max has a wonderful feature called Presentation Mode, which allows you to select choice components in your patch to show and then you can hide the rest. The most important parameters here were just the volume knob and the output level, as illustrated in Figure 4.

Figure 4: a deceptively simple max for live instrument using very basic sine waves

Hopefully, this puts an interesting spin on digital audio being processed, in turn, by digital audio. Once the limitations are set, we can use digital logic to take the tradition of analog synthesis even further with the flexibility of digital synthesis in a fully featured Digital Audio Workstation such as Ableton Live and the instruments that you can build for it with Max for Live.

You can get Ableton Live Tutorials here.

Andrew Turner, founder of Deep Life Records (deepliferecords.com ), has released music on N*Soul Records (LA, CA), PWM Records (Australia), Giant Squid (SD), subVariant (CHI, IL) and has remixed and produced tracks since Windows 95's plug-n-play feature was all the rage. His new project under the alias JahWarrior is inspired by t... Read More

Discussion

Want to join the discussion?

Create an account or login to get started!