Part 2
The Audio Spectrum patch is where the main visualization of the graphics is produced.
If you double click upon that patch it will open up to reveal its contents.
The Structure Splitter receives the Audio Spectrum data as a structure of 16 frequency bands.
That structure is fed to a structure count patch and into a JavaScript patch.
The count of the structure is sent to the
Iterations input on the Iterator macro patch.
The output of the Smooth Spectrum JavaScript goes into the structure
input on the Iterator macro patch
.
The Iterator patch contains other patches that create the graphics seen when
running the visualization.
They have inputs that are published up into the Audio Spectrum input level. Because they do not receieve any input within the Audio Spectrum macro, their input will be set or fluctuated at the Root Macro level.
If you want to see what is happening within a composition, there are several built in utilities to help fathom out what is happening. Simply click select any patch on the Editor stage, then click on the Patch Inspector icon. This will open up that patches Inspector , the contents and facilities of which depends very much upon what that patch is doing. Try selecting the JavaScript patch titled Smooth Structure and raising its Inspector panel.
From here you can set by what margin audio scale information increases and decreases.
The script that smooths the structure is reproduced below.
var array = new Array();
function (__structure outputStructure) main (__structure inputStructure, __number increasingScale, __number decreasingScale, __number time) {
var result = new Object();
if (inputStructure != null) {
for (i=0; i<inputStructure.length; ++i) {
var value = inputStructure[i];
var lastValue = array[i];
if (lastValue != null) {
if(value > lastValue)
lastValue += increasingScale * (value - lastValue);
else if(value < lastValue)
lastValue += decreasingScale * (value - lastValue);
array[i] = lastValue;
} else {
array[i] = value;
}
}
}
result.outputStructure = array;
return result;
}
The output structure is passed on to the Iterator structure input and it is within that macro patch that the rest of the composition's audio graphic work happens.
Next