MadMapper tutorial | Turn a building into a giant Equalizer
Hi, in this tutorial we’ll add some colors to our everyday concrete environment, by turning a building into a giant equalizer.
The final mapping will look like this, animated in realtime according to the sound input of your computer:
We’ll use QuartzComposer and MadMapper together.
This tutorial is quite long, so I recommend go through the basic MadMapper and QC tutorials first.
First, we’ll need MadMapper. If you don’t have it, get a demo from:MadMapper.com
Then, we’ll need the Syphon plugin for quartz Composer, that will allow us to send video frames from QC to MM. If you don’t have it already, please visit Syphon site, download the plugin and install it. Here’s a direct link: Syphon installer
To achieve our EQ, we’ll make an extensive use of QC’s iterator, in order to make a fully parametric and dynamic EQ.
There are two ways of working with iterators. Either by starting the graph flow from the data provider (pink patches) or from the data renderer (blue patch). Everything in between is just data processing (grey patches).
To keep this tutorial as clear and simple as possible, I’ve taken the Renderer approach, going from the Render patch and flowing up to the Data provider patch. As always, everything is possible with QC, and there are many ways of achieving the same result.
So now that we have everything ready, let’s open up QC and make a new composition.
Place a Clear patch and a Sprite patch at the root level (abrv. _Root).
Note that the patches are blue, meaning they are Renderer patches.
We want the size of our sprite to be defined by the viewer’s width, divided by the total amount of iterations. It means that when we’ll change the size of our view, or when we’ll change the number of times the sprite is rendered, all the dimensions will update accordingly.
Do the same with the Height, and connect both patches to the Width and Height input port of the sprite.
Cut the maths patches and the sprite (Command-X), double click the Iterator to go inside its level, and paste back the patches (Command-V). Now add an Iterator Variables patch, and connect its Iterations port to the IterationY port:
You’re now at the _Root level of the graph.
The iterator we used will copy the sprite on the Y axis.
We also want to copy the sprite on the X axis. So add a new Iterator, select the blue iterator (first one created):
Cut the blue iterator (first one created) using Command-X. Go inside the grey iterator (second one created) and paste back the first iterator using Command-V. We now have nested two iterators, one in another.
A little terminology: the root level of the composition will be called _Root, the first iterator (2nd created) level will be called _Level1 and the second iterator (first created, the deeper in the graph) level will be called _Level2.
Go to _Root level. Note that the Iterator has changed its color from Grey to Blue, because it contains a renderer patch. Add a Rendering Destination Dimensions patch, and connect its Width and Height output port to the W and H input ports, respectively.
This will ensure that whenever the dimensions of the viewer will be changed, the dimensions of the iterated sprites will be updated:
Explanation: we want the X position of the sprite to be minus Width/2 (== the left corner), plus one half of the size of the sprite, plus the number of iterated sprite multiplied the by their respective size.
Now it is time to add some color and link the Sprite Array to the Sound input.
Now that we’re done with the colors, we need to add some vertical separation lines, in order to see what we’re mapping with MadMapper.
Go to _Level1, add a Line patch, and modify its StartPositionY/EndPositionY to -2/2:
Insert an input splitter on W.
Add a Mathematical Expression patch (again !) and set its formula to W/IterationX.
Connect W to … W and Iterations to IterationX.
Add yet another Mathematical Expression patch, set its formula to -W/2 + size*index.
Connect W to W, the previous math patch’result to size and the Current Index to Index:
Now we’ll add the Sound Input, which is the interesting part, because it will animated our composition according to the Sound.
This patch outputs both the volume peaks and the Spectrum of the sound (FFT’ed data).
The Audio Spectrum data is in fact a Structure, an array of data (16 bands).
Go to _Level1 and add a Mathematical Expression patch, set its formula to index+3. Connect the Current index to Index.
Also add a Structure Index patch, and plug the result output port of the previous math patch to its index input port. Publish the Structure input port as well:
Go to _Level2 and add a Mathematical Expression patch. Set its formula to AudioFinal > Index. Connect the result port to AudioFinal, and the Current Index to Index. Finally, connect the result of the expression to the Enable port of the Sprite.
This will enable the Sprite if the audio signal is superior to the index value of the iterator:
Later on you can fiddle again these parameters to fine tune the sensibility.
Also publish the Multiplier input port.
Now connect the Spectrum output to the Structure input, and set the Multiplier to 10 or something:
Almost done ! Now play some music and your viewer should react like an equalizer !
If not, use the Inspector to set the Audio Input source to the built-in microphone.
The viewer should look like this:
To be able to map things correctly in MadMapper, we need a way to switch between the audio-reactive mode and a plain full mode, where everything is displayed.
So go to _Level2, and add a Multiplexer patch, set its input to a Boolean mode.
set its Source#0 port to TRUE, plug the audio result to Source#1 and its output to the Enable port of the Sprite. Also publish the Source Index up to the _Root level and give it a nice name, such as “AudioOn”:
Hooray ! Yeepee ! We’re done with the QC part of this tutorial. Congratulations if you’re still here !.
Ultimately, switch the AudioOn to 0, resulting in a full EQ, not reacting to sound.
Leave the QC comp running, eventually save it if you haven’t done so yet, make your viewer size to 4:3 ratio and open up MadMapper.
In MadMapper, go to the Master tab (the last one), and Force the Media Ratio to 4:3.
This will ensure that even if the QC viewer ratio has changed by accident, we won’t loose our mapping settings, as MadMapper will normalize the Syphon input:
Now keep on the same procedure for the rest of the building:
- duplicate a column
- name it
- fit the architectural features
- offset the texture cropping
Now you can select all the quads, and set their opacity to 100%.
Go back to QC and switch to AudioOn. Play some music and the building will start animating like an Equalizer !
Congratulations, you’ve done it !
You can download the finished project files here (the file is named MadMapper_EQ_Building.zip).
I hope you found this tutorial useful.
Here’s a little video showing the finished setup, animated on the sound: