Visual Developer

From Winamp Developer Wiki
Revision as of 23:24, 10 April 2013 by DrO (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Wiki Main | Skin Developer | Visual Developer | Plug-in Developer | Online Service Developer | SHOUTcast Tools & Services | Articles Page | FAQ | Glossary

What is a Visualization?

Visualizers or Visualization Plugins are dynamic add-ons that produce images, colors, and textures that change based elements of the music being played. Winamp offers two primary visualization plugins ( AVS & MilkDrop) allowing you to create different presets. If you’re feeling invincible, you can even attempt to create your own visualization plugin or you can stay platform. There are many visualization plugins available which users have generated.

What is a Preset?

Presets are outputs of a visualization platform. You can customize the visualizers and get any effect you want. Many users have uploaded such presets in Winamp.com

AVS Unleashed

AVS is the mother of all Winamp visualization plug-ins. It lets the user build a countless number of custom visualizations from an ever-expanding library of effects. AVS supports windowed/fullscreen rendering, preset customization, module stacking, skinnable windows, support for Sonique visual plug-ins, and a ton of other features. AVS is now bundled with all versions of Winamp after v2.6, so everyone can get a taste of its visual sonic goodness.

Module References

Below is some information on AVS modules. WVS is our codename for our global mind control device. With it we shall overtake the world. And have another excuse to take mind-altering substances.

Currently information about the superscope module is here. It uses all kinds of math stuff. Justin is so smart. You can look here for more general information about making presets.

Superscope Reference

The superscope allows you to create your own designs.

To have multiple statements on one line, use a semicolon (;) to delimit the statement. Use parenthesis '( and )' if you are unsure about precedence.

Fields:

Field Description
init set initial variable values here
point This is where the shape of the superscope is defined
frame Used to define movement and transformations
beat Expression that gets evaluated on the beat

Operators:

Operator Description
= assign
'+,-,/,*' 'plus, minus, divide, multiply'
convert to integer, and do bitwise or
& convert to integer, and do bitwise and
% convert to integer, and get remainder

Variables:

Variables Description
n number of points to render (set in Init, Beat or Frame)
x x coordinate, between -1 and 1
y y coordinate, between -1 and 1
i position of the scope (0..1). The point position.
v value at point i (-1..1)
b 1 if beat. 0 for no beat. Used for beat changes
w width of screen
h height of screen
red red value. (0..1). Set this variable to set red value.
green green value. (0..1) Set this variable to set green value.
blue blue value. (0..1) Set this variable to set blue value.
t, d variables commonly used for movement

Functions:

Variables Description
abs(var) returns the absolute value of 'var'
sin(var) returns the sine of the angle var (expressed in radians)
cos(var) returns the cosine of the angle var
tan(var) returns the tangent of the angle var
asin(var) returns the arcsine of var
acos(var) returns the arccosine of var
atan(var) returns the arctangent of var
sqr(var) returns the square of var
sqrt(var) returns the square root of var
pow(var, var2) returns var to the power of var2
log(var) returns the log base of var
log10(var) returns the log base 10 of var
sign(var) returns the sign of var or 0
min(var, var2) returns the smallest value
max(var, var2) returns the greatest value
sigmoid(var, var2) returns sigmoid function value of x=var (var2=constraint)
rand(var) returns a random value between 0 and var
band(var, var2) boolean and, returns 1 if var and var2 are != 0
bor(var, var2) boolean or, returns 1 if var or var2 is != 0
bnot(var) boolean not, returns 1 if var == 0 or 0 if var ! = 0
if(cond, vartrue, varfalse) if condition is nonzero, returns valtrue, otherwise returns valfalse
equal(var, var2) returns 1 if var=var2, else 0
above(var, var2) returns 1 if var > var2, else 0
below(var, var2) returns 1 if var<var2, else 0

jjjjjjjj

Making Presets

We are going to attempt to reproduce a simple version of one of my favorite presets: Lone's "No way to go". Successful presets usually start off with one or more Render Modules, and then have a number of Trans Modules added to subtly manipulate the effect. Lone's preset is no exception. Again, before we start, make sure that you have both Winamp and AVS installed:

  1. Start Winamp and AVS
  2. Right-click in the AVS window, and select AVS Editor
  3. In the Editor window, click on Preset. A drop-down menu appears
  4. Click on New. This creates a new blank preset
  5. Click on Main. The option to Clear every frame should appear in the right window. If enabled, this will paint the screen black at the beginning of each frame, erasing the previous one. For this preset, leave this option unchecked
  6. We will now add Effect Modules to this presets. Click on +, then click on Render, then click on Moving Particle. New options should appear in the right half of the window
  7. Click on the white box labeled "color". A whole new color window should pop up
  8. Click on a basic color (it helps the effect if it isn't a "pure" color, like orange or purple). Now click OK. The color box should now be the same color that you chose
  9. Make sure the Onbeat Sizechange option is enabled
  10. A moving blob of color is a bit interesting, but it could be better. We will now alter how that Moving Particle is displayed by adding some Trans Modules
  11. Click +, then click Trans, then click Water
  12. Click +, then click Trans, then click Blur
  13. Click +, then click Trans, then click Movement. A new list of effects should appear in the right half of the window. Click on sunburster

Congratulations, we have replicated Lone's Preset! You can also drag an included Effect Module up or down the list to play with sequencing. I hope that you have realized by now that ANY permutation of the existing Modules or setting modification will result in a new effect! Keep experimenting!

Advanced Tactics

After creating a few original presets, it is natural to want even more options and control. AVS now has a very powerful tool: Effect Lists. To use an Effect List simply as an organizational tool is to squander its potential. The idea is that everything in an effect list gets rendered into a separate buffer before being added to its parent buffer. You now have the power to create completely separate effects off screen, manipulate them freely, possibly blending them together, all before finally displaying the final effect in one shot.

  1. Open AVS Editor#Create a new preset
  2. Click on Main, then disable the Clear every frame option
  3. Click on +, then on Effect List to add an Effect List
  4. In the Effect List options, make sure the Enabled and Clear every frame check boxes are checked. For the Input blend mode, select Ignore. For the Output blend mode, select Subtractive Blend 1
  5. Click on +, then on Trans, then on Mosaic
  6. Click on +, then on Render, then on Simple
  7. Click on Main, to stop adding to the Effect list
  8. Click on +, then on Trans, then Fadeout
  9. In the Fadeout options, Click on the Fade to Color Box, and select a nice red color#Click on +, then on Render, then on Bass Spin

If you have followed the instructions faithfully, you should get an effect tree that looks like this:

Main

  • Render / Bass Spin
  • Trans / Fadeout

Effects List

  • Render / Simple
  • Trans / Mosaic

That having been done, let's examine this preset: A Bass Spin is placed into the main parent buffer.

Then, the Effect List creates a separate, secondary buffer.

This buffer starts out black (cleared every frame), ignores what is in its parent buffer and a Simple waveform is drawn into it. Notice that the Mosaic modifier ONLY affects the Simple effect as it is totally segregated from the parent buffer.

Now that all effects in the Effect List have been processed, the secondary buffer is blended back into the parent buffer using the blend mode specified in the Effects List options; in this case, Subtractive Blend 1.

This results in a dark colored Simple effect overlaid over the white Bass Spins.

What this means is that you can prevent Trans modifiers from affecting whole groups of modules, which in turn gives you much finer control over the visual effects. I hope this simple tutorial has shed some light on to the mystery of Effect Lists. It took me a bit of head scratching to wrap my mind around the usefulness of parent and child buffers, but now all my old presets seem so primitive. Keep playing with AVS and you will impress yourself! I guarantee it!

Writing APEs

BOX is a quick and dirty demonstration of basic APE structure and the utilization of AVS features. It takes advantage of AVS's built-in beat detection and easy access to the frame buffer to flash a rectangle onscreen on every beat. We also learn how to set up a configuration screen template, load and save configuration settings, and use the default color selector. There is very little fat, so you can use this as a template for future APEs. You can view the main file below.

Box Source code

You can check a sample box source code here

Milk Drop Unleashed

MilkDrop is a music visualizer - a "plug-in" to the Winamp music player. As you listen your music in Winamp, MilkDrop takes you flying through the actual soundwaves you're hearing, and uses beat detection to trigger myriad psychedelic effects, creating a rich visual journey through sound. MilkDrop can also be driven by a live audio feed (microphone or line-in)

MilkDrop 2 is a major upgrade to the original MilkDrop visualizer, opening up the power of modern graphics chips and programmable pixel shaders to the realm of music visualization. Pixel shaders allow dozens, even hundreds of complex instructions to be executed for every pixel on the screen, every frame. Other new features include jpg textures, gaussian blurring, a preset "mash-up" feature, and a prest "back" button. MilkDrop 2 is backwards-compatible with presets from MilkDrop 1.

For a comprehensive understanding, please go through the MilkDrop Unleashed Guide

To create your own presets, check out the MilkDrop_Preset_Authoring Guide

For on-going discussions on Milk Drop, drop in the Milk Drop Forums



Developer Resources