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.

Also place a Mathematical Expression patch. This patch allows one to enter a… mathematical expression, aka a math formula, to control a parameter.

Using the patch inspector, edit its formula to:

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.

Now place an Iterator patch in the graph, and select both the sprite and the math patches:

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:

Publish the W input port by right clicking the patch and selecting the “publish input” option from the list. When asked for a name, simply enter “W”.

Do the same with the H and IterationX ports. Publishing these input ports will allow us to access them from an upper level of the graph.

Go to the _Root level by clicking the Edit Parent icon :

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.

You should be in _Level1 at the moment.
Again, add an Iterator Variables patch, connect its Iterations port to the IterationX port. Publish the W and H port as well:

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:

Normally, your viewer should look like this:

Publish the Iterations input port and name it SizeX:

Go to _Level1 and publish the Iterations input port, name it SizeY:

Go to _Level2 (where the sprite is) and insert and Input Splitter on port W, by right clicking the patch/”insert input splitter”. Do the same for IterationX.

Add a Mathematical Expression patch and change its formula to:

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 connect the W and size ports:

Publish the Index port (so that we can access it from _Level1):

Go to _Level1 and connect the Current Index port to the newly published Index port:

Now your viewer should look like this, as we just iterated the sprite on the X axis:

Go to _Level2 and add another Mathematical Expression patch. Edit its formula to:

Insert an Input Splitter on H, and connect …. H to H, size to size and the Current Index to Index:

Congratulations ! We’ve just nested two Iterators to make a 2d array of sprites ! Your viewer should look like this:

————
Now it is time to add some color and link the Sprite Array to the Sound input.

Go to _Level2, and add a HSL Color patch. This patch will generate a Color based on the Hue/Saturation/Luminosity value. Connect its Color output to the Color input of the Sprite:

Edit the L value to 0.5 (1.0 being plain white):

Add a Mathematical Expression patch and edit its formula to:

Connect the Current Index to Index, Iterations to Iterations:

Your viewer should look much nicer, like this:

—-
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:

We now have some separation lines, and the viewer should look like this:

—–

Now we’ll add the Sound Input, which is the interesting part, because it will animated our composition according to the Sound.

Go to _Root level, and add an audio Input patch, which is purple, being a Data provider:

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 Audio * Iterations * Multiplier. Connect the Iterations to Iterations, and publish both the Audio and Multiplier inputs:

Go to _Level1, connect the Structure Member output port to Audio, and publish the Multiplier input port:

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:

Go back to the _Root level, slightly modify the Audio Input increasing/decreasing scale. This will tweak the sensibility of the Audio input:

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:

If you change the sizeX and sizeY parameters, your comp. should update all the dimensions:

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”:

Go to the _Root level, set the sizeX and sizeY to 6.
Add a Syphon Server patch.

Change the Syphon Sever name to EQ, and publish the whole openGL scene:

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 go the Menu / Views / Change Output Background, and load up a nice concrete building picture:

Go to the Media tab (first one) and double click the listed QuartzComposer-EQ (which should appear under the Syphon section of available inputs):

Go to the surface tab, and add a Quad primitive. Crop the quad texture to the bottom left rectangle of the media:

Maximize the output Preview, change the Quad’s opacity to 50% so that we actually see where we’re editing the Quad. Now position it on an interesting feature of the building, on the lower left part:

Going vertically, duplicate the Quad and fit each copy on an interesting architectural feature:

Go to the Input View and reposition each quad’s texture on a vertical column:

Back to the Output Preview, select the whole column, duplicate it and fit again some interesting features:

Select all the Quads from the newly created column:

Switch to the Input View, and offset the whole column of selected quads at once, to the right:

Switch to the Output Preview, select the first column of quads, and in the named selection list, name them 1. This will create a select group that you can recall later on, if needed:

Select the second column and name it 2:

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

Eventually make some masks when needed:



When finished repeating the procedure, you setup should look like this:

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:

36 Responses to “MadMapper tutorial | Turn a building into a giant Equalizer”

  1. This is a great tut.

  2. idlefon Says:

    Brilliant!

    One question: Is it possible to use more than 1 syphon sources simultaneously? For instance you want to use a certain Image and its blurred version together.

    • Francois Wunschel Says:

      you can by compositing 2 Syphon sources in QC and outputting to a third Syphon server.

  3. Great tutorial, I think a lot of folks will love this one !

  4. Joerg Says:

    sooo great !!!!
    Thank you so much for all these indepth Tutorials you guys out up!

    It is amazing and by not limiting the tutorials to the MadMapper side, you enable us (at least me) to really make use of MadMapper and its creative potential!

    Thank you !!!

  5. extraordinary!

  6. Aweome tuts! Shhhpanks!

  7. Muchas gracias.

  8. Fascinating shape, design and colours!

  9. [...] Tutorial MadMapper VII : Turn a Building into a equalizer Publicado: julio 14, 2011 | Autor: ibox | Archivado en: Soft | Deja un comentario » Este es el séptimo Tutorial de la serie MadMapper, he ido traduciendo los anteriores Tutoriales pero en esta ocasión por falta de tiempo no puedo dedicarme a traducirlo. Espero tener tiempo más adelante para traducir este tutorial y el de Max msp. De todas maneras lo cuelgo para ir haciendo marcha. Copio y pego desde 1024 [...]

  10. énorme !!!

    Merci pour le tutorial

  11. great work, Is there a way to have a download link ?

    I dont find the link MadMapper_EQ_Building.zip

    thanxs

  12. [...] follow Madmapper+QC  tutorial, take it from HERE , to create a mini equalizer with the shapes of my [...]

  13. awsome! thanks

  14. I’m not sure how to: …”Also publish the Source Index up to the _Root level … “. I made it this far but can’t see how to publish a port to a specific level

    Thanks for the tutorial

    • Francois Wunschel Says:

      publish the index, go up one level, publish again … and so on till the root level

  15. which patch’s index to publish on _Level1?
    Thanks and sorry for asking QC rookie questions

  16. great work, Is there a way to have a download link ?

    I dont find the link MadMapper_EQ_Building.zip

  17. Cheers from Brazil man! great tutorial! i just would like to know why the EQ doesn’t show on the mad mapper syphon, i tryed everything, i donwloaded the syphon and instaled on the quartz composer patch folder, but i cant find the problem. The composition it is exactly the same step by step, can you please help me? thanks

    • Francois Wunschel Says:

      be sure to set the syphon patch to send the whole openGL scene. by default it is setup to send a plugged image.
      if it still doesn’t work, send me your comp.

  18. [...] Read the full how-to: MadMapper tutorial | Turn a building into a giant Equalizer [...]

  19. Great tutorial to remember our quartz foundation!

  20. great tutorial, really should try this out!

  21. [...] perspective of the pico projector I’d be using. I dropped this into MadMapper and followed 1024′s tutorial for mapping the many surfaces. I had gone through the tutorial once before, but not with a physical [...]

  22. [...] / objects / spare wall spaces etc. The Madmapper folk have been releasing an inspiring set of very detailed tutorials too, as well as pretty useful [...]

  23. Great great tutorial…thanks…
    I really like your work.. do you know, where can i follow more tutorials or workshops?…

  24. projekt…

    [...]MadMapper tutorial | Turn a building into a giant Equalizer « 1024 Architecture Blog / MadMapper, Video Mapping, Quartz Composer plugins, whatever …[...]…

  25. Hi there! I’m at work surfing around your blog from my new iphone! Just wanted to say I love reading your blog and look forward to all your posts! Keep up the excellent work!

  26. Hello everybody,
    i love this tutorial. But i don’t know why my qc project is flickering.
    At 60fps the output is flickering and no continious green/orange fields are displayed. I don’t know why. could someone tell me which input parameter to change to avoid this behaviour?
    Thank you so much.

    Andi

    here is my project implementation of the EQ:
    http://schallmag.net/wp-content/uploads/2014/03/MadMapper_EQ_Building401031-51319.qtz_.zip

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 663 other followers