A Winamp AVS like clone in Javascript.
Presets are written in JSON. The root JSON Object contains the following properties
nameString (default: "") : Name of the presetauthorString (default: "") : Preset Author informationdescriptionString (default: "") : Preset descriptionclearFrameBoolean (default: false) : Indicates whether every frame should be cleared or notcomponentsArray[Objects] (required) : List of AVS Components. Each component is an object of the form{"type" : "[ComponentName]", "[ComponentOption]": [OptionValue] .. }
Supported Components and their options are as follows
Effect list allows offscreen rendering like capabilities. Components within effectlist render to a separate buffer which can then be blended to the parent.
clearFrameBoolean (default: false) : Indicated whether the internal buffer should be cleared for every frame.outputString (default: "REPLACE") : Output blend mode. This determines how the buffer, after rendering all the components in this list, should be blended to the parentcomponentsArray[Objects] : List of sub components in this effectlist
SuperScope allows drawing of different kinds of primitives, based on spectrum or waveform data
-
codeObject (required) : AVS Expressions that determine how the scope is drawn.initString (default: "") : Run once during initialization.onBeatString (default: "") : Run when a song beat is in progress.perFrameString (default: "") : Run once for every frame.perPointString (default: "") : Run once for every point.
AVS Expression variables available in SuperScope code and their meanings are as follows.
n(default: 100) : determines the number of points in the scope. Assign to change number of pointsw,h: the width and height of the screen.b: 1 if a beat is in progress 0 otherwise.x,y: float values ranging from -1 to 1. determines the position of a point. Assign in perPoint code.red,green,blue(default: computed bycolorssetting) : float values ranging from 0 to 1. Assign in perPoint code to change color of each point.v: float value ranging from -1 to 1. Gives the value of the scope (waveform data or spectrum data) at current point. Use inside perPoint code.i: float value ranging from 0 to 1. Gives the index of the current point. 0 being first point and 1 being the last. Use inside perPoint code.
-
spectrumBoolean (default: false) : If set then the data in the scope code will be spectrum values, otherwise waveform. -
dotsBoolean (default: false) : If set then only dots are drawn at point positions. Otherwise lines are drawn between points. -
colorsArray[Array[Int]] (default: [[255,255,255]]) : Decides the color of all pixels for a frame. The colors are cycled through smoothly for each frame. Per point color values can be overridden by assigning to red, green, blue variables in perPoint code -
thicknessInt (default: 1) : Determines the line width or dot size.
DynamicMovement allows displacing pixels based on AVS expressions.
-
codeObject (required) : AVS Expressions that determine how the pixels should be displaced.initString (default: "") : Run once during initializationonBeatString (default: "") : Run when a song beat is in progressperFrameString (default: "") : Run once every frameperPixelString (default: ""): Run once for every pixel to be displaced
AVS Expression variables available in DynamicMovement and their meanings are as follows
x,y: float values ranging from -1 to 1 containing position of pixel. Assign to change the position.r,d: float values ranging from -$PI to $PI and 0 to sqrt(2), containing the polar coordinate position of the pixel. Assign to change position. Works only in polar coordinate mode.w,h: the width and height of the screen.b: 1 if a beat is in progress 0 otherwise.
-
coordString (default: "POLAR") : "POLAR" or "RECT", determines the coordinate mode for the displacement. -
gridW,gridHInt (default: 16, 16) : Decides the grid width and grid height. To avoid computing displaced positions for all pixels, the screen is divided into a grid.perPixelcode is run once for every grid intersection points, remaining positions are interpolated.
ChannelShift allows rearranging rgb values of all pixels.
channelString (default: "RGB") : "RGB", "RBG", "BRG", "BGR", "GBR" or"GRB", determines how the output pixel are mappedonBeatRandomBoolean (default: false) : Randomly change channel setting when a beat occurs.
Convolution applies a simple 3x3 convolution kernel
kernelArray[Float] (required) - Array of 3*3=9 values containing the 3x3 kernel values.
FadeOut fades the screen out at fixed speed.
speedFloat (default: 1) - float value ranging from 0 to 1 that determines how quickly the screen fades out. 0 being no effect and 1 being clear every screencolorArray[Int] (default: [0,0,0]) - rgb tuple containing color the which the screen fades.
OnBeatClear clears the buffer when a beat occurs
nNumber (default: 1) : The buffer is cleared everynbeatscolorArray[Number] (default: [0,0,0]) : rgb tuple for the color to which the screen will be clearedblendBoolean (default: false) : if set, the current buffer will be 50/50 blended with cleared buffer
Displays a picture at a fixed location
srcString (required) : location for the imagexNumber (required) : x position of the imageyNumber (required) : y position of the image
{
"name" : "Science of Superscope",
"author" : "Marco",
"clearFrame": false,
"components": [
{
"type": "EffectList",
"output": "ADDITIVE",
"components": [
{
"type": "FadeOut",
"speed": 0.4
},
{
"type": "SuperScope",
"code": {
"init": "n=800",
"onBeat": "t=t+0.3;n=100+rand(900);",
"perFrame": "t=t-v*0.5",
"perPoint": "d=D/n;r=(i-(t*3)); x=(atan(r+d-t)*cos(r+d-t+i)); y=((i+cos(d+v*1.2))-1.5)*1.7;z=-(cos(t+i)+log(v)*cos(r*3))*3;red=cos(r)+1;blue=sin(r);green=sin(i)/2"
}
},
]
},
{
"type": "Convolution",
"kernel": "blur"
},
{
"type": "Convolution",
"kernel": "blur"
},
{
"type": "OnBeatClear"
}
]
}