Archive: Music Analyzers


1st December 2007 05:01 UTC

Music Analyzers
I've been making a few music analyzers: a bar for waveform, a movement (explain later) for the spectrum and a remix of each.

Bar Analyzer:
This was originally going to be for a windows media player clone I was making for WinAmp, but I have abandoned that project because the visuals on media player are horrible. Out of the entire pack, this preset is the best. Each bar is the waveform band 1/50 to 50/50. Using the floor function, each peak indicator is raised up to the height of the bar and an if statement resets the gravity acceleration to 0. This preset works perfectly except the lines dividing the bar are not evenly spaced at certain resolutions.

Spectrum Analyzer:
Instead of having an object that changed its shape based on the spectrum data (like a superscope) I used the following equation in the dynamic movement:
y=y+abs(getspec(abs(x*.65),0,if(above(x,0),2,1)))/10
The closer to the y axis, the higher the pitch is and the farther toward the edge, the lower the pitch is. The if statement corresponds the left side of the preset to the left speaker and visa versa. Using the fadeout, the longer a pixel exists, the fainter it becomes. The gray scale is mapped into color using the colormap; yellow is the spectrum data and blue is the average of the spectrum data. I hope you like it.

Fire Analyzer:
The fire analyzer takes the spectrum analyzer a step farther and maps the oscope data in 2 directions. (the base equation):
y=y+getosc((x+1)/4,0,0)/10;
x=x+getosc((y+1)/4+.5,0,0)/10;
This preset is a visual expression of the shape of the wave form data; a flute would make smooth fire while heavy metal makes twitchy fire. Soft music makes a candle and loud music make a fireplace effect. What I’d really like to do is record the spectrum data every beat and transition from one beat to the next. Another goal is to create dynamic smoke. If you have any ideas on how I could improve any of the preset, please leave a comment.
Enjoy! :D


1st December 2007 21:01 UTC

This is pretty good for a fresh face (most people come up with some truly awful first presets)

My only advice at this stage would be to look at optimising, for example your bars presets use texers which is a very expensive way of rendering lines. You are given a line renderer (ssc) so why not use it(!) You can also consolidate all of the lines into just one looped ssc, which is a lot less effort than duplicating lots of individual effects (I bet you got sick of that pretty quickly huh?) I have attached a preset which is a very simple example of how to do bars like yours with a superscope.

You might want to look at the programming guide (see tutorials thread) for some more tips, but you seem to have a grasp of the avs language so you may prefer to just learn for yourself :)


3rd December 2007 04:03 UTC

Wow...
Thanks so much! This was exacly what I was looking for. Your version run about 15 times faster than my original. It will take some time for me to be able to code loops in WinAmp, but I get the concept. I'm glad that I can't make an infinite loop (I crash my computer enough as it is).

Would using triangles help the fps?
Is the megabuff trans-scc, meaning can I set the megabuff in the first scope and use it in later scopes?


3rd December 2007 21:14 UTC

Triangles wouldnt really help, line drawing algorithms are faster than triangle rasterising algorithms (although tomy's ape is very fast). The megabuf is not accessable between effects, the gmegabuf however, is.

I am going to point you here:

http://pak-9.deviantart.com/art/AVS-...Guide-11200891

for more programming advice, since its basically what I would say anyway.


3rd December 2007 22:38 UTC

again i'm wowed. Aj Sindri your what i would call the best noob around so far. better then me i'll admit.

your spectrum analyser (fire) was really impressive. most realistic approach to a fire preset i've ever seen.