Skip to content
Forum Archive

AVS in Javascript

62 posts

Grandchild#
Hello again,
the Decoder is basically done - and I would appreciate some help hacking apart the various effects that are available.
It'd be great if some people would pick apart some of the many basic built-in "checkbox/slider/number/color"-type of effects.
Read https://github.com/grandchild/AVS-Fi...s-file-decoder

I'll be mostly doing APEs for now because those might require some slightly deeper digging and function writing in the code...
QOAL#
Okay, I feel ill at the end of last week (so I'm sorry for not lending a hand), but I'm better now so I feel like suggesting an IRC channel for WebVS related development. Maybe on freenode?
Yathosho#
Originally Posted by QOAL View Post
I feel like suggesting an IRC channel for WebVS related development. Maybe on freenode?
what's wrong with the forum or github? the big shortcoming of irc is that everybody needs to be online all the time to be able to follow the discussion.
z33m#
wow. lot of cool stuff. Ive been off for a little while, and AVS forum stopped sending me notifications for some reason.

Been working on some major refactoring (https://github.com/azeem/webvs/tree/refactr) of webvs core code. cleaning up lot of the shader code and internals. Also writing some tests. I guess these changes + other fixes etc. can be put together as the first numbered version. I will write some detailed documentation or maybe a blog post about the internal wirings and how to write Effect components, would like lots of help on this.

I have separated out the editor UI project into a separate repo (https://github.com/azeem/webvsed), the webvs library contains only the core library, the examples directory contains individual examples and tests.

Also checkout https://github.com/rogerwang/node-webkit this is an awesome platform. Its basically nodejs+stripped-down-chrome that allows javascript applications to work standalone and it supports webgl too. I was able to quickly put together a standalone version of webvs that works on the desktop. This IMO is super exciting.

Also working on the firefox issues. FF 24 release supports mp3 so the streaming issue is fixed, meanwhile some other problems have cropped up with dancer.js. Either ways webvs uses an adapter to interface with audio, so im thinking of looking at a more reliable audio library like using the flash support with soundmanager2 or something. Need to look at the beat detection also. The one in dancer.js is not very good.

Originally Posted by Grandchild View Post
Just to let people know that I've started working on an automatic converter from .avs to (what yathosho and I feel should be called) .webvs files.


this is a nice doc, but it's also seemingly an older version of the file format, or a not-always-well-researched one. it has much good information, but some errors. just to let people know.
Originally Posted by Yathosho View Post
wow so much awesomeness. This is really brilliant. Also, presently, avs presets and webvs preset are not a one to one map. so we might have to do some preprocessing in between, to make the output work directly.

Originally Posted by Yathosho View Post
what's wrong with the forum or github? the big shortcoming of irc is that everybody needs to be online all the time to be able to follow the discussion.
I agree, forum is better. Particularly for me, i think my timezone is 5+ hours ahead of most of you guys, been hanging out at the avs irc channel for sometime but rarely see any activity because of this. Having to put all discussion under one thread is getting a bit hairy though.
z33m#
Can any explain the difference between trans/Movement and trans/DynamicMovement internally. In Webvs ive written only a dynamicmovement effect, i thought movement is equivalent to dynamic movement with the code inside perpixel. However some effects look significantly different.

Im going crazy trying debug this, getting weird artifacts in some cases. Could be because of difference in floating point calculations in webgl vs all integer calc in avs.

Also coudnt find trans/movement code in the avs source. Found dynamic movement code in r_dmove.cpp.
QOAL#
According to the comments in Grandchild's converter, Trans/Movement is in r_trans.cpp.

As for forum notifications, this explains the default setting:
Instant Email Notification - sends an email as soon as a new post is added to the thread. This is not sent for every reply and will only be sent once until you revisit the forums.
Grandchild#
@azeem: Yes, have a look at

and its comments, there is every source file as a comment behind the name, and every now and then i wrote the ranges or even the formula i saw in AVS or in the source code behind the fields.

the same goes for

only there are less comments.
z33m#
Originally Posted by Grandchild View Post
@azeem: Yes, have a look at

and its comments, there is every source file as a comment behind the name, and every now and then i wrote the ranges or even the formula i saw in AVS or in the source code behind the fields.

the same goes for

only there are less comments.
Thanks a lot for this. The main difference that i found is that movement doesnt use interpolation while dynamic movement does, this creates some artifacts even if we set grid size to 1x1. The other was a problem with rectangular-polar conversion, avs coordinate system is so confusing.

Also, if everyones interested we could use this google group https://groups.google.com/forum/#!forum/webvs for webvs related discussions.
Grandchild#
Also, the C++/Qt batch converter is taking shape:
Grandchild#
Azeem:
I think there is some commentary in dmove.cpp, describing the interpolation (if only loosely iirc). Apart from that you are right, Movement is 'just' a static variant of a DM with pixel-exact transformation.

Don't know about google-groups or something... What's wrong with this forum for now?
Apart from that, we could also take some of the discussion to github, to the repo pages, if necessary.

Also, in the converter, I have all the builtin components - except for one, apparently. All I know is that is has the ID code '9'. The rest is contiguous from 0 to 45. If anyone finds the one builtin(!) component I am missing, please tell me. You can look at the component checklist in the AVS Decoder repo, or into the components.js source directly.
It might very well be, that it's just not there/disabled...

PS: If you find (or know) where in its source AVS assigns these IDs, I'd be happy to know that too 🙂
z33m#
Originally Posted by Grandchild View Post
Azeem:
I think there is some commentary in dmove.cpp, describing the interpolation (if only loosely iirc). Apart from that you are right, Movement is 'just' a static variant of a DM with pixel-exact transformation.
Yeah, didnt quite understand most of it though. AVS source code is really difficult to follow. Im using glsl variable interpolation, getting somewhat okay results, have to test it out a bit though.

Originally Posted by Grandchild View Post
Don't know about google-groups or something... What's wrong with this forum for now?
Apart from that, we could also take some of the discussion to github, to the repo pages, if necessary.
Nothing wrong with this forum for now really,. I had created this group, so just putting it out here. IIRC github doesnt have a discussion board as such, using the issues list like a discussion board, makes issue tracking all cluttered.

Originally Posted by Grandchild View Post
Also, in the converter, I have all the builtin components - except for one, apparently. All I know is that is has the ID code '9'. The rest is contiguous from 0 to 45. If anyone finds the one builtin(!) component I am missing, please tell me. You can look at the component checklist in the AVS Decoder repo, or into the components.js source directly.
It might very well be, that it's just not there/disabled...

PS: If you find (or know) where in its source AVS assigns these IDs, I'd be happy to know that too 🙂
IIRC the ids are assigned in the declarations in rlib.cpp. there are several DECLARE_EFFECT calls. This call assigns the id from an incrementing integer. id 9 according to this is Roto Blitter
z33m#
Hi guys,

I've put together most of the changes that i've been working on into Webvs v1.0.0.

Changes
+ Lot of refactoring. Pretty much rewrote lots of stuff.
+ Lot of shader code uncluttering
+ Source tree organization is now slightly different. Moved out editor program
+ Added many tests
+ Documentation, lots of it
+ Added ColorClip
+ Added BufferSave
+ DynamicMovement fixed, more accurate.
+ New example UnConed-JelloCube
QOAL#
Awesome.

Heads up if you download the release archive from github:
The examples will not run without editing the javascript includes in them, or renaming the dist folder/files.

Strange that one of the faces of the JelloCube doesn't show up.

I'll give it a more thorough look later. (And try adding support for it in my editor)
z33m#
Originally Posted by QOAL View Post
Awesome.

Heads up if you download the release archive from github:
The examples will not run without editing the javascript includes in them, or renaming the dist folder/files.
hmm, have to do something about this. examples work on the build files. you can just run
grunt
that would generate all the build files.

Originally Posted by QOAL View Post
Strange that one of the faces of the JelloCube doesn't show up.

I'll give it a more thorough look later. (And try adding support for it in my editor)
Yes a cube face is missing, lemme know if you figure out the problem. Im guessing this has something to do with the clone feature in webvs. I saw that lots of presets have to create several copies of the same superscope only with slight variations. In Webvs you can specify a clone number and that effect will be cloned N times at the same time a variable called "cid" becomes available in the superscope. The scope can change conditions based on cid.

Also check webvsed. This is probably all completely broken now. But i had done some amount work on automatically generating the UI for each component. Basically, each component defines a JSON-Schema of its options object. A library then generates HTML form from this schema.
QOAL#
Could you look into why loadPreset fails when you call it again after the initial load?

You can test the issue quickly by adding:
setTimeout(function(){webvs.loadPreset(samplePreset);}, 1000);
to the end of the the onload function in the examples.

My editor doesn't look quite as robust as yours, however it's quite functional now. Although it supports the output of Grandchild's convert, and I'm not sure if there is total parity with WebVS with that yet.
Yathosho#
I'm missing the implementation of three of the most important effects of early AVS: Simple (Scope), Unique Tone and Movement. I'm sure they could be implemented—as aliases—within the existing SuperScope, ColorMap and Dynamic Movement effects. Actually, there are a couple of more render effects that I'm sure can be rebuild using SSC: Bass Spin, Dot Fountain and all that jazz.
z33m#
Originally Posted by Yathosho View Post
I'm missing the implementation of three of the most important effects of early AVS: Simple (Scope), Unique Tone and Movement. I'm sure they could be implemented—as aliases—within the existing SuperScope, ColorMap and Dynamic Movement effects. Actually, there are a couple of more render effects that I'm sure can be rebuild using SSC: Bass Spin, Dot Fountain and all that jazz.
I think yes it is possible. It should be really simple to create a component Classes that inherits existing SuperScope, ColorMap or DynamicMovement classes and pass the appropriate parameters to the super constructor.

To emulate winamp Trans/Movement behaviour, Webvs Dynamic movement has two settings 1) "noGrid": setting this to true disables grid interpolation, giving pixel accurate movement. 2) "compat": setting this to true makes webvs switch to a low precision bilinear filter code, makes things behave more like avs. Not very sure about Unique tone have to check the code, but should be a fairly simple shader code either ways.

I'll add these to the issues list.
QOAL#
As the release version of Firefox now supports all the necessary web audio spec I would like to point out a problem with Dancer.
The version of the web audio spec it targets is slightly different to how the spec is now, it seems.

Two functions have been renamed (I assume Chrome has the old names as aliases):
createJavaScriptNode is now createScriptProcessor
createGainNode is now createGain
More info here.

Alas, even with those errors fixed there is still a problem where the audio only plays for about 250ms. (It reports it as still playing through.)

Dancer has a distinct lack of activity on Github, and I'd like to think that its at fault not Firefox.

Anyway with that I've enabled the editor as standard in my editor.


z33m: Would there be any benefit if WebVS used web workers? Pause reduction on the main thread etc.
z33m#
Originally Posted by QOAL View Post
As the release version of Firefox now supports all the necessary web audio spec I would like to point out a problem with Dancer.
The version of the web audio spec it targets is slightly different to how the spec is now, it seems.

Two functions have been renamed (I assume Chrome has the old names as aliases):
createJavaScriptNode is now createScriptProcessor
createGainNode is now createGain
More info here.

Alas, even with those errors fixed there is still a problem where the audio only plays for about 250ms. (It reports it as still playing through.)

Dancer has a distinct lack of activity on Github, and I'd like to think that its at fault not Firefox.
I agree, Dancer is quite inactive now. There are a couple of things, in this area, that i think should be done in webvs.
1) Create a separate, nicer AnalyserAdapter implementation. use some other well maintained library or write our own.

+ SoundManager2 looks promising. the downside is that its flash + doesnt have beat detection afaik.
+ Implementing our own doesnt seem too far fetched either, both firefox and chrome supports AnalyserNodes which gives you FFT spectrum and waveform data directly, unlike dancer which uses a JS FFT library on the raw sound samples. The browser implementation should be a lot faster also.

2) Implement custom beat detection logic. For things like "Custom BPM" etc

Originally Posted by QOAL View Post
Anyway with that I've enabled the editor as standard in my editor.


z33m: Would there be any benefit if WebVS used web workers? Pause reduction on the main thread etc.
Havnt looked into this much yet. Im guessing nothing much, atleast from my limited understanding of how webworkers work. Basically they work through message passing, so dont know what kind of data can be passed around safely. They do not have access to the DOM and hence probably the webgl context too. So its pretty much limited to raw processing stuff, maybe to speed up expression parsing or something. The PEGS parser is a bit slow actually.

But the UI responsiveness should be somewhat solved by the issue#5, since it greatly reduces expression+shader recompilations. Especially since the UI is only ever going to update components one at a time, so atmost max(clone) effect reinitialization per user interaction, which should be fast enough.
z33m#
I have pushed the next increment of webvs. 1.1.0

Changes:
+ added Texer Component and resources.
+ DynamicMovement aspect ratio fix
+ shader MULTIPLY blend fix
+ added EffectList expression support
+ Container component
+ Tree CRUD with clone support.
+ added Simple scope.
+ added UniqueTone.
+ added Movement.
+ DynamicMovement grid size fix
z33m#
Can anyone tell me, or point to resources on how to build and step through the AVS C++ source code?

Also, check this issue: https://github.com/azeem/webvs/issues/8. if anyone has a build setup and can spare some time, please check it out.
QOAL#
DrO and Justin are the only people I'm aware of that have complied AVS of late, asking one of them nicely for build environment would be your best bet.
Yathosho#
Originally Posted by z33m View Post
Can anyone tell me, or point to resources on how to build and step through the AVS C++ source code?
wotl and grandchild might able to shed some light on. from what i remember, you need 1998's (!) visual studio 6 to compile the source.
Warrior of the Light#
Never attempted to compile it myself, I suck at coding presets, let alone writing software. Yes, you need that version and I know there are no resources or added comments or anything like that. Steve and Co. probably knew the code by heart and worked from there. There are some threads on this topic but I think DrO is the only one active on this board who ever really got it to work. I'm just hosting the files because noone else did