Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 22nd, 2024, 10:45 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 62 posts ]  Go to page 1, 2, 3, 4, 5  Next
Author Message
 Post subject: TV static/white noise animation in Opus Pro
PostPosted: February 19th, 2011, 2:54 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi,

I've been trying to create an animation for an eLearning lesson in Opus Pro that is similar to TV static or white noise. It's actually a specific animation pattern called dynamic visual noise (more info, a Windows demo and Delphi source code files at St. Andrew's University, Dr. Quinn's web page: http://www.st-andrews.ac.uk/~www_sp/people/personal/jgq/, plus a Flash demo version in ActionScript 3 at http://elearningprojects.com/WN5.swf. The design is a canvas 640 X 640, with 80 rows and 80 columns of 8 X 8 black or white rectangles("dots"), totaling 6400. The design specifies half (3200) black and half (3200) white, and a fixed number (the researcher in an email mentioned slightly under 400 dots per second) chosen randomly each 1000 ms to alternate between black and white. The result needs to carefully replicate the speed and style found in the Windows or Flash demo.

(I can post the ActionScript 3, if anyone would like to view it, but ActionScript 3 makes use of a bitmapdata class which has a built-in (random) noise generator. And, it is unclear to me what formula the noise generator uses or how to replicate this in Opus Pro scripting.)

Initially, when I tried to create 6400 rectangular "dots" on a 640 X 640 page in Opus, it crashed ("not responding"). But, I think that if a group/row of 80 across by a column of 2 down is first created and made into a frame (maybe even a larger grouping), then the Quickbuild>create table may be able to populate all 6400. To make this work, a few things need to be set up first in each "dot" since once there are 6400, it's difficult to add to each.

(1) needs some internal script (preferably using "this.something") since that is easier than calling by name each of 6400 objects.
(2) needs a way to uniquely name each and put into an array, since, for example, only 400 each second will be randomly chosen to flip from white to black or black to white.
(3) needs a random generator to identify those ever-changing, randomly chosen 400 dots each second for flipping, and a script to flip these.
(4) etc.

Challenging project, but I suspect it can be done in Opus with the right design and script.

I would much appreciate any design, scripting, other suggestions on how to make this work.

Thanks very much.

Kind Regards,

_________________
Stephen


For this message Stephen has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: TV static/white noise animation in Opus Pro
PostPosted: February 19th, 2011, 10:42 pm 
Offline

Joined: December 29th, 2004, 12:00 pm
Posts: 230
Location: Auckland NZ
Opus: v 7.04
OS: xp & win7
You could do this in a video editor quite easily...
In Serif Movieplus I made a white clip, added one of the 'old black and white film' effects and transformed (resized) the clip so it was grossly enlarged, i.e. using just the centre of the frame.
This gives a suitably irregular noise effect.
I'm sure most video editors can do this, but Serif is pretty good value for a very sophisticated program. :wink:

...or you could go to http://www.pond5.com/stock-footage/335489/tv-static-noise-with-sound.html
..and google 'static noise clip' for many more and also wav files.

movies13 should be able to turn short clips into animated gifs if that's your choice.

cheers

_________________
Opus Pro 7.04 - win10


For this message mac has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: TV static/white noise animation in Opus Pro
PostPosted: February 20th, 2011, 4:11 am 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi Mac,

Thank you for these suggestions. I had already created an animated GIF version and embedded it as video into an Opus Pro pub.

While this works, I remain interested in the challenge of creating, if possible, the entire animation in Opus Pro. If I can figure out the scripting, I think it can be done, even with all 6400 "dots" using Quickbuild.

Kind Regards,

_________________
Stephen


For this message Stephen has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: TV static/white noise animation in Opus Pro
PostPosted: February 21st, 2011, 8:37 pm 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
Stephen,

Maybe you could program a FastFourier Transform. ??
or some hybrid-Gaussian function. :P

Quote:
I remain interested in the challenge of creating, if possible, the entire animation in Opus Pro
Okay. I thought this was an interesting problem, so I noodled it for awhile. I think I have a pretty easy approach, at least on paper. I have not actually tested the script. And IF is does run and does do what it needs to, I'll leave it to you to work out the timings for the refresh rate (presumably something like 960ms ???? for the full-blown project).


Code:
//Stephen's 6400 point flip project  Feb 2011  -- http://www.digitalgrapevine.info/posting.php?mode=reply&f=4&t=4322
//the Project challenge is to design the 'random select of 400' objects from a larger set of 6400.
//To test the model, I propose you do a SCALED DOWN experiment for a 'random select' of  40     out of    100.
//The way I looked at it -- THE MAIN CHALLENGE IS to determine the FLOW of the logic, and the crux of that is in the handling of the 40 selection process.
//

  /*  Make one BUTTON object which we will design and specify, and soon replicate (using Opus QuickBuild)
   *  1) On the Opus Page or in the Organizer, place this Button inside a Frame named Pool01
   *  1) try a 4px by 4px square  (or whatever size you want)
   *  2) set it to be a Pushbutton
   *  3) give it a WHITE background color for its Normal state
   *  4) give it a Black color for its Button Down state  (be sure to select 'Normal' before leaving Properties)
   *  5) Now do the multiple copy (right click in organizer / QuickBuild).  Also, RENAME (if necessary) b0000, b0001, b0002 etc... 
   *  6) Now, clean up the alignment and spacing of these 100 Buttons on the Page.
   *  DO NOT PUT ANY OTHER OBJECTS IN THE FRAME named Pool01
  */

var poolsize = 100 ;                  //size will be 100 'points' for testing, then 6400 for project -- needs to match the number of objects (points) controlled;
var toggle = -1 ;

     //first set the starting color pattern by alternating values to represent 50% white, 50% black
     for (i=0; i<poolsize; i++) {

     switch ( toggle )
     {
     case -1:
     Pool01.GetChild( i ).SetState( String.bool(toggle) )
     break;
     case 1:
     Pool01.GetChild( i ).SetState( String.bool(toggle) )
     break;
     toggle *= -1 ;   
     }

var bstate = 0 ;      //will be used only on the subset that is randomly selected to be flipped from Black to White or White to Black
var kup = 0;
var ran ;  //undefined 

function generate( poolsize )
{
AR = new Array( poolsize ) ;          //size will be 100 for testing, then 6400 for project -- needs to match the number of objects (points) controlled; this step also wipes out previous values for all the Elements of the array (because we want to operate on a whole new random selection of 40 'test', or 400, points chosen from the 100 'test' or 6400 project points)

while ( kup < 40 ) {
ran =  Math.random( poolsize ) ;    //NOTE: according to the Help files, the script command 'random' is supposed to return Integer values when a Limit is specified;  if this does not work as intended (want integers 0 to 99), then simply use  parseint, or Math.floor() in conjunction with the random function.
   //incorrect//if ( AR[ ran ] ) {
   //corrected//
   if ( AR[ ran ]  !=  -1 ) {
   AR[ ran ] = -1 ;                  //we simply want to tag or flag this one ELEMENT as taken -- this simultaneously enforces 'no repeat'
   bstate = Pool01.GetChild( ran ).GetState() ;
   Pool01.GetChild( ran ).SetState( !bstate )         //  ********* this action is what flips the pixels **********
   kup++
   } //end if

} //end while

}
//end func.

//--------------  Probably call the above function repeated with a WHILE Loop, either continuously (always true) or by hitting a start/stop Button  -----------------
//for example...

while ( true ) {
generate( )
wait( 0.960 )               //maybe we use up 40ms to execute the function's actions?
}

/*
//I think you do not need to pass a parameter for poolsize to the generate() function,  since a value for that variable has been set earlier.
//Added thought:  I used values like 1 and -1, also  String.bool( -1 ), also  toggle *= -1 ;   ---    where I could have used boolean values...  and their opposites ... might give some CPU performance improvement versus numeric values?

var toggle = false ;   //and later...
toggle = !toggle ;    //to flip it
*/

I hope this either works, or gets you started.

[Lar EDIT:] I think I found an error in my script above.
was: if ( AR[ ran ] ) {
corrected: if ( AR[ ran ] != -1 ) {
//there could be several ways to set up the test condition, but in this simple version... AR[ran] will either be undefined or equal -1

_________________
_good things come to those who wait(0)_


For this message Lar_123 has been thanked by : mackavi


Last edited by Lar_123 on February 27th, 2011, 8:24 am, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: TV static/white noise animation in Opus Pro
PostPosted: February 21st, 2011, 10:29 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi Larry,

Thanks very much! This is an impressive script and design. I'll try to get it running.

As mentioned in my reply to Mac, I've set up a 'fall-back' pub embedding an animated GIF (screen-captured from the Flash version), as a video in an Opus Pro pub. Looks and works well. But, as mentioned in that posting, creating it solely in Opus Pro has become a challenge for me. I believe that it can be done. Thanks for this lead.

Kind Regards,

_________________
Stephen


For this message Stephen has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: TV static/white noise animation in Opus Pro
PostPosted: February 21st, 2011, 11:22 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Sorry, but I think there is an inherent flaw in this method:

It's basically a lottery loop that requires all values to be drawn before it breaks - unfortunately, although statistically unlikely, there is the possibly that certain numbers will not be drawn. There is mostly certainly the chance that numbers will be drawn more than once, hence your flag - which basically means lots and lots of wasted CPU cycles drawing 'dead' values. This will most likely result in the states flipping quickly initially but slowing right down until the states really do appear 'static' in the wrong sense.

Rather than randomly picking values from the pool, you need to just shuffle the pool.

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: TV static/white noise animation in Opus Pro
PostPosted: February 21st, 2011, 11:56 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi Mack,

What would shuffling the pool look like in script. I've tried a number of random generators, but so far have not come up with a solid, working design.

There are 6400 8X8 dots on a 640X640 "canvas," half black, half white to start. Of these, every second, a randomly chosen 400 (maybe slightly less, like 395) have to flip color from white to black or black to white. When I initially explored this design, thought it was simple. But as mentioned, so far nothing has worked. Anything that needs to be done inside the dots needs to be set up before Quickbuilding 6400.

Kind Regards,

_________________
Stephen


For this message Stephen has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: TV static/white noise animation in Opus Pro
PostPosted: February 22nd, 2011, 7:34 am 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
Thanks Mack.

I'll take a closer look at my approach in next few days.
I've started reading a bit into the 'lottery loop' you mention, and the potential for either biases in the patterns/distribution or the possibility of non-selecting certain members of the pool. Have found a couple approaches, maybe.

I did not want to build up an IMP for this, but I might have to do so sometime in the future -- in interest of learning. Right now, it will be a distraction.

Stephen,
I think this pseudorandom implementation can be tweaked, improved upon in opusscript. However after viewing the Flash example, I doubt the requirement is for a stringent definition of random.

To Mack's point of refresh rate, I think I can get that out of the WHILE Loop and activate the changes at 'one swipe' (if that's what you wanted).

You can find some shuffle information here. It is nothing I am familiar with, except in concept. http://www.robweir.com/blog/2010/02/mic ... allot.html

_________________
_good things come to those who wait(0)_


For this message Lar_123 has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: TV static/white noise animation in Opus Pro
PostPosted: February 22nd, 2011, 11:21 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
stephen wrote:
What would shuffling the pool look like in script.


Lar's link answers this, though it might be a little full on and necessary to take a step back. I also advise students to apply theory to a pragmatic example to help with the bases of any code building. In this case, lets shuffle cards:

Start by reading through the pack and storing these. in this case, we'd need an array:

myPack = new Array("ace","one","two",etc, etc, etc)

Now think about how you might shuffle a physical pack. It would be easy to take the ACE and slip it between the NINE and TEN cards but if I start to think about how this might be achieved programmatically, then I have to somehow, take the value at index zero, split the values at indices 8 & 9; move the values from indices 9+ up one index and place index zero in the now empty index 9. Finally, I have to shift the entire pack back one index to remove the now empty index zero. A plausible approach but a lot of steps and thus not necessary efficient.

So, I take my 52 cards and lay them back out in a line. I know that the approach above works, but what I'd really like is not to introduce any new or blank array elements. Therefore, I pick up the ACE and think if I don't want any new elements, then I need to place that ACE down in an existing element. I choose index 9, but that has the TEN card there. So I pick up the TEN card and put the ACE down and then of course, I'm holding a card that can be placed down in the empty index zero. Cards ACE and TEN have now been shuffled (a simple switch but different places non the less). Next, I move onto card TWO and repeat the process. Card TWO may have already been switched (perhaps with the ACE) but by sequentially switching every index value, I guarantee that each card will be switch at least once.

Thus my program outline looks like this:

1. Read values into an array
2. Use FOR loop from zero to length of array
3. Read value from array [iteration] // IE where in the loop it is.
4. Read value from array [random]
5. Switch values at points 3 and 4
6. Back to point 2 if still looping.

When complete, this will give you an array of shuffled values. This can simply be a list of numbers in a random order. You can then return to Lar's suggestion of reading though a random list and using GetChild() to access an object within a frame - IE one of your 'dots'. Because the array is random, reading through it sequentially WILL NOT access sequential 'dots'.

I will add that Lar's suggestion uses the GetChild() to access a button and then flip it's get state. This will result in a rainman effect where you'll be able to predict what will happen - IE black will become white - white will become black. Ideally, you want to allow black to become black and white to become white. Rather than just flip, you need to randomize the button state.

This method means that technically, whether likely or not, when the loop completes all dots could be black, all could be white, it could be 50/50 or some other just as random ratio.

Hope it helps,

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: TV static/white noise animation in Opus Pro
PostPosted: February 22nd, 2011, 1:27 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi Mack,

Very impressive logic!

I can try to set up a basic working model to test out the concepts, which then could be applied to the bigger project. (I do wonder if a project with 6400 dots will slow down from doing this many calculations?)

Much thanks.

Kind Regards,

_________________
Stephen


For this message Stephen has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: TV static/white noise animation in Opus Pro
PostPosted: February 22nd, 2011, 5:53 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
I think the biggest problem is drawing the 6400 dots in the first place. In what amounts to a Catch 22, Opus draws host objects on screen through the IDE whereas Adobe Flex can do this (MXML) it can also add them at run time dynamically (AS). Opus is the more powerful for the designer, but Flex wins for the developer.

It's a simple nested FOR loop for the XY which I've used many times to create an array of clones. But 6400 clones would kill Opus and using QuickBuild is unlikely to work either. It might make it in outline mode - but I'd imagine that the publication would die soon after wards. It's not a criticism - what your attempting to do is a little out there even by some of the requests we get on the forum.

I do wonder though, whether if Opus could create host objects at run time whether this would work - like it does in Flex. It has been a wish of mine for a while now, but I have no idea how much use it would be to the general audience and in relation to how easy it would be to achieve.

Thirty seconds with QuickBuild told me Opus would die quickly - so I decided to see if the same logic that I knew would work in Opus with a sensible array (10x10) could be transfer to Flex and scaled to your 80 x 80.

http://sandbox.interaktiv.co.uk/whitenoise/

The principle is exactly the same, except the 'dots' are added dynamically at run time.

1. create new 'dot' (object) and reference to array index
2. shuffle array as per previous post.
3. loop through randomized array.
4. randomly set colour of dot.
5. repeat from step two.

With the shuffle on, the pool size can be a lot lower and the speed and apparent randomization (I'm sure that's bad maths) is a lot more significant than with a pool size 80-100 times bigger but without the shuffle.

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: TV static/white noise animation in Opus Pro
PostPosted: February 22nd, 2011, 6:08 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi Mack,

Very interesting. Probably can also be done like this in Visual Basic. Oddly, the random noise pattern, speed and style does not replicate the the original which is in Delphi (something I neither have nor can work in). The Delphi source code and a Windows demo is at http://www.st-andrews.ac.uk/~www_sp/people/personal/jgq/.

And, in order to properly illustrate and be useful in exercises as dynamic visual noise, it has to precisely replicate the "standard" pattern developed by Dr. Quinn at St. Andrew's U.

In an email from Dr. Quinn, he mentions that for a 640X640 canvas with 6400 8X8 dots, the change rate should be 'slightly under 400 dots per second.' So, in addition to other challenges, a random generator would need to randomly select 400 dots per second (or 40 dots per 100 Ms) for changing, out of the available 6400 pool (a sort of reduced, ever-changing 'pool').

Not sure where to go with this. But, it's an interesting challenge.

Kind Regards,

_________________
Stephen


For this message Stephen has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: TV static/white noise animation in Opus Pro
PostPosted: February 22nd, 2011, 10:48 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Haven't touch a Borland language since Turbo Pascal - brings back memories.

I've uploaded a slightly modified version that allows you to alter the interval. It can be used to illustrate an interesting problem. The default is your 40 dots @ 100ms. Previously, I'd had it set to 400 dots @ 1000ms. Same number of dots over time, but the effect is very different because of the time taken to complete the loop.

I think you'd need to know how the dots are changed - IE is one dot changed every 2.5ms such as

change dot A
wait(0.25)
change dot B
wait (0.025)

Or is it

change 40 random dots
wait (0.1)
change 40 random dots
wait (0.1)

Also you need to know whether the dots are switched - IE black WILL become white or is the state randomized IE black might become white or it might stay black.

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: TV static/white noise animation in Opus Pro
PostPosted: February 23rd, 2011, 12:08 am 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi Mack,

That's it! May need a tweak for speed by using a slightly different value instead of 40 in the box, but that's the design.

As to your first question: I'm not sure, but what you've done in your sandbox animation looks correct. I suspect 40 dots per 100ms.

Re: question 2: there are several different research articles that describe the set up for dynamic visual noise, but I think they have in common changing the color from white to black or black to white, but I don't recall white to white or black to black. That would be my best guess. In any event, again, the runtime animation that you've done looks correct.

I have a Flash (ActionScript 3) version (code and Fla). Unless I am misunderstanding, your sandbox version is Opus Flex. So, the question is whether this can be done in Opus Pro?
That would be the goal.

Kind Regards,

_________________
Stephen


For this message Stephen has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: TV static/white noise animation in Opus Pro
PostPosted: February 23rd, 2011, 12:29 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Yes, you are misunderstanding. It's Adobe Flex :-(

As I said above, my primary believe is that Opus simply will not handle 6400 native objects on screen.

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 62 posts ]  Go to page 1, 2, 3, 4, 5  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 24 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group