Quartz composer is a great tool for audio visualization for two main reasons. First, it renders incredibly quickly and smoothly. Unlike processing, which i usually prefer for its flexibility, which would quickly start dropping frames if you try to create many of the effects Quartz Composer has. The second thing that makes it great for live performances is the fact that the script can be edited live while it is rendering. Most environments would require the script to be saved, recompiled, restarted to make any changes. This is also made easier by the very clear visual environment.

The drawback of course is there are only a limited number of predefined functions which can be used, but there is still some room for creativity. The program is still very new, so I have some hope for its future. Another drawback is it’s only for mac and only the newest operating systems (10.4, 10.5) at that, but if you have a mac, you’ve already got it. Check out my previous post on QC for more info on that.

In any case, let’s start with something simple.

For the most basic Audio Visualizer you will need just four or five patches. Like most QC compositions start with a clear patch. This will render a black background (or whatever color you choose in the settings or pass into the patch). To get audio create an “Audio Input” patch. To add patches open the patch creator window and either find what you need in the list or type it into the search bar. The last thing is some object to effect with this input, and any other patches to scale or interpret the audio signal into somehting more usable.

I created a sphere with the radius controlled by the audio. The math function scales the audio signal to a size which looks better, but is not necessary.

quartz composer simple audio visualizer

Notice the yellow numbers on the rendering patches. This indicated the layer. 1 is rendered first, then 2, and so on, so the clear patch should usually be on layer 1. The result of this patch is a white circle pulsing on a black background. Without any lighting set the sphere just renders a flat color.

So that’s all well and good, but only one object is moving with the peak audio. Not so exciting. The Audio input patch also has another output which breaks the audio down into a series of frequency bands. This output has to be dealt with a little differently. The input has 16 band. Want to change that? You can’t yet. I’m sorry too.

From the spectrum output connect the audio input to a “Structure Index Member” patch. Change the index within the patch parameters or connect a number input to select which of the bands will be output. The output from that can then be used to control something else as usual. You might have noticed that this might take a lot of patches to get all the different spectrum bands. The result might look a little like this.

quartz composer complex audio visualizer

That will get the job done, but it’s easier to use the Iterator patch. This acts like a for loop, essentially “for each value in this structure (the audio spectrum), do this.” The “this” could be whatever you want, I’ll stick with a sphere to keep things simple. Create a clear patch and an iterator. The Iterator is a Macro Patch, meaning it contains other patches within it. To view it’s contents double click on it. There is a breadcrumb trail in the upper right of the editor window so you can see you are within a Macro Patch. Within the Iterator, recreate the first example, but without the clear patch. Also add a Structure Index Member and an Iterator Variables patch. This will tell it to get the next value each time the iterator loops. Otherwise it would use the same value each time. I also modify the x-position of each sphere based on a scaled interpretation of the Iteration Variable. Otherwise they would all overlap.

This is the most basic structure to create an audio visualizer with Quartz Composer. By using the data to control different parameters of different objects and adding filters and other effects a lot can be achieved.


2 comments

  • john harrison
    12.17.08

    can you make quartz composer visualizers for iTunes under OS X 10.4? I thought that you had to have 10.5 to do the visualizers.


  • tony
    12.17.08

    You can certainly use the audio input, although it has a few less spectrum bands. 10.5 has a visualizer template. I have not yet tried creating a visualizer for iTunes with with the new version, but I tried and was unable to do it with 10.4. For live visualizations within quartz composer or exported as quicktime files, either version works just fine.