Writing (or coding) waveshapes

Discussion forum for G-Force users

Moderators: BTT, andy55, b.dwall, juxtiphi

Post Reply
PsyForce
Posts: 2
Joined: Thu Jun 03, 2010 6:01 am

Writing (or coding) waveshapes

Post by PsyForce »

Hey all,

I've been messing around a bit with coding waveshapes without much success. I've also noticed that even some of the existing scripts don't show up in the G-Force toolbar. Does anyone have any insight or pointers on how to get started?

~J
=====<The PsyForce>=====

jerohm
Senior Member
Posts: 419
Joined: Fri Jan 09, 2009 5:19 pm

Updated 2010Jun04

Post by jerohm »

Starting off with someone else's config that is already working and making modifications (until you break things :lol: ) is probably the easiest way to get started.
Printing out and assembling the documentation that exists is handy.
Boning up on basic trig functions is a MUST (RE: http://en.wikipedia.org/wiki/Polar_coordinates , http://people.hofstra.edu/Stefan_Waner/trig/trig2.html ).

Getting comfortable with the functions that are available, various variable TYPES, and WHEN they get (re)evaluated is important. You are working with a very minimalist, yet powerful, set of elements, so you need to UNDERSTAND their properties/limitations and EXPLOIT them to the fullest (translation: Be Clever!)

Level II: http://www.math.utah.edu/~treiberg/Pers ... rspect.htm

Debugging can be a nightmare, because there is basically no way to do it, other than be very methodical, incrementally evolutionistic (that a word?), and ALWAY save the previous version.

I never have seen it specifically stated, but YOU CAN'T skip a variable, or things SILENTLY don't work. What I am trying to say, for example is if you define/use 'B4', there BETTER BE 'B0', 'B1', 'B2', and 'B3'. They can be used as just place holders. i.e., 'B2=""', but MAKE NO MISTAKE, THEY GOTTA BE THERE!! I encountered THIS problem mostly when I was cleaning up/optimizing something that I HAD working! --- very frustrating!!!

The other poorly defined concept is 's'; which is actually VERY basic to the task. The Waveshape config draws frames over time. For the construction of each frame, 's' varies from 0 to 1 in 'NUM_S_STEPS' and is AVAILABLE to (help) connect the 'dots' (aka X_,Y_ coordinates). 's' can of course always be scaled by multiplying it to a value or 'C' variable. Each set of (X_,Y_) define a unique frame OBJECT (coordinates). The plotting engine doesn't/can't [ directly] connect (X0,Y0) to (X1,Y1) ... of course YOU could, if THAT is what you are trying to do (study the 'Spinning Cube' if this doesn't make sense ... or even if it DOES!) There is a BIG advantage if you can define your frame object with a single (X_,Y_) set, because translating its location or size becomes a single step operation. If it takes several (X_,Y_) sets to define your frame effect, you need to operate on each one of them to move the effect around the screen; there is NOTHING wrong with that ... just more complicated/CPU intensive.

If you want an exercise that will make sure you understand the point I am trying to get across, write a Config [motionless particle] that is simply a circle and a square using ONLY 2 defined object sets, (X0,Y0) and (X1,Y1) and any other variables/functions that are at your disposal. As stupid as this sounds, you will be enlightened, when you complete the task. 8)


Start simply constructing a figure and THEN attempt to vary(/move) it over time.
For me, I assembled a notebook of the available documentation that sat around for more than a YEAR, before I ever tried my hand at programming Waveshapes. The stuff can overwhelm you if you don't start off with baby steps, but is incredibly satisfying when you create something others have yet to do... and believe me, there is some good stuff out there, to strive to beat.

Don't incorporate 'rnd()' UNTIL you are pretty happy with your current state. It is MUCH easier to deal with code that behaves the same way on each iterative run :)

When you feel the least bit comfortable with you environment, be creative and envision the effect you would like to create (It is great to have a defined goal). Hopefully you will have (somewhat of) a grasp on the hows and whys, and NOW only need to face the 'WHY NOTs' head on!


This is probably grossly inadequate, and missing important concepts/hints, but am I am sure JayPro and others can help fill in the blanks.

Luck and looking forward to seeing some of your results posted.

almost forgot, a Waveshape can be classified as ONLY a particle given the proper 'Meta' parameters, and that is probably why you missed certain config entries ... look under 'Particles' and see if they are listed there.

Time for some shameless :twisted: self promotion of YouTube test videos (nothing special ... just playing around with resolution quality):
http://www.youtube.com/watch?v=zx-B5Wa35JM
http://www.youtube.com/watch?v=DZLjoXLX8PE (new 6/5)

I got special permission from SoundSpectrum to do this ... so don't try this at home, without FIRST asking (nicely!)
Last edited by jerohm on Sat Jun 05, 2010 8:09 am, edited 4 times in total.

User avatar
JayPro
Posts: 738
Joined: Sat May 01, 2004 10:51 pm
Location: Huntington Station, Long Island, New York

Post by JayPro »

Jerohm certainly addressed certain dynamic issues of waveshape scripting alot better than I, as I have little experience in programming languages. It would be a fair cop on my part to say that most all of the configs I've made are adaptations of preexisting ones, from one degree to another.

I can corroborate, tho, the need to declare variables starting with 0 and not one. Also, Meta values, as I've said many times here before, are a necessary aspect of wave/particle scripting. Jerohm's descirption of the "s" parameter would beat mine senseless, too.
PS: I see some new waveshapes. The one that to me looks like a cross between a DNA helix and spectrum analyzer bar is sweet.
"God is syntax."

PsyForce
Posts: 2
Joined: Thu Jun 03, 2010 6:01 am

Post by PsyForce »

Thanks jerohm & JayPro, I haven't had a chance to look at everything in depth, but it looks like you've given me enough to keep me going for a while!

One question that I did think of, is there a particular syntax that is used? From my short lived days of programming, it seems like some form of C, is that correct?

p.s. I checked and the ones that were 'missing' are actually particles. :)
=====<The PsyForce>=====

jerohm
Senior Member
Posts: 419
Joined: Fri Jan 09, 2009 5:19 pm

Post by jerohm »

PsyForce wrote:...
One question that I did think of, is there a particular syntax that is used? From my short lived days of programming, it seems like some form of C, is that correct?
nope... not it any traditional sense. The SCRIPTING language IS a 'C' dialect, refer to '\Program Files\SoundSpectrum\G-Force\Resources\Common\Startup.txt' for an example. It is something COMPLETELY SEPARATE from the 'Config' files Don't get the two confused.

Minimalist is the mantra. Everything is in the form:
<variable>="expression"

There is no program flow support in the form of 'if/then/else', 'while', '?:', or '{statement blocks}' (although GF4 brings 'select()' to the table) ... which is EXACTLY the reason why you should be so impressed with what CAN/HAS BEEN accomplished ... something FEW, REALLY can appreciate.

You need to think of EVERYTHING in terms of 'Less than Zero', 'Equal to Zero', or 'Greater than Zero'. You have SO LITTLE at your disposal, it CAN lead to non-intuitive constructs, in order to accomplish a feat.

One way 'Conditionality' CAN be accomplished in the form of a logical expression, i.e.,
B0="((s < .5)*sin(t)) + ((s >= .5)*cos(t))" // LOOK Ma!, No '(casts)' !!!

<Aspc,Stps,ConB,Num,Meta> DEFINE the attributes of the 'Config'
<A>Variables get evaluated ONCE, at the time of the 'Config' invocation.
<B>Variables get evaluated at the BEGINNING of each frame.
<C>Variables get evaluated for each STEP while constructing the frame.
<D>Variables ... topic for some OTHER day (FLOWFIELDS)!!!
<X,Y,LWdt,Pen> are ASSIGNED for each point within the frame, defined by the 'Config'

There are a few other things, but you don't need to know them right now...

(It is SOMETIMES BETTER to be consistent than correct.. of course you ultimately need to be BOTH ;0)
j
PS: I really LIKE this, h t t p ://www.youtube.com/watch?v=mQMVHhxTtLc&feature=related , but YOU don't have to :wink:

User avatar
JayPro
Posts: 738
Joined: Sat May 01, 2004 10:51 pm
Location: Huntington Station, Long Island, New York

Post by JayPro »

My understanding of D vars is that they're used to further the randomization parameters expressed initially in A.

Eg:

A0="5+rnd(10)"
A1="a0*5" <btw notice lowercasing.

D0="(a0 + a1) *100"
D1="d0 * a0"

Too simplistic an explanation mebbe? ;)
"God is syntax."

jerohm
Senior Member
Posts: 419
Joined: Fri Jan 09, 2009 5:19 pm

Post by jerohm »

with a little gentle prodding from Andy, I incorporated MCP perspective equations w/ Jacobs Ladder. MCP.txt is a GREAT example of 3D/Camera perspective, but I wouldn't tackle it until you are comfortable with the basics ...

h t t p ://www.youtube.com/watch?v=Xjm6ZxRRUYI

I JUST uploaded this @ 8:30 est, so it might get a bit clearer as YouTube refines its processing. There is no flowfield support and the audio is a bit slurred, but I don't expect to leave it up for long either. I KNOW I need to fix the arc length function.

jerohm
Senior Member
Posts: 419
Joined: Fri Jan 09, 2009 5:19 pm

Post by jerohm »

( :oops: , one more time... )
ask questions IF you think you may actually USE it ...
( or if you determine it mangles your code )
( Life without Braces is TOO painful ;0)

enjoy, or not
j

( BE FOREWARNED, Multi-line '/* */' style comments are almost SURE to cause grieve - CERTAINLY IF used to comment out CODE segments. I have no intention of addressing THIS issue)


If you haven't grasp the relevance of this, take a config such as ...\Gold\Twin Falls.txt and run it through the script. Then, EDIT the output and delete, or comment out, some the lines tagged as '[UNREF]'. Run the edited output through again. Determine for yourself, if it may be useful if you want to modify your own configs to ADD/SUBTRACT/ORDER [new] variables.

Code: Select all


# gfclean.pl    JRM
#   Flags UNDEFined, Marks UNREFerenced, REASSIGNs/Compresses IDs to definition order.
#   does NOT validate matched '&#40;' '&#41;' or other syntax issues.
#
#   >> You WILL &#91;most likely&#93; need to edit the output and re-run until satisfied - jrm
#
#   ASSUMES XP32 && ActivePerl &#40;otherwise you are on your own...&#41;
$verbose=0;

die "Usage&#58; gfclean.pl config.txt > out.txt\n" 
    if&#40; $#ARGV == -1 &#41;;

while&#40;<>&#41;       # Edit to <DATA> for Test Case &#40; __END__ &#41;
&#123;   push&#40; @lines, $_ &#41;; chop;
    &#40;$line= $_&#41; =~ s/\/\/.*//;
    $lineno++;

#   print "&#91;$_&#93;\n";
    foreach $vtype &#40; 'A', 'B', 'C', 'D' &#41;
    &#123;   $_= $line;
        if&#40; /^\s*$&#123;vtype&#125;&#40;\d+&#41;\s*=/i &#41;          # Definition
        &#123;
            if&#40; defined&#40; $Defs&#123;$vtype&#125;&#91;$1&#93; &#41;&#41;
            &#123;   print "//&#91;Warning&#93; PREVIOUSLY Def&#58; $&#123;vtype&#125;$1 at $Defs&#123;$vtype&#125;&#91;$1&#93; \n"
            &#125;
            else
            &#123;   print "Def&#58; $&#123;vtype&#125;$1\n" if&#40;$verbose || 0&#41;;
                $Defs&#123;$vtype&#125;&#91;$1&#93;= $lineno;

                push&#40; @&#123;$NewIds&#123;$vtype&#125;&#125;, $1&#41;;
            &#125;
        &#125;
                                                # Reference
        while&#40; &#40;$no, $tail&#41;= /\W$&#123;vtype&#125;&#40;\d+&#41;&#40;&#40;\D|$&#41;.*&#41;/i &#41;
        &#123;   print "  Ref&#58; $&#123;vtype&#125;$1\n" if&#40;$verbose || 0&#41;;
            push&#40; @&#123;$Refs&#123;$vtype&#125;&#91;$1&#93;&#125;, $lineno &#41;;
            $_= $tail;
        &#125;
    &#125;
&#125;

# Definitions that are never referenced are technically ok
# References without Defintions are ALWAYS an Error

$errcnt=0;
foreach $vtype &#40; 'A', 'B', 'C', 'D' &#41;
&#123;   print "Refs&#123;$vtype&#125;&#91;$#&#123;$Refs&#123;$vtype&#125;&#125;&#93;\n" if&#40;$verbose || 0&#41;;

    for&#40; $no= 0; &#40;$no <= $#&#123;$Refs&#123;$vtype&#125;&#125;&#41;; $no++&#41;
    &#123;
        if&#40; defined&#40; $Refs&#123;$vtype&#125;&#91;$no&#93; &#41; && !defined&#40; $Defs&#123;$vtype&#125;&#91;$no&#93; &#41;&#41;
        &#123;   $errcnt++;
            print "&#91;Error&#93; $vtype$no NOT Defined, but Referenced @&#91;"
            , join&#40;', ', @&#123;$Refs&#123;$vtype&#125;&#91;$no&#93;&#125; &#41;, " &#93;\n";
        &#125;
    &#125;
&#125;

if&#40; $errcnt == 0 &#41;
&#123;   $lineno= 0;

    while&#40; $_= shift @lines &#41;
    &#123;   
        chop; $lineno++;
        foreach $vtype &#40; 'A', 'B', 'C', 'D' &#41;
        &#123;
            $newId=0;
            foreach $no &#40; @&#123;$NewIds&#123;$vtype&#125;&#125; &#41;
            &#123;
                if&#40;&#40; $Defs&#123;$vtype&#125;&#91;$no&#93; == $lineno &#41; && !defined&#40; $Refs&#123;$vtype&#125;&#91;$no&#93; &#41;&#41;
                &#123;   print "$&#123;vtype&#125;$no is Defined, but NOT referenced\n" if &#40;$verbose || 0&#41;;
                    s/&#40;\/\/&#41;&#40;\&#91;UNREF\&#93; &#41;?/$1\&#91;UNREF\&#93; / || s/$/\t\t\/\/&#91;UNREF&#93; /;

                &#125;

                if&#40; $no != $newId &#41;
                &#123;   print "//&#91;REASSIGN&#93; $&#123;vtype&#125;$no -> $&#123;vtype&#125;$newId\n" if&#40;$lineno == 1&#41;;
                    print "* "
                        if&#40; s/&#40;$&#123;vtype&#125;&#41;$&#123;no&#125;&#40;\D|$&#41;/$1_#_$&#123;newId&#125;$2/ig && &#40;$verbose || 0&#41; &#41;;

                &#125;
                $newId++;
            &#125;
        &#125;
        s/_#_//g;
        print "$_\n" if&#40; !&#40;$verbose&#41; || 1&#41;;
    &#125;
&#125;

__END__
// Test Case goes HERE!
Last edited by jerohm on Thu Jul 22, 2010 5:04 am, edited 1 time in total.

bnh
Posts: 59
Joined: Fri Jan 19, 2007 7:11 pm

Post by bnh »

Using G-Force 3.92, Stand Alone, with W7 on a dual core.

I also have no background in math or programming but picked up scripting and deconstructing config files as a learning technique. Learning through deconstruction has been a painful but appreciative process. What a brilliant product this is. It’s interesting to read the discoveries made by other deconstructionists which mimic my experience, e.g. the light-bulb moment when you learn to work backwards with variables (eliminate A3 before you eliminate A2, or eliminate X3/Y3 before you eliminate X2/Y2, and always start with X0 or A0 rather than X1 or A1.)

There are still a couple of basic concepts that remain illusive to me. One of my deconstruction techniques is to build a config file and try to analyze the results. The following question concerns the concept of “frames” and the activation of the different variables, e.g. A, B and C.

Question 1: Frames, Variables and When

I wrote the script shown below to grasp the concept of “frames” as it relates to the different variables.

Image
http://www.bnh.net/gforce5.png


In the Task Bar's drop down menus, every WaveShape, FlowField, Sprite and ColorMap was unchecked, except for the WaveShape config file indicated (test1-2.txt), the single FlowField marked (Empty) is checked, and only one ColorMap is checked (A Distant Fire because it’s easy on the eyes.)

For a while (a long while) I was confused as to why the A variable object (X0/Y0) was moving, since it is only supposed to be evaluated once….when the config is loaded. And then I realized the green dot in the Task Bar beside the WaveShape was checked (see photo), which means there’s another independent cycle at work here. Even though Task Bar is cycling as a loop, it's another cycle that collects a random variable to be added to X0/Y0 . I am still a little puzzled why the movement of that object was rather smooth and consistent in the direction towards 0 (center) and then away to its maximum coordinate. Anyway, it’s all pilot error isn’t it? When I clicked on the WaveShape dot and made it red, the A variable object stopped moving and my sanity was restored.

The movement of the B variable as demonstrated in my little config is clear. “Frame” in this context refers to the number of frames per second, (or the refresh rate of the monitor’s screen) which is akin to the classic animation of still images cycled at a given rate. While in NTSC video, that rate is fixed at 30 frames per second, in digital video, that rate is itself variable. The frame rate is controlled on the Task Bar with the blue button on the far right. As one moves the button to the left, the frames/second value slows down, which causes the B variable to move more slowly. So, the B variable takes a random number, adds it to the given coordinate for the X1/Y1 object (.2) and waits for the next frame, then takes the next random number, adds it to the (.2) location, moves to that new location, etc. That I understand. No problem. So the change in the position of X1/Y1 is directly related to the cycle of the frames/second value.

The C Variable is almost clear, but I still have a few questions. I’ll present my understanding and hope for clarification. The C object variable (X2/Y2 in my config) is changing (I’m guessing) at the fastest speed the CPU will allow. So as the CPU ticks, it waits for the next random number to appear and moves to that new location (in this case along the Y axis) just as fast as it can. The fact that it is changing so fast and by such a random interval causes the vertical line to “quiver.” So the C variables don’t sit around and wait for the next frame/sec ond/cycle. Instead, they just buzz along and do their thing as fast as possible.

But …….

I’m also guessing that once the magic “s,” “t” and “stps” functions are added to a line of code, this “go- as- fast- as- you- can” cycle for the C variable changes. Do the “s,” “t” and “stps” functions become independent determinates as to when things change? Do they trump the “go- as- fast- as- you- can” cycle for the C variables? And how does “s”, “t” and “stps” work with the A and B variables? Are the rules of “when” to be read UNLESS there is a “s”, “t” or “stps” function at work?

I tend to think of the “s” function as “make things happen”, or “go to that value,” or just simply “move.” When in doubt, I add another "*s". I still don’t fully grasp that "s" function. And why not " + s" ? Why is it "times s," or does it really mean "times/multiply" in this scenario? Why is it " * BASS" and not "+ Bass". If there's nothing else in a line of code, then just "BASS" will work, e.g. A0="BASS". Does * really mean times in these examples, or does it just mean "and include that component as well." And why does A0="+.5" generate a tilt, but A0="-.5" does not. And what's the difference between 0.1 and .1? I just start changing the code until I get something that works when these little things happen, but I'd really like to hear a definitive explanation. And spaces? Some people use lots of them, others eliminate them. A space after a "(" and before a "+" but not after a ")" or a "sin?" What's the rule of spaces? And now JayPro indicates there's a correct instance for using lower-case A's and B's, but I've seen many config files written in all lower case.


Question 2: Refresh Problem

Using the “u” or” Shift + U” keyboard command has never worked for me. I know there is a keyboard command built into the G-Force platform that is supposed to refresh the particular WaveShape (or any config) you are working on without having to re-boot the program. You’re supposed to be able to type “u” (for update), and G-Force will re-fresh the screen so you can see the results of the changes you just made (after you have saved the file to the appropriate folder). So,

1. Save your latest version of the file upon which you are working.

2. Mouse-click on the G-Force screen to make it active so it will accept keyboard commands. (An important little detail that was omitted from the Documentation but intuitive to all the math wizards).

3. Hit the “u” key on the keyboard. There’s also a variation to this command, which is Shift + U. If you give your newly modified config file a new name, e.g. “telephonepole1-9”, it will pick up that new file and add it to the list of WaveShapes that are available for use. And, it will automatically check that new file to make it active.

I can get all the other keyboard commands to work as described, I’ve written a lot of scripts and controlled the script programs with keyboard commands, but I still can’t get this “refresh” function to work when I’m trying to modify a config file. So, I have to Close G-Force, save the newly modified file, and then re-open G-force to make sure I am seeing the results of the changes I just made.

If anyone knows why, I’d appreciate a hint.

jerohm
Senior Member
Posts: 419
Joined: Fri Jan 09, 2009 5:19 pm

Post by jerohm »

First thing, TURN ON VERBOSE MODE; Select(left click) the standalone window, & then enter Lowercase('v'). If you want Lowercase('u') to work, FIRST Select & SAVE the modified notepad file using CTRL('s'). Then Select the standalone frame and press Lowercase('u'). You will ALSO notice all your green lights on the toolbar will go to RED and the current Waveshape, ColorMap, and Flowfield will remain (slideshows OFF).

For each frame, 's' is STEPPED in increments, 'STPS' times from 0 to 1.

The reason your 'C' object looks like a line, is because the 'C' variables get evaluated for eash STEP, 's' ... EVEN IF Cx is NOT A FUNCTION of 's' ... you really have, For each STEP OF 's', A point defined by X2=".3" and Y2=".2+rnd(.5)" connected by a line (ConB=1) ... and since the Y coordinate is jumping randoming, it looks like it is quivering.


Your 'A' (Dot) object should remain at a fixed location for the duration of the Waveshape display (PDur ... kindof... ;0)

Your 'B' (Dot) object should be bouncing [RANDOMLY] up/down at the Frames/Second rate ... it IS. isn't it??? ( I KNOW it is, but no one else viewing your png could tell! ) X1/Y1 is ALSO REALLY getting evaluated for each step, but since B variables are only evaluated at the start of the frame, it is the same value for each 's' of ANY given frame... make sense??

Lets use C0 as a function of 's', which goes from (0->1) for each frame.

C0="(A0 * s )" // Now your C object (LINE) should calm down.

(I only used A0 'cause I am lazy ... you could use a constant or another Ax variable)

You are on the right track. It is important to UNDERSTAND the limits/constraints of your working environment. Debugging is a bitch. You [MOST LIKELY] will have to employ [SMALL] incremental/evolutionary [DEVELOPMENT] techniques, so make it as painless as possible for yourself, BEFORE [YOU START] tackling bigger and better things.

http://en.wikipedia.org/wiki/Polar_coordinates is a nice analytical geometry primer/refresher, when you move on to objects a little more complicated than a single point (Dot).


I am sure I forgot to answer some of your questions, but lets get THIS stuff squared away first ... (then add THIS to your test config...)

Code: Select all

C1="sin&#40;2*PI*s&#41;"
X3="&#40;2*s&#41;-1"
Y3="C1"
or better yet :D :

Code: Select all

C1="sin&#40;2*PI*s&#41;"
C2=".2*sin&#40;t/2&#41;" // This REALLY SHOULD be a 'B' variable ... why? ... try it!!
X3="&#40;2*s&#41;-1"     // -1 -> +1, extends over the entire screen
Y3="C1 + C2"     // WHEN you TRY to make C2 a 'B' variable, make sure to change it here too!
and WHY didn't I feel compelled to have an multiple of PI in the ".2*sin(t/2)" oscillator expression ... hmmm???

Now let's throw all caution to the wind and go FULL TILT

Code: Select all

C1="sin&#40;&#40;2*PI*s&#41; + t&#41;"  // Don't skimp on '&#40;&#41;' UNLESS you are really SURE!
B1=".2*sin&#40;t/2&#41;"
X3="&#40;2*s&#41;-1"
Y3="C1 + B1"
And if you twist my arm ...

Code: Select all

C1="sin&#40;&#40;2*PI*s&#41; + t + mag&#40;s&#41;&#41;" // The built-in audio sources are probably the BEST choice HERE
B1=".2*sin&#40;t/2&#41;"
X3="&#40;2*s&#41;-1"
Y3="C1 + B1"
OR does THIS make MORE sense/any difference/desirability? ...

Code: Select all

C1="sin&#40;&#40;2*PI*s&#41; + t&#41;" // The built-in audio sources are probably the BEST choice HERE
B1=".2*sin&#40;t/2&#41;"
X3="&#40;2*s&#41;-1"
Y3="C1 + B1 + mag&#40;s&#41;"
(The answer is visually similiar, but PROBABLY LOGICALLY more coherent ... desirability? ... questionable)
AND WHY didn't I even CONSIDER adding the 'mag(s)' as part of the B1 expression????

(ponder &) have fun!

bnh
Posts: 59
Joined: Fri Jan 19, 2007 7:11 pm

Post by bnh »

Thank you jerohm and jaypro for your help and your patience. I really appreciate it.

I have converted my original test2-1.txt config file and each variation jerohm suggested into a .mov file. Adjacent to each Stand Alone rendering of the config file is the actual config .txt file in play so those interested can follow along or recreate the file for their own study. Below are the links to these .mov files.

I don’t know if this effort is of interest to anyone else so I didn’t include a line-by-line reading of the code. If anyone is interested they need only ask. A line-by-line reading is probably essential for those without a math or programming background, but since most users appear to be much farther along in their math skills, it may not be worth the trouble.

The only configs checked in the Task Bar during this exercise (implying they do not change, loop or cycle) are:
WaveShape – this test config file called Test2-1.txt shown on the right of each QuickTime .mov file
FlowField – {Empty)
ColorMap – A Distant Fire

http://www.bnh.net/gforce/gforce3-1.mov

The above is the QuickTime video of the original conf file I wrote to show when variables are evaluated. The A Variable object represented by X0/Y0 doesn’t move because the A Variable is only evaluated once. The B Variable object represented by X1/X1 bounces up and down because its position is being evaluated once per frame, and the frame rate has been lowered to the point where you can easily see it change. The C Variable object looks like a quivering line because it is evaluated at a much faster rate.

The position of the A Variable object will shift from congif file to config file because the random number selected will change every time it is loaded. By looking at all the config files referenced below, you can see the A Variable object change position along the horizontal X axis.

http://www.bnh.net/gforce/gforce2-1.mov

This above .mov file includes the incorporation of “s” into the C variable as suggested by jerohm . It also uses a random number selected by A0, which, since A Variables are only evaluated once, calms the “quivering” demonstrated in the previous .mov file. The C Variable object is not as long as the previous example because it is locked to the “one-time-only” random number from the A Variable, which in this instance, just happened to be a small number. Every time this config, file is loaded, the length of the C Variable will change because the A Variable will produce a different random number.

http://www.bnh.net/gforce/gforce1-1.mov

To see the effect of “s” on the C Variable, I went back to my original code, removed A0 from the definition of C0 and put in its place the rnd(.5) random number generator. The effect of “s” on the original C Variable can be seen.

http://www.bnh.net/gforce/gforce5-1.mov

The above referenced link adds the modifications suggested by jerohm. It produces a sine wave (both the positive and negative halves, hence the expression (2*PI), and it locates the coordinates for this new object using X3/Y3. The sine wave extends from the -1 coordinate on the X axis, which means the far left edge of the screen. And since it’s a full sine wave, it extends across the screen.

http://www.bnh.net/gforce/gforce6-1.mov

The above referenced .mov file asks to see what would happen if the sine wave did not contain both halves. So, instead of (2*P * s), the line is changed to (1*P * s) and the results are shown. This is the kind of playing around that can be done to deconstruct the math behind G-Force. It’s play time. For those of us without a math background, it’s the long road to understanding G-Force … the self-taught road.

http://www.bnh.net/gforce/gforce7-1.mov

http://www.bnh.net/gforce/gforce8-1.mov

http://www.bnh.net/gforce/gforce9-1.mov

The above three links show what happens when you start changing the values in X3. More play time, more insight.

http://www.bnh.net/gforce/gforce11-1.mov

At the suggestion of jerohm, the above .mov file shows the results of a new config file that incorporates several changes. First, it adds the “t” function, which represents real time, i.e. seconds. I cannot confirm that “t” equals any specific amount of time, e.g. one second. It is more like a time index, an interface to a clock. In this example, the “t” function is added to the Y axis of the sine wave through B1 and Y3. I have exaggerated the Y movement by changing .2 to .4 .

Adding the ”f” function causes the the position of the sine wave (as defined by the coordinates ) to change over time, which makes the sine wave appear to move across the screen.

This .mov file also shows the addition of what I call the” sound-modifying components” in G-Force,e.g. mag, fft and BASS . The mag sound modifying component is added and defined in C1, which then becomes added to the Y axis of the sine wave in Y3.

The G-Force Task Bar has a built-in sound generator which I show being activated in the .mov file. You can see my cursor open the drop down menu and select the “high energy” setting for the built-in sound generator. You also have to make sure you have the volume sensitivity control on the Task Bar (the bottom little blue dot on the far right) turned up (move it to the right to increase sensitivity). As you can see in the .mov file, I have moved the blue button to the the half way point.

None of this is pretty because there are no Flow Fields or Color Maps involved in this testing phase. These configs are simply used to understand the math and coding behind G-Force.

http://www.bnh.net/gforce/gforce12-1.mov

At the suggestion of jerohm, the “sound modifying component “mag” is moved from C1 to Y3, and the results -- both before and after activation of the “sound modifying component” -- are shown.

In addition to the shift of the mag function, I have changed a few numbers in other elements to observe the results. More play time. Making of these small changes leads to an understanding and appreciation for the complexity of G-Force.
Last edited by bnh on Sat Sep 04, 2010 1:08 pm, edited 2 times in total.

jerohm
Senior Member
Posts: 419
Joined: Fri Jan 09, 2009 5:19 pm

Post by jerohm »

Nice Job! Since you seem to show an interest and willingness to document, lets try something a little different. Let's create a new WaveShape Config and let's name it:
'(New) mine.txt'. Any guess WHY I chose that name [HINT: consider the format of the name, NOT the name itself]. hmmm???

[I am PURPOSELY gonna make you edit instead of just cut & paste ... too bad :wink: - first snippet is a freebie]

Okay,

Code: Select all

Aspc=1
ConB=1

A0="PI * 2"			// Constant
C0="&#40;A0 * s&#41;"

A1=".5"
X0="A1 * cos&#40; C0 &#41;"
Y0="A1 * sin&#40; C0 &#41;"


Meta="reactive=5 detail=3 density=2 morphable=4"
Vers=390
First thing, we are going to cheat a bit and list it's Meta reactivity a "5" ... wanna take a guess why? ....

Okay, THAT was fun, but probably NOT going to get you any accolades. What would happen if you modified A1??

Code: Select all

A1=".5 + rnd&#40;.25&#41;" // Edit A1
That may be useful! ... well THIS worked before, so let's try:

Code: Select all

C0="&#40;A0 * s&#41; + &#40;t/2&#41;"  // Edit C0
WTF!, nothing... hmmm? ... Guess we can try somethin else.

Code: Select all

A2=".5 + rnd&#40;.25&#41;"  // Add this line

Y0="A2 * sin&#40; C0 &#41;"  // Edit A1 -> A2
OKay!, now we are back on track. Now for some slight of hand...

Code: Select all

Aspc=1
ConB=1
Stps=5  // What about setting this to 4 or 6

A0="PI * 2"			// Constant
C0="&#40;A0 * s&#41; + &#40;t/2&#41;"

A1=".5 + rnd&#40;.25&#41;"
A2=".5 + rnd&#40;.25&#41;"
X0="A1 * cos&#40; C0 &#41;"
Y0="A2 * sin&#40; C0 &#41;"


Meta="reactive=5 detail=3 density=2 morphable=4"
Vers=390
Bettcha didn't see THAT coming :o ! What if Aspc=0 ??
Since you have been so patient, let's set:
FlowField to 'Simple Sine - Sphere'
ColorMap to 'Dark Obsession'
far out 8) !

BTW, check the WaveShape List and notice the position of Your New config '(New) mine' in the list (you DID take my naming recommendation, didn't ya?!!). Why did I say we cheated setting the reactivity to '5'??


You have a lot to digest here, Have [MORE] Fun!

One last thing, I run with Flowfield Unions (under Visualization Prefs) OFF because it can lead to [MY :? ] confusion during the development stage

bnh
Posts: 59
Joined: Fri Jan 19, 2007 7:11 pm

Post by bnh »

Jerhom is getting crafty. He threw in a couple of twists and I don’t know if I got them all.

In the above post, jerhom offers his “(New) MIne.txt” WaveShape along with a suggestion to change the Meta Reactivity number from from 4 (in my previous config files) to 5 in this new file.

I remember jaypro pointing out in another post that one way to get WaveShapes into the Particle category is to change these Meta Reactive numbers. As I understand it, these values have nothing to do with the operation of the WaveShape per se, but are simply a method of coding files so they can be listed in different categories. In other words, a WaveShape could also be used as a Particle file by simply changing these Meta values, although there appears to be some exceptions to this blanket statement. I remember trying to get some WaveShapes into the Particle folder by changing the Meta values and it didn’t work.

Anyway, I set up 4 test files that included different file names and different Meta Reactive numbers.

jerhom had stipulated that his file name was to be written in a curious format. The parenthesis did not enclose the entire file name. Only the first word in the file name was enclosed in parenthesis. Would there be a difference if the entire file name were in parenthesis instead of just the first word?

I then added another variable by adding a version number at the end of the file name, e.g. 1-1, 1-2, etc. What follows is a list the file names and their variables:
  • 1. File name “(New)Mine1-19.txt”
    Parenthesis around first name only
    Meta Reactive value =5
    2. File name “(New)Mine1-20.txt”
    Parenthesis around first name only
    Meta Reactive value=3
    3. File name “(NewMine1-21).txt”
    Parenthesis around entire file name
    Meta Reactive value= 3
    4. File name “(NewMine1-22).txt”
    Parenthesis around entire file name
    Meta Reactive value=5
I knew from previous work with script files that putting a parenthesis around a file name stopped the Toolbar from automatically including the name as an available WaveShape --by automatically checking that file name -- during boot. In other words, file names with parenthesis were supposed to be reserved for scripting use, unless you deliberately went into the Toolbar’s drop down menu and clicked that particular file name.
This might prevent any file using parenthesis from being randomly selected during the initial boot mode where the G-Force logo and registration ID are on display, unless the file parenthesized file is deliberately checked. This possibility is not a factor in my construction of WaveShapes since I always uncheck the entire list of files and pay no attention to the first combination of WaveShape-ColorMap-FlowField that appear. In other words, I didn’t test out this last theory.

So what were the results of the parenthesis and Meta Reactivity tests?

Exercise 1
Image

The photo above (list7.png) shows that regardless of whether or not the file name was completely enclosed in parenthesis or just the first word was in parenthesis, G-Force would pick up the new file name and include it in the WaveShape menu, BUT the file would not be automatically checked. The automatic inclusion into the WaveShape menu happened regardless of the variation in the Met Reactivity value.

Exercise 2:
Image

The same results do not apply to the Particle folders, at least not in version 3.92. The photo above (list8.png) shows that if only the first word of the file name was in parenthesis, and if the Meta Reactive value were changed from 5 to 3, the file would be included (but not checked) in the Particle menu. If the file name was completely enclosed in parenthesis but its Meta Reactive value was also 3, the file name would not be included in the Particle menu.

Exercise 3:

Image
The problem with this conclusion is that there’s another variable at play here as shown in the photo above (list9.png) . When G-Force is closed, the Toolbar remembers the settings of the files so that when you boot G-Force again, the files you had checked previously will show up as checked again, EVEN IF they include the parenthesis-exclusion format.

Since files 1-19 and 1-20 had been previously checked before I closed G-Force, they remained checked when G-Force was reopened, even though they contain the parenthesis-exclusion format. The other files shown, files 1-1 through 1-9 were not included in the WaveShape folder, and therefore not checked, when I closed G-Force. These new files (1-1 through 1-9) were added when the G-Force was closed, and therefore, when it was re-booted, the new files were included but not checked.

Exercise 4:

Image

Using the parenthesis did put the new file name at the top of the menu in alphabetical order, but that wasn’t a real advantage.

Enclosing part of the file name in parenthesis and enclosing all of the file name in parenthesis also mixed up the sequential listing of the files in Toolbar, as shown in the above photo (list6.png) As the list of variations grew, i.e. 1-1 through 1-22, I could see that G-Force alphabetizes file names with a format that treats numbers in non-sequential order. For example, a file name that ends with 10 follows the same file name that ends with 1 (see photo above). A file name that ends with 2 follows the same file name that ends with 19, etc. I was aware of this phenomenon in computer coding Standards regarding the alphabetizing of numbers, so this was no big deal. But it does make the selection process slightly more confusing when you’re looking for a specific file.

Conclusion Summary:
  • 1. If the entire WaveShape file name is enclosed in parenthesizes, e.g. (NewMine1-1).txt, the file name will not be picked up and checked as a new Particle file during boot, even if the Meta values are appropriate for inclusion as a Particle.

    2. If only the first word of a WaveShape file name is put in parenthesizes, as in jerhom’s example, and if the Meta values are suitable for inclusion of these WaveShape as a Particle, the file name will be included in both the WaveShape and the Particle categories after a fresh boot. The file will appear but it will be unchecked.
Enough on this problem of parenthesis. The moral of the exercise is being aware of what files are in play when you construct WaveShapes and Particles. It is possible to create a WaveShape and have it appear as checked in the Particle menu inadvertently, and since the Particle files are selected on a time cycle that has nothing to do with WaveShapes, you might suddenly see things changing that shouldn’t be. Using parenthesis doesn’t prevent the Particle folder from picking up the WaveShape, but it will prevent it from being automatically checked (and therefore active) while you’re working on the same file name as a WaveShape …. assuming the Meta Reactive numbers are equally compatible.

Jerhom’s Config Files

In the next phase, jerhom suggested a modification of the Aspect Ratio of the config file. Aspc=0 would be changed to Aspc=1.

The Aspect Ratio is simply the ratio of the width of the screen to the hight of the screen. In NTSC analog video, that aspect ratio was fixed at 4:3. In 35mm film (still photography) the aspect ratio was always 5:3. In digital video, which uses pixels as a unit of measure, the initial standard for digital video was also 4:3, represented by the values of 640 pixels wide and 480 pixels high. For many years, your computer’s monitor was likely 1024 x 768, which is also a ratio of 4:3. They were just cramming more pixels into the same aspect ratio.

Today, the aspect ratio is in flux. The digital video standard (DV NTSC), a common aspect ratio used in your digital video cameras (not your still-image digital cameras) has moved to 720 x 480 pixels, which is essentially the same 4:3 aspect ratio with thinner pixels. Most of the Hi-Def/HD/1080 standards that you now see in movies and on digital video broadcast channels (cable, free or satellite), will likely use an aspect ratio of 16:9, which is a very old aspect ratio established by a film technique called Cinemascope.

G-Force has an all-encompassing approach to Aspect Ratio. In jerhom’s config file, he suggests testing out the switch to Aspc=1. But I’m going to investigate Aspc=0 first.

If the aspect ratio is set to Aspc=0, the screen area of the G-Force engine, which in this case means the window of the StandAlone screen, will fluctuate as you stretch/pull the window itself.

Exercise 5:

http://www.bnh.net/gforce/new1-36.mov

The .mov file reference above shows what happens when you use jerhom’s config but vary the G-Force playback window using Aspc=0. It transforms the perfect circle, represented in A0=”2*P,” into an oval that widens with the re-sizing of the window itself. In the beginning, the window was set to 720 x 480, and therefore the figure appeared as an oval, even though the coding formula describes a perfect circle. As can be seen in the .mov file, the figure can be made to appear as a perfect circle, but only if you readjust the entire window to a square shape, a ratio of 1:1.

Exercise 6:

http://www.bnh.net/gforce/new1-37.mov

The above .mov file shows the same config but with Aspc=1. The same A0=”2*P” this time produces a perfect circle. You can see that when the G-Force window is changed, the perfect circle does not change its shape. In other words, with the G-Force Stand Alone window initially set to an aspect of 720 X 480, just as in Exercise 5, and stretched way beyond a 16:9 aspect ratio, the circle remains perfect. So Asp has nothing to do with the aspect ratio of the viewing window itself, but deals with the aspect ratio of the images drawn by the G-Force engine.

Aspc is an aspect ratio operating inside another aspect ratio. In understanding its function, the terms “window,” “screen,” “monitor,” "frame" and “viewing area” tend to become confused, but the above referenced .mov file clearly shows the difference in the two Aspc codes.

Randoms Removed

In his next bit of code, jerhom adds the random function (rnd) to A1, which changes the value of A1 every time the config file is opened: A1=”.5 + rnd(.25) This line of code says, the value of A1 will be .5 plus any number ranging from 0 to .25, to be determined every time the config file is opened --since the A Variables are only evaluated once.

Which means that A1 could be .65 (.5 + .15) the first time you open the file, and it could be .63 (.5 + .13) the next time you open the file, and .5 (.5 + 0) the next time, and .75 (.5 + .25) the next time. It’s a crap shoot.

In the first few posts, both jerhom and jaypro advocated taking out the random function (rnd) from a config file because it introduces confusion when you are trying to construct or deconstruct a WaveShape. That’s a practice I learned also from trial and error, right after I learned what the hell rnd meant.

If that rnd function is added to a B or C variable, seeing the “pure” results of the WaveShape is even more difficult. So, until the WaveShape is finished, I would avoid using the .rnd function in favor of predictability.

Exercise 7:

http://www.bnh.net/gforce/new1-6.mov

The next piece of code jerhom added involved changing C0. The above .mov file shows the config file exactly as jerhom indicated.

Exercise 8:

http://www.bnh.net/gforce/new1-9.mov

Next, jerhom instructed that C0 be changed, and he added the “t” function (time) to C0. The above .mov file shows the results of that change. Just from looking at the file, I expected to see something move. For a while, I was stumped. There didn’t seem to be any change from the previous config file.

Adding the “t” function to C0, which was already tied to the “s” function, seemed a little puzzling. Are you telling me that by adding the “t” function, you can control the evaluation rate of C0 Variables? Something was wrong as I varied the value of “t.” The changes seemed to have no effect. I kept applying new FlowFields to this WaveShape config to see if I could determine if the circle was rotating or not, but it was very difficult to see.

Exercise 9:

http://www.bnh.net/gforce/new1-38.mov

Then I thought I would modify the config to see if the circle was rotating. I added Stps=10 to jerhom’s config file, thickened the line with LWdt=”5.5”, and changed ConB=1 to ConB=0. The .mov file above shows the results of those three changes.

The circle had been broken into10 dots, each dot representing an increment of the C Variable. By adjusting the “t” function e.g. from t/2 to t/.12, I could clearly see that the circle was rotating at a speed determined by the “t” function.

I used to think that t = 1 second, but further investigation indicates it is not. For example, if t=1 second, then (t/2) would be ½ second. So I set a metronome to 120 beats per minute, which represents a beat every ½ second. I expected each dot in the previous config to be at its new location every ½ second, but they were not. Not even close. The rotation speed is close to 44 beats per second, which is considerably slower than 1 beat per second. Furthermore, if “t” were a constant value, than the rotation speed wouldn’t increase when (t/.5), and it wouldn’t slow down when (t/12). But it does.

The only information I could find is that “t” refers to a “time index” and I have no idea what that means. I also found a comment that “t” is only evaluated once, so apparently the value is fixed for the duration of the config. This may be a bit of minutia that really isn’t important.

Exercise 10:

http://www.bnh.net/gforce/new1-11.mov

Then I went back to implement jerhom’s changes. I broke the C Variable into just 5 increments by changing Stps=10 to Stps=5, added A1 and A2 to the config : A1=”.5 + rnd( .25)” and A2=”.5 + rnd(.25)”. and incorporated A1 into X0 and A2 into Y0. This means that the X and Y coordinates of the image would change independently each time the config file was opened.

The results of changing the Stps value to 5 proved interesting, as can be seen in the above referenced .mov file. The resultant image was a square.

Exercise 11:

http://www.bnh.net/gforce/new1-30.mov

If Stps=5 produces a square, what happens when Stps =4? The results can be seen in the above referenced .mov file.


Exercise 12:

http://www.bnh.net/gforce/new1-26.mov

And if Stps=3, what happens? A straight line. See the above reference .mov file. (I also took the rnd(.25) function out of the config file so I could better study the results.

Exercise 13:

http://www.bnh.net/gforce/new1-27.mov

The straight line is almost an illusion. It is actually a phenomenon of coding wizardry, which can be better seen in the above reference .mov file, where I changed ConB back to ConB=0. This shows that instead of a straight line, what one is actually seeing are two coordinates (represented by two dots) traveling around the circumference of a circle (A0). These two dots are simply joined so that they appear as a straight line. I then understood the meaning of “connect the bins,” whose abbreviation is ConB.

This also means that the square that appeared when Stps=5 was really four dots moving around the circumference of a circle, and that the dots were “connected” in series, which formed the outline of a square. The same applies for the Stp=4 triangle. The square, the triangle and the lines were simply dots moving along the circumference of a circle, connected in series very much like a “Connect The Dots” puzzle.

When I changed the value of Stps to something greater than 5, an equal-sided polygon appeared. Stps=6 produced a pentagon. Stps=7 produced a hexagon, etc.


Exercise 14:

http://www.bnh.net/gforce/new1-20.mov

I then went back to the 5-bin, 4-sided square to see if I could make it a rectangle by changing the coordinate locations of A1 and A2. I really tried to screw things up by making A1 a negative number, as can be seen in the above referenced file. I’m not sure I actually changed the square into a rectangle, but rather changed the perspective of the square as its 4 points moved around the circumference of the circle. There is the illusion of a rectangle, but I think it’s really just a square rotated on its Z axis. I’ll wait to hear the definitive answer from jerhom.

Exercise 15:

http://www.bnh.net/gforce/new1-33.mov

I also played with the values of A1 and A2 and observed that I could change the direction of rotation by changing the values of A1 and A2. This thing gets very complex with only a few lines of code in play.

Exercise 16:

http://www.bnh.net/gforce/new1-39.mov

What happens if you change Stps=2 and ConB=1? You get a single dot moving around the circumference of a circle, the same as if ConB=0. See the results in the .mov file referenced above.

Exercise 17:

http://www.bnh.net/gforce/new1-35.mov

Finally, I added the “sound movement” function BASS to the X axis of the 4-pointed, 5-binned square. Now I had a rectangle that would expand with the volume of sound on each impulse/beat/note. And, if there is no sound, the rectangle collapses into a straight line because of the values of A1 and A2. I’ve included it here for anyone’s amusement and subsequent modification.

Exercise 18:

http://www.bnh.net/gforce/new1-31a.mov

Now I have a question for jerhom.

The above .mov file shows the 4-bin triangle. The random (rnd) function has been removed from A1 and A2, both of which are fixed at .7. Therefore, in my mind, the triangle should not be zooming in and out when the A1 and A2 Variables are re-evaluated. This re-evaluation is caused by leaving the dots in the Toolbar green instead of red. I set the screen in the verbose mode so you could see that the zooming effect corresponds with the re-loading of the config file. I double checked to make sure there were no other WaveShapes in play and no Particles in play here. Yes, the zooming does stop when the dots are changed to red. Using version 3.92.

What is causing this zooming effect?
Last edited by bnh on Sat Sep 04, 2010 1:11 pm, edited 8 times in total.

jerohm
Senior Member
Posts: 419
Joined: Fri Jan 09, 2009 5:19 pm

What is causing this zooming effect?

Post by jerohm »

Damn :D ... Are we having FUN yet???? I have NEVER written anything that has been dissected with such vigor and/or scrutiny... nice! My goal is to highlight details, that NEED to be second nature. When I put forth a question, I am most likely looking for the single, MOST OBVIOUS, answer. That said, I am left speechless.

As for the zooming, that is G-FORCE (aka Andy), as a function of the [magic] morphing processes that occurs during WaveShape transitions. If the slideshow if OFF (red light), the current config (WaveShape, ColorMap, or FieldFlow) remains active (READ: morphing does not occur... Of course you can ALWAYS force a transition with Scripting or via the Control Panel.)

======================

Okay, THESE were the points I was trying to get across. Whether I did a good [enuff] job is for everybody to decide for themselves. Debugging is a bitch, so everything you can do to make it easier on yourself will be appreciated [sometime] in the future.

I suggested the naming convention '(New) Mine.txt'. In real life, I use '(my initials) Whatever.txt'. This keeps MY work clearly identifiable, grouped together, and near the top of the list... which I FIND desirable... do whatever you find MOST convenient.

Setting reactivity to 5 ensures it will be considered a WaveShape, that can be locked down (Red light, Waveshape Slideshow OFF). Particles have a 'PDur' duration you have to deal with ... not very convenient during development.

If you are working on a 'XP' system, it is also about time to start running with the Task Manager Open (Ctrl-Alt-Del).
I continuously have problems with rogue Standalone and/or Toolbar images hanging around, and they will bound to cause trouble/confusion. IT WOULD BE GREAT if other people following along on other systems, would chime in on the specifics of dealing with this situation on their system ... if they see the problem. :D

"Aspc=1" if you want your shape to maintain its proper perspective, i.e., you wanna a circle to look like a circle

Code: Select all

X'="A1 * cos&#40; 2 * PI * s &#41;"	//  &#40;A1 == A2&#41; Draws a 'Regular Polygon' BASED on 'Stps' granularity
Y'="A2 * sin&#40; 2 * PI * s &#41;" 
As 'Stps' grows (gets larger), somewhere along the line, the 'Regular Polygon' APPEARS to be a Circle. The rotation stunt was actually due to me slipping in C0="(A0 * s) + (t/2)". You caught that, right?? Well then WHY didn't the ellipse, Default('Stps') & (A1 != A2), rotate?? hmmm? It was because the rotation was a side-effect of low value 'Stps' and NOT the traditional way to rotate an object, which is done by axis rotation (google [it IS your friend!]: axis rotation equations),

Code: Select all

X="X' * cos&#40;angle&#41; - Y' * sin&#40;angle&#41;"  // where 'angle' is the rotation amount &#40;in radians&#41;
Y="Y' * cos&#40;angle&#41; + X' * sin&#40;angle&#41;" 
There was NOTHING WRONG with how we first did it, EXCEPT just BE AWARE that a more general[ly accepted] solution exists among math aficionados [/wannabes] :P

Code: Select all

Aspc=1 
ConB=1 
// Stps=6   // Best set &#91;A2="A1"&#93; when dealing with SMALL&#40;Non-Default&#41; 'Stps'

A0="PI * 2"         // Constant 
C0="&#40;A0 * s&#41;"
C1="&#40;t/2&#41;" 

A1=".5"      // " + rnd&#40;.25&#41;" remove variability 
A2="A1/1.25" // Guarantee an Ellipse 
C2="A1 * cos&#40; C0 &#41;"  // X 
C3="A2 * sin&#40; C0 &#41;"  // Y

X0="C2 * cos&#40;C1&#41; - C3 * sin&#40;C1&#41;" // C2&#40;X&#41; rotated by C1 radians
Y0="C3 * cos&#40;C1&#41; + C2 * sin&#40;C1&#41;" // C3&#40;Y&#41; rotated by C1 radians 

Meta="reactive=5 detail=3 density=2 morphable=4" 
Vers=390
This SHOULD rotate ANYTHING you want! ... Play with it! If you specify 'Stps', best to set A2="A1" to avoid confusion. Wanna see a neat trick? EDIT in these two changes:

Code: Select all

Stps=6
C0="&#40;A0 * s&#41; * 2"
If you think it through, you will understand. Another attribute of how the G-Force engine works

Now we have come full circle, and it is time to tackle the exercise I suggested back in my 03Jun post... Because we are so much smarter now, instead of a static circle and a square, we will create a star spinning in a circle ... actually we probably are NOT all that much smarter, but it represents a [more] logical step from where we've just been.

If your Waveshape config consists all of the same shape, modifying 'Stps' can prove to be convenient from several aspects. But once we specify 'Stps', we have to live with our decision.... We should be able to create a Virtual 's' equivalent that could be used specificly for a unique 'X/Y object(s)'

Code: Select all

NUM_S_STEPS - Number of Steps
DVS - Desired Virtual Steps
NUM_S_STEPS/DVS - Steps per Desired Virtual Step
1/&#40;DVS-1&#41; - Desired Step INCREMENT &#40;Why the -1?? ... THINK!&#41;

Vs= trunc&#40;&#40;s * NUM_S_STEPS&#41;/&#40;NUM_S_STEPS/DVS&#41;&#41; / &#40;DVS-1&#41;	// Dirty Details
Vs= trunc&#40;s * DVS&#41;/&#40;DVS-1&#41;								// reduced
If you don't believe me, work it out on paper assuming DVS=4. That would mean that we desire 'Vs' to have 4 values, EQUALLY distributed over 0 ->1, namely { 0, 1/3, 2/3, 3/3 } ... Really not so complicated as long as we can CLEARLY DEFINE our desired outcome


To incorporate the changes into our previous script, I needed to shift down/add some variables. If you don't like to risk editing errors, it IS TIME TO EMBRACE THE PERL SCRIPT I WROTE above. Download and install ActivePerl (free, and it is more transparent than my first suggested Strawberry Perl. The script SHOULD work with any copy of Perl, but everybody seems to handle command line argument parsing a little differently [than unix]. If you aren't running XP, the pain should STILL be minimal ... AND WORTH IT IN THE LONG RUN... bite the bullet and install things IF YOU PLAN to continue with this stuff... or don't. If you have problems/questions, start a new thread and let's try to keep this one a documented G-Force tutorial...

Code: Select all

// &#40;apologies to&#41; Rush 2112
Aspc=1 
ConB=1 
// Stps=6		// Best set &#91;A3="A2"&#93; when dealing with SMALL&#40;Non-Default&#41; 'Stps'

A0=6            // Desired Virtual 'Stps' 
A1="PI * 2"     // Constant 
C0="&#40;A1 * &#40;trunc&#40;s*A0&#41;/&#40;A0-1&#41;&#41;&#41; * 2"
C1="&#40;t/2&#41;" 

A2=".5"      // " + rnd&#40;.25&#41;" remove variability 
A3="A2"
C2="A2 * cos&#40; C0 &#41;"  // X 
C3="A3 * sin&#40; C0 &#41;"  // Y

X0="C2 * cos&#40;C1&#41; - C3 * sin&#40;C1&#41;" // X'
Y0="C3 * cos&#40;C1&#41; + C2 * sin&#40;C1&#41;" // Y'

C4="&#40;A1 * s&#41;"  // NUM_S_STEPS
X1="A2 * cos&#40; C4 &#41;"
Y1="A3 * sin&#40; C4 &#41;"

Meta="reactive=5 detail=3 density=2 morphable=4" 
Vers=390
Time to wake the Beast & turn on some Audio Input (preferably NOT one of the Internal Sources here however) and Edit:

Code: Select all

B0=""			// Add &#40;Place Holder&#41;
B1="A2 * BASS"		// Add line
C2="B1 * cos&#40; C0 &#41;"	// Edit A3 -> B1
C3="B1 * sin&#40; C0 &#41;"	// Edit A2 -> B1

X1="B1 * cos&#40; C4 &#41;"	// Edit A3 -> B1
Y1="B1 * sin&#40; C4 &#41;"	// Edit A2 -> B1
This MAY be acceptable to Beelzebub, but mere mortals will most likely prefer (Edit these lines:)

Code: Select all

A3=12			// You CAN Adjust THIS you KNOW! 
B0="&#40;&#40;B0*A3&#41;+BASS&#41;/&#40;A3+1&#41;"	// Lucky we had a place holder ;0&#41;
B1="A2 * B0"	// Edit BASS -> B0
Or maybe(?) BETTER:

Code: Select all

B1="Y_EXTENTS/1.5 * log&#40;2+B0&#41;"
These are mere SUGESTIONS( EXCEPT the first audio example; :twisted: REALLY DOES like that one the BEST :wink: !) ... explore YOUR imagination and come up with alogrithms that appeal to YOU (and others)!

This should give you a clue about a property of 'B' variables ... but don't get too cocky, when (NUM >1) you better know what you are doin' !!!

what needs to be done if you want the circle to be a square???
... careful!

03Aug10 - Final Version (precursor to Polygon Promenade)

Code: Select all

// Pulsating Pentagram.txt - jrm
// &#40;apologies to&#41; Rush 2112 &#40;w/ polygon descent adjunct, ASSUMES GF4&#41; 
Aspc=1 
ConB=1 

A0=6            // Desired Virtual 'Stps' 
A1="PI * 2"     // Constant 
C0="&#40;A1 * &#40;trunc&#40;s*A0&#41;/&#40;A0-1&#41;&#41;&#41; * 2" 
C1="&#40;t/2&#41;" 

X0="C2 * cos&#40;C1&#41; - C3 * sin&#40;C1&#41;" // X' 
Y0="C3 * cos&#40;C1&#41; + C2 * sin&#40;C1&#41;" // Y' 

A2=12
B0="&#40;&#40;B0*A2&#41;+BASS&#41;/&#40;A2+1&#41;"
B1="Y_EXTENTS/1.5 * log&#40;2+B0&#41;" 

C2="B1 * cos&#40; C0 &#41;"
C3="B1 * sin&#40; C0 &#41;"

C4="&#40;A1 * s&#41;"  // NUM_S_STEPS 
X1="B1 * cos&#40; C4 &#41;"
Y1="B1 * sin&#40; C4 &#41;"

A3="t"                                  // Start Time
B2="t-A3"                               // Elapse Time

B3="select&#40;&#40;&#40;wrap&#40;B2/20&#41;&#41; > B3&#41;, wrap&#40;B2/20&#41;, 0&#41;"
 
B4="log10&#40;2-B3&#41;*2"                      // Coil Density
B5="select&#40;B3, B5, sign&#40;1-rnd&#40;2&#41;&#41;&#41;"     // rotational direction

B6="B5*B2/1.2"                          // descent direction & rate

C5="B4 * 2.7 * cos&#40; B6 &#41;"               // 'X' trajectory  
C6="B4 * 2.7 * sin&#40; B6 &#41;"               // 'Y' trajectory  

B7="select&#40;B3, B7, round&#40;3.51 + rnd&#40;5.49&#41;&#41;&#41;"
C7="&#40;A1 * &#40;trunc&#40;s*B7&#41;/&#40;B7-1&#41;&#41;&#41; - &#40;t/1&#41;" 

X2="B4 * cos&#40; C7 &#41; + C5" 
Y2="B4 * sin&#40; C7 &#41; + C6"

Meta="reactive=4 detail=3 density=2 morphable=4" 
Vers=400
End of THIS Post!
Last edited by jerohm on Thu Aug 05, 2010 12:29 am, edited 4 times in total.

jerohm
Senior Member
Posts: 419
Joined: Fri Jan 09, 2009 5:19 pm

Bueller?...Bueller?...Bueller???? ....

Post by jerohm »

This represents MY last topic in this series. It builds off the topics we have already addressed and touches upon some new [ & yet(?) UNDOCUMENTED] ones. There are certainly issues I didn't even attempt to address, but along with the documentation that Soundspectrum already has provided, it should give you pretty reasonable footing.

The following is NOT visually stunning or anything, but fun and technically informative.

Code: Select all

// Polygon Promenade jrm 31Jul10 - ASSUMES GF 4

Aspc=1 
ConB=1
Num=7                                   // Invocation&#40;Clone&#41; count

A0="PI * 2"     // Constant 

A1="t"                                  // WS &#40;RECORDED&#41; Start Time &#91;Static&#93;
B0="&#40;t+ID&#41;-A1"                          // FRAME Elapse Time + ID offset

B1="pos&#40;wrap&#40;B0/20&#41; - .003125&#41;"         // 0 -> &#40;1-Fudged factor&#41;
                                        // Greatly INCREASED 0's chances! 

A2="sign&#40;1-rnd&#40;2&#41;&#41;"                     // GLOBAL rotational direction &#40;-/+1&#41;
B2="log10&#40;2-B1&#41;* 2"                     // Spiral Density - Personal Choice
B3="A2*B0/1.2"                          // descent direction & rate

C0="B2 * 2.7 * cos&#40; B3 &#41;"               // 'X' trajectory  
C1="B2 * 2.7 * sin&#40; B3 &#41;"               // 'Y' trajectory  

// Even though UNDOCUMENTED, '!', '~', and '0xHexNumericRepresentation' SEEM TO WORK
// the same as would be expected in the 'C' programming language.
// &#40;* Note *&#58; '0OctalNumericRepresentation' DOES NOT&#40;?&#41;! &#41;
//
// 'Select&#40;&#41;' &#91;see VectorC.h&#93; available in GF 4.0, CAN be accomplished other ways,
// but tends to promote more readable&#40;?&#41; code &#40;, IMHO&#41;
//
// All WS invocations &#40;Num > 1&#41; SHARE the same set of 'B' variables
// and they will be stomped on between frames UNLESS care is taken.
// Here, each ID only depends/modifies it's own 3 bit slice, via masking,
// AND would limit &#40;Num == 10&#41;, assuming a 32bit width
// &#40;which MAY or MAY NOT be a good assumption&#41;
//
// We RANDOMLY assign a new shape everytime &#40;B1 == 0&#41;. B4 stores the current 'SHAPE' data

//   01111111&#40;Octal&#41; == 299593  Initializer Value
//   01234567&#40;Octal&#41; == 342391  Initializer Value
 
B4="select&#40;B1
    , B4
    , select&#40;B4, &#40;&#40;B4 & ~&#40;7 << &#40;ID*3&#41;&#41;&#41; | &#40;round&#40;1+ rnd&#40;6&#41;&#41; << &#40;ID*3&#41;&#41;&#41;, 342391 &#41; &#41;"

B5="&#40;B4 &  &#40;7 << &#40;ID*3&#41;&#41;&#41; >> &#40;ID*3&#41;"    // 'Mask' and shift
B6="3+B5"                               // &#40;Sides+1&#41; per Regular Polygon, MIN 4, &#40;= triangle&#41;

C2="&#40;A0 * &#40;trunc&#40;s*B6&#41;/&#40;B6-1&#41;&#41;&#41; - &#40;t/1&#41;"        // remember&#40;?&#41;, 't' affects spin rate 

X0="B2 * cos&#40; C2 &#41; + C0"        // &#91;Size&#93; B2 -> 0 as it approaches the center 
Y0="B2 * sin&#40; C2 &#41; + C1"

Meta="reactive=5 detail=4 density=4 morphable=3"        // reactive=5 SHOULD REALLY be 1 
Vers=400

When you have completely digested all of this, and have convinced yourself you REALLY do understand it ALL, take a gander at 'GOLD/Sparks.txt' :P

03Aug10

Code: Select all

// Totally &#40;useless?&#41; non-intuitive horseplay...
//  'A' variables as a function of 's' &#40;kinda!&#41; 

Aspc=1 
ConB=1 

A0=6          // Virtual Steps
A1="PI * 2"	// Constant 
A2=".75 + rnd&#40;.25&#41;"

A3="A1*2 * trunc&#40;vectorLR&#40; cols&#40;s&#41;, 0, A0 &#41;&#41;/&#40;A0-1&#41;"
A4="A2 * cos&#40; A3 &#41;"  // X 
A5="A2 * sin&#40; A3 &#41;"  // Y


C0="&#40;t/2&#41;" 
X0="A4 * cos&#40;C0&#41; - A5 * sin&#40;C0&#41;" // X'
Y0="A5 * cos&#40;C0&#41; + A4 * sin&#40;C0&#41;" // Y'


A6="vectorLR&#40; NUM_S_STEPS, 0, A1 &#41;"
A7="A2 * cos&#40; A6 &#41;"
A8="A2 * sin&#40; A6 &#41;"

X1="A7"
Y1="A8"

Meta="reactive=5 detail=3 density=2 morphable=4" 
Vers=400


Everything we discussed SHOULD be conceptually correct, and FINE for moving forward, but differs wildly from the actual details of implementation.
welcome my son, welcome to the machine...

:twisted: http://www.youtube.com/watch?v=RFrBG4xyaF8 :twisted:
Last edited by jerohm on Tue Aug 03, 2010 8:00 am, edited 2 times in total.

Post Reply