Writing (or coding) waveshapes

Discussion forum for G-Force users

Moderators: BTT, andy55, b.dwall, juxtiphi

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

PatchWork (Particle)

Post by jerohm »

This Particle is cute... not great, but interesting. It is coded with the assumptions:
- Anything is fair game when manipulating A'vars, as they should endure only compile time penalty, i.e., no runtime penalty
- Operations that can be declared in a minimal number of statements, are ALWAYS the most efficient.
- Calculations that are static for all tasks, should only be preformed ONCE/frame, and probably best assigned to Task 0

Of course, I have no way of knowing whether any, or all of these assumptions are (currently) correct...
... but I'll be ready when they ARE! :wink:

Code: Select all

// PatchWork v2 (Particle) - jrm
//  Written for 16:9 (BEST), but okay for 4:3 aspects... others ???

Aspc=1
ConB=1
Num=5
Stps=5

A0="2*Pi*(s-1/8)"
A1="(9/(16*2)) + .002"
A2="A1 * { cos(A0)
         , sin(A0)
         }"
A3="A1 * 2*sqrt(2)"
A4="A3 * {1.5,2}"
A5="choice({1,2})"

B0="select(Id, B0, t/2 )"       // EASY Compile time Optimizable Idiom(s) !!
B1="select(Id, B1, pos(sign(sin(B0/A5))) )"

B2="select(Id, B2, abs(cos(B0)))"
B3="select(Id, B3, A2 * max( B2, transpose({ (sin(B0)   >=0)
                                           , (sin(B0+Pi)>=0)
                                           }) ))"
C0="row(B3,0) - col(A4,B1) + Id*A3"

X0="C0", Y0="row(B3,1)"
X1="C0", Y1="row(B3,1) - A3"
X2="C0", Y2="row(B3,1) + A3"

B4="select(Id, B4, A2 * max( B2, transpose({ (sin(B0+  Pi)>=0)
                                           , (sin(B0+2*Pi)>=0)
                                           }) ))"
C1="row(B4,0) - col(A4,!B1) + Id*A3"

X3="C1", Y3="row(B4,1) - A3/2"
X4="C1", Y4="row(B4,1) + A3/2"


Pen="127/128" // Best with BTT Colormaps
Lwdt=".2"

Meta="reactive=0 detail=3 density=3"
Vers=400


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

Post by bnh »

jerhom:

Can you explain this new vector coding. For example, what is the function of the "choice" command in A5:

A5="choice({1,2})"

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

Post by jerohm »

I am somewhat hesitant about trying to explain what I figured out about the VectorC implementation... It all started by studying "sparks.txt" and extrapolating the concepts. I still haven't mastered all the functions in "VectorC.h", but worked through a lot by brut force.

Code: Select all

A vector is just a floating point array.
's' is equivalent to 'vectorLR(Num_S_Steps, 0, 1)', where (Num_S_Steps==columns) and (rows==1)
 '{4,5,6,8,9}' is a vector with 5 columns and 1 row
'{{4,5,6,8,9}
 ,{1,2,3,4,5}
 }' is a vector with 5 columns and 2 rows
I haven't discovered a notation to define a vector with 1 column and rows > 1 ... 'transpose()' works

One might ASSume, GF Variables could be thought as as vector with (rows==1) and any number of columns.  Reality is, All variables are capable of multi-dimensions, i.e., any number of columns and rows (within reason I suppose), and are accessible using 'col(Var,c)' or 'row(Var,r)'... or 'subrange(...)' if you need.    Most functions operate reiteratively on ALL rows... 'smooth()' is an exception, and BROKE as far as I am concerned; it only works when (row==1).

Variable math MUST remain consistent, i.e, both operands MUST have the same dimensions OR one operand MUST be a scalar (cols==1).

You might question why you need 'Cvars' at ALL!?  In many cases, you don't, but they [might] hold a few surprises.  'Cvars' would make a lot MORE sense if 'Bvars' ACTUALLY only got evaluated ONCE per frame... THAT is only true if (NUM==1), otherwise 'Bvars' get evaluated ONCE per frame PER TASK(Num>1)! (which is why I used the 'select()' idiom in the original version, AND HOPE the compiler is smart enough to generate the most efficient runtime construct).
I took a step back and un-converted my code to a form that is consistent with the existing documentation (not really all that different). This first version here will work, but will bound to get most people in a lot of trouble, if they don't respect the FACT that the variables are NOT declared in order... there are some cases you can do this (as in THIS case), but in most situations, YOU ARE ASKING FOR BIG TROUBLE...

Code: Select all

// unconverted PatchWork v2 (Particle) - jrm 
//  Written for 16:9 (BEST), but okay for 4:3 aspects... others ??? 

Aspc=1 
ConB=1 
Num=5 
Stps=5 

A0="" // "2*Pi*(s-1/8)"   // Not used anymore  
A1="(9/(16*2)) + .002" 
A2="" // "A1 * { cos(A0) 
//             , sin(A0) 
//             }"         // Not used anymore 
A3="A1 * 2*sqrt(2)" 
A4="A3 * 1.5"
A6="A3 * 2" 
A5="pos(sign(1-rnd(2))) +1"   // 1 or 2 

B0="t/2"
B1="pos(sign(sin(B0/A5)))" 

B2="abs(cos(B0))" 

C2="A1 * sin(2*Pi*(s-1/8)) * max(B2, (sin(B0+Pi)>=0))" 
C0="A1 * cos(2*Pi*(s-1/8)) * max(B2, (sin(B0)   >=0))
    - ((A4*B1)+(A6*!B1)) + Id*A3" 
X0="C0"
Y0="C2" 

X1="C0"
Y1="C2 - A3" 

X2="C0"
Y2="C2 + A3" 

C3="A1 * sin(2*Pi*(s-1/8)) * max(B2, (sin(B0+2*Pi)>=0))" 
C1="A1 * cos(2*Pi*(s-1/8)) * max(B2, (sin(B0+  Pi)>=0))
    - ((A4*!B1)+(A6*B1)) + Id*A3" 
X3="C1"
Y3="C3 - A3/2" 

X4="C1"
Y4="C3 + A3/2" 


Pen="127/128" // Best with BTT Colormaps 
Lwdt=".2" 

Meta="reactive=0 detail=3 density=3" 
Vers=400

This second code section has been run through 'gfclean.pl' (way back at the beginning of this thread!).

Code: Select all

//[REASSIGN] A6 -> A5
//[REASSIGN] A5 -> A6
//[REASSIGN] C2 -> C0
//[REASSIGN] C0 -> C1
//[REASSIGN] C3 -> C2
//[REASSIGN] C1 -> C3
// gfclean'd unconverted PatchWork v2 (Particle) - jrm 
//  Written for 16:9 (BEST), but okay for 4:3 aspects... others ??? 

Aspc=1 
ConB=1 
Num=5 
Stps=5 

A0="" //[UNREF]  "2*Pi*(s-1/8)"   // Not used anymore  
A1="(9/(16*2)) + .002" 
A2="" //[UNREF]  "A1 * { cos(A0) 
//             , sin(A0) 
//             }"         // Not used anymore 
A3="A1 * 2*sqrt(2)" 
A4="A3 * 1.5"
A5="A3 * 2" 
A6="pos(sign(1-rnd(2))) +1"   // 1 or 2 

B0="t/2"
B1="pos(sign(sin(B0/A6)))" 

B2="abs(cos(B0))" 

C0="A1 * sin(2*Pi*(s-1/8)) * max(B2, (sin(B0+Pi)>=0))" 
C1="A1 * cos(2*Pi*(s-1/8)) * max(B2, (sin(B0)   >=0))
    - ((A4*B1)+(A5*!B1)) + Id*A3" 
X0="C1"
Y0="C0" 

X1="C1"
Y1="C0 - A3" 

X2="C1"
Y2="C0 + A3" 

C2="A1 * sin(2*Pi*(s-1/8)) * max(B2, (sin(B0+2*Pi)>=0))" 
C3="A1 * cos(2*Pi*(s-1/8)) * max(B2, (sin(B0+  Pi)>=0))
    - ((A4*!B1)+(A5*B1)) + Id*A3" 
X3="C3"
Y3="C2 - A3/2" 

X4="C3"
Y4="C2 + A3/2" 


Pen="127/128" // Best with BTT Colormaps 
Lwdt=".2" 

Meta="reactive=0 detail=3 density=3" 
Vers=400 

Code: Select all

A5="choice({1,2})"
A5 is evaluated ONCE at config startup, and is set to either 1 or 2. I could have specified any number of columns with discrete initialization values.

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

For your approval...

Post by jerohm »

>>> This is NOT a Config <<<, but a procedure that I have previously desired when writing other configs. I have asked Andy to include such a library function... not as of today though... maybe someday. It allows the definition of a list, of which items are randomized... I will let YOU figure out why this might be valuable... but it can be thought of as analogous to shuffling a deck of cards... what you do with the shuffled list is only limited to your imagination.

The only way you might visually appreciate what is going on here, is to set this as the ONLY WaveShape (shuffle/duration == ~10secs, Paticle Shuffle OFF, as not to complicate issue), Flowfields: '(Empty)', and ColorMap: 'The Haight', which will reasonably allow you to track the [task] output... Each task retains a static color assignment... it's column and size are randomized (or I guess you can watch a demo here)

The reason I am hesitant about telling you too much about the 'VectorC' implementation is because I learn (or re-rationalize) things everytime I play. You do need to come to terms with a debug procedure that you are comfortable with, given the visual nature of G-Force ... 'Lwdt' is my choice, since 0/1 can be used to turn Off/On a Task's output, i.e., for example Lwdt="(Id==0)" displays ONLY Task0 output.

I am particularly proud on this piece of code. Disect it, Modify it, Break it, IMPROVE IT.
Learn something you didn't know yesterday.

Code: Select all

/* Shuffle Proof of Concept -jrm
     FieldFlow&#58; &#40;Empty&#41;
     ColorMap&#58; The Haight
*/

Aspc=1 
ConB=1
Num=10

A0="vectorLR&#40;Num, 0, Num-1&#41;"

A1="&#40;A0+1&#41;/Num"
B0="select&#40;B6, B0, transpose&#40;trunc&#40;rnd&#40;vector&#40;2,Num-.0001-Id&#41;&#41;&#41;&#41;&#41;"

B1="select&#40;cols&#40;B1&#41;>1, B2, A1&#41;"
B2="select&#40;&#40;B6||&#40;A0<row&#40;B0,0&#41;&#41;&#41;, B1, select&#40;&#40;A0 < Num-1&#41;
                                    , map1D&#40; B1, &#40;A0+1&#41;/&#40;Num-1&#41;, 0 &#41;
                                    , col&#40;B1,row&#40;B0,0&#41;&#41; &#41; &#41;"

A2="1.7 * map1d&#40; &#123;-1,1&#125;, vectorLR&#40;Num, 0, Num-1&#41;/&#40;Num-1&#41;, 1&#41;"
B3="select&#40;cols&#40;B3&#41;>1, B4, A2&#41;"
B4="select&#40;&#40;B6||&#40;A0<row&#40;B0,1&#41;&#41;&#41;, B3, select&#40;&#40;A0 < Num-1&#41;
                                    , map1D&#40; B3, &#40;A0+1&#41;/&#40;Num-1&#41;, 0 &#41;
                                    , col&#40;B3,row&#40;B0,1&#41;&#41; &#41; &#41;"

B5="col&#40;B1,Id&#41;"                         // Debug&#58; "1/Num"
X0="B5 * cos&#40;2*Pi*s&#41; + col&#40;B3, Id&#41;"     // Debug&#58; "B5 * cos&#40;2*Pi*s&#41;"
Y0="B5 * sin&#40;2*Pi*s&#41;"

B6="select&#40;&#40;Id==&#40;Num-1&#41;&#41;, 1, B6&#41;"       // AFTER frame 0
Lwdt="B6"
Pen=" &#40;Id/Num&#41; + .25"

Meta="reactive=3 detail=3 density=3 morphable=3"
Vers=400

[Update 30Dec2012]
Here is a slightly different variation on the same theme. In some ways it should be simpler to understand... More complicated in others. Each task (random count, 1-10) have fixed size and color ratios, but change as a function of task count(Num), namely
Radius: (Id+1)/Num
Color(aka Pen): (Id/Num) + .25


There are CL(10, but could be any number) evenly spaced fixed display columns, one randomly, and exclusively assigned to each task. The previous code example ASSumed a 1:1 display columns:tasks (somewhat presumptuous, I might add :oops: )

[Update 31Dec2012] (minor code change)

Code: Select all

/* Shuffle IIb; Proof of Concept -jrm
     FieldFlow&#58; &#40;Empty&#41;
     ColorMap&#58; The Haight &#40;for tracking purposes, but less informative here&#41;
*/

Aspc=1 
ConB=1
Num="1 + trunc&#40;rnd&#40;10-.001&#41;&#41;"
CL=10           // # of display columns

A0="vectorLR&#40;CL, 0, CL-1&#41;"
A1="1.7 * map1d&#40; &#123;-1,1&#125;, A0/&#40;CL-1&#41;, 1&#41;"
A2="CL-Num"     // Offset to randomized data set

B0="select&#40;B4, B0, trunc&#40;rnd&#40;CL-Id-.0001&#41;&#41;&#41;"

B1="select&#40;cols&#40;B1&#41;>1, B2, A1&#41;"
B2="select&#40;&#40;B4||&#40;A0<B0&#41;&#41;, B1, select&#40;&#40;A0 < CL-1&#41;
                                    , map1D&#40; B1, &#40;A0+1&#41;/&#40;CL-1&#41;, 0 &#41;
                                    , col&#40;B1,B0&#41;
                                    &#41; &#41;"

B3="&#40;Id+1&#41;/Num" // Radius
X0="B3 * cos&#40;2*Pi*s&#41; + col&#40;B2, select&#40;B4, A2+Id, CL-1&#41;&#41;"
Y0="B3 * sin&#40;2*Pi*s&#41;"

B4="select&#40;&#40;Id==&#40;Num-1&#41;&#41;, 1, B4&#41;"       // AFTER frame 0
Pen=" &#40;Id/Num&#41; + .25"

Meta="reactive=3 detail=3 density=3 morphable=3"
Vers=400

enjoy or ignore...

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

Post by jerohm »

I wrote this a while back. I know it is a bit sophomoric, and there are other similar WSs, but I recently re-tuned things a bit, and have developed somewhat of a fondness.
'CogWheel' now, may be a more appropriate name
(as a Particle, 16:9 works best)

Code: Select all

// S h a t t e r e d ... jrm &#40;accept no substitutes&#41;
//
//
Aspc=1
ConB=1
Num=6

Stps="200"

A0="1/&#40;Num_S_Steps-1&#41;"          // S_Step_Increment
A1="10"                         // S_Steps per division
A2="choice&#40;&#123;-1,1&#125;&#41;/&#40;60+rnd&#40;30&#41;&#41;"

A3="Num_S_Steps/A1"
A4="trunc&#40;A3*s&#41;/A3"

A5="s - A0 * &#40;&#40;&#40;Num_S_Steps*s&#41; % A1&#41; == 0&#41;" // s"
A6="Pi * &#40;&#40;2* A5 -1&#41;-&#40;A0*A1&#41;&#41;"  // See WHY A5&#91;s"&#93; is 'better&#40;?&#41;' than s&#91;s'&#93; &#40;sometimes??&#41;

B0="select&#40;Id, B0, B0+1&#41;"
B1="select&#40;Id, B1, max&#40;select&#40;&#40;B0%4&#41;, 0, mag&#40;A4&#41;&#41;, B1-.02&#41;&#41;"	// .0035
B2="select&#40;B6==Num, &#40;dt!=0&#41;, B2&#41;"

A7="vectorLR&#40;Num, 0, choice&#40;&#123;0, Num-1&#125;&#41;&#41;"
A8="&#40;-1^A7&#41; * &#40;1+A7&#41;/&#40;8+4*A7&#41;"

B3="A6 + t * col&#40;A8,Id&#41;"
B4="pos&#40;B1&#41; +.27"


B5="4.5*&#40;B2 + &#40;1-log10&#40;.001+10*wrap&#40;Id/Num + &#40;t*A2&#41;&#41;&#41;&#41;^.7&#41;"

X0="B4 * &#40;cos&#40;B3&#41; * B5&#41;"
Y0="B4 * &#40;sin&#40;B3&#41; * B5&#41;"
B6="B6 +1"

LWdt="select&#40;B2, .4, 1&#41; + B5/10"
Pen="1 - B5/1500"

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

take it for what it is worth... or ignore...

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

'energy' and 'level'

Post by jerohm »

For whatever reasons, AOM felt it necessary to add his touches to my "Dodecahedron" GF5 WS submission. You will find two, yet undocumented, new(?) variables, 'level' and 'energy'. This little piece of code will show you what they do. As it turns out,
'level' == 'Bass/4'.


Standalone works the best for studying audio selection transitions (the space between audio programs)

The bottom trace is an RMS-ish trace of the waveform (which I use to FIX fft()'s peculiar behavior between audio selections - not here).

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

Code: Select all

/* Scope, Example - jrm
    &#40;stack operations&#41;
    Flowfield&#58; Gravity Ball or the likes is nice

    *** Informative Use Only ***
*/
Aspc=1
ConB=1
Stps=500

A0="&#40;&#40;s*2&#41;-1&#41;"

// 'Unshift' &#40;prepend&#41; to beginning
//
B0="select&#40;&#40;s != 0&#41;
    , map1D&#40; B0, s-&#40;1/&#40;Num_S_Steps-1&#41;&#41;, 0 &#41;
    , Bass/4&#41;"                          // Bass/4

B1="select&#40;&#40;s != 0&#41;
    , map1D&#40; B1, s-&#40;1/&#40;Num_S_Steps-1&#41;&#41;, 0 &#41;
    , level&#41;"                           // Nothing NEW, just BASS/4!!

B2="select&#40;&#40;s != 0&#41;
    , map1D&#40; B2, s-&#40;1/&#40;Num_S_Steps-1&#41;&#41;, 0 &#41;
    , energy/2&#41;"                        // energy/2

B3="select&#40;&#40;s != 0&#41;
    , map1D&#40; B3, s-&#40;1/&#40;Num_S_Steps-1&#41;&#41;, 0 &#41;
    ,dot&#40;mag&#40;s&#41;&#41;/&#40;Num_S_Steps/4&#41;&#41;"      // RMS * 4


B4="A0 * &#40;X_EXTENTS/Y_EXTENTS&#41;"
X0="B4", Y0="B0 + .5"
X1="B4", Y1="B1"
X2="B4", Y2="B2 - .5"
X3="B4", Y3="B3 -  1"

/***/
X4="B4", Y4=" .5"
X5="B4", Y5="  0"
X6="B4", Y6="-.5"
X7="B4", Y7="- 1"
/***/

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

8)

Code: Select all

/* Seismic, Particle - jrm
    &#40;stack operations&#41;
*/

Aspc=1
ConB=1
Stps=500
Offs=.2

A0="&#40;&#40;s*2&#41;-1&#41;"
A1="s-&#40;1/&#40;Num_S_Steps-1&#41;&#41;"
A2="vectorLR&#40;5, 1, 0&#41;"

B0="atan&#40;fft&#40;A2&#41;&#41;/1.57"

B1="A0 * &#40;X_EXTENTS/Y_EXTENTS&#41;"
B2=" s * &#40;X_EXTENTS/Y_EXTENTS&#41;"


// 'Unshift' &#40;prepend&#41; to beginning
// &#40;What does this coding tell you about 'map1D&#40;&#41;' ??
//  & 'smooth&#40;&#41;' for that matter!&#41;
B3="select&#40;&#40;s != 0&#41;
          , &#123; map1D&#40; row&#40;B3, 0&#41;, A1, 0 &#41;
            , map1D&#40; row&#40;B3, 1&#41;, A1, 0 &#41;
            , map1D&#40; row&#40;B3, 2&#41;, A1, 0 &#41;
            , map1D&#40; row&#40;B3, 3&#41;, A1, 0 &#41;
            , map1D&#40; row&#40;B3, 4&#41;, A1, 0 &#41;
            &#125;
          , transpose&#40;B0&#41;&#41;"

/*** Alternatively, THIS ALSO Works ****
**** but isn't very intuitive, is it!?!
****
B3="subrange&#40; &#123; transpose&#40;B0&#41;
              , &#123; map1D&#40; row&#40;B3, 0&#41;, s, 0 &#41;
                , map1D&#40; row&#40;B3, 1&#41;, s, 0 &#41;
                , map1D&#40; row&#40;B3, 2&#41;, s, 0 &#41;
                , map1D&#40; row&#40;B3, 3&#41;, s, 0 &#41;
                , map1D&#40; row&#40;B3, 4&#41;, s, 0 &#41;
                &#125;
              &#125;, Num_S_Steps-1, 0, -2, -1 &#41;"
***/


X0=" B1", Y0="smooth&#40; row&#40;B3, 0&#41;, 1.1&#41; + .8 - Offs"
X1=" B1", Y1="smooth&#40; row&#40;B3, 1&#41;, 1.1&#41; + .4 - Offs"
X2=" B1", Y2="smooth&#40; row&#40;B3, 2&#41;, 1.1&#41;      - Offs"
X3=" B1", Y3="smooth&#40; row&#40;B3, 3&#41;, 1.1&#41; - .4 - Offs"
X4=" B1", Y4="smooth&#40; row&#40;B3, 4&#41;, 1.1&#41; - .8 - Offs"

Pen="127/128"
Lwdt=".7"

Meta="reactive=1 detail=3 density=3"
Vers=400

Updated 28Aug2013

Cool Tool

is there anybody out there? - Roger Waters :shock:

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

Post by jerohm »

visually nothing special (yet :wink: ), but a nice piece of math...
(well I think so...)

Code: Select all

/* Star Sphere &#40;Particle&#41; -jrm
*/
Aspc=1 
ConB=1
Stps="3*512/2"

//
A0="1"
A1="1+ &#40;5+A0&#41;*2"		// and 11

A2="&#123; vectorLR&#40;A1, 0, A1-1&#41;
    , vectorLR&#40;A1, 0, 2*Pi&#41;
    &#125;"

A3="&#40;1-.8 * &#40;row&#40;A2,0&#41; % 2&#41;&#41;"

A4="&#123; map1D&#40; A3 * cos&#40;row&#40;A2,1&#41;&#41;, s, 1&#41;
    , map1D&#40; A3 * sin&#40;row&#40;A2,1&#41;&#41;, s, 1&#41;
    &#125;"

A5="sqrt&#40;1-hypot2&#40;row&#40;A4,0&#41;, row&#40;A4,1&#41;&#41;&#41;"
B0="t/8"

C0="&#40;row&#40;A4,0&#41;*cos&#40; B0 &#41; - row&#40;A4,1&#41;*sin&#40; B0 &#41;&#41;"
C1="&#40;row&#40;A4,0&#41;*sin&#40; B0 &#41; + row&#40;A4,1&#41;*cos&#40; B0 &#41;&#41;"

C2="&#40;A5*sin&#40; B0 &#41; + C1*cos&#40; B0 &#41;&#41;"

X0=" C0", Y0=" C2"
X1="-C0", Y1="-C2"

// X2="cos&#40;2*Pi*s&#41;"
// Y2="sin&#40;2*Pi*s&#41;"
//
// Meta="reactive=0 detail=3 density=3"			// Should BE &#40;Particle&#41;

Meta="reactive=3 detail=4 density=4 morphable=5"
Vers=500

Okay, here is another version which is basically visually IDENTICAL (except for A0 randomness ). It explores exploiting some attributes of VectorC... and may be insignificantly more efficient... maybe. If you are really interested in understanding the VectorC implementation, you should compare the two, and rationalize WHY the second version works... not as obvious as version I...

Code: Select all

/* Star Sphere v.II &#40;Particle&#41; -jrm
    
*/
Aspc=1 
ConB=1
Stps="3*512/2"

A0="choice&#40;&#123;1,3,5,7&#125;&#41;"
A1="1+ &#40;5+A0&#41;*2"		// and 11

A2="&#123; vectorLR&#40;A1, 0, A1-1&#41;
    , vectorLR&#40;A1, 0, 2*Pi&#41;
    &#125;"

A3="&#40;1-.8 * &#40;row&#40;A2,0&#41; % 2&#41;&#41;"

A4="&#123; map1D&#40; A3 * cos&#40;row&#40;A2,1&#41;&#41;, s, 1&#41;
    , map1D&#40; A3 * sin&#40;row&#40;A2,1&#41;&#41;, s, 1&#41;
    &#125;"

A5="sqrt&#40;1-hypot2&#40;row&#40;A4,0&#41;, row&#40;A4,1&#41;&#41;&#41;"
B0="t/8"

A6="&#123;-row&#40;A4,1&#41;
    , row&#40;A4,0&#41;
    &#125;"

C0=" A4 * cos&#40;B0&#41; +        A6 * sin&#40;B0&#41;"
C1=" A5 * sin&#40;B0&#41; + row&#40;C0,1&#41; * cos&#40;B0&#41;"

X0=" row&#40;C0,0&#41;"
Y0=" C1"

X1="-row&#40;C0,0&#41;"
Y1="-C1"

Meta="reactive=3 detail=3 density=3 morphable=5"
Vers=500

feel free to ignore...
8)

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

*** NOT *** a Config :0(

Post by jerohm »

Okay, here are two pieces of code, that should be visually identical, but are actually very different. The first uses 't' to determine the rotation rate. Changing the target FPS has NO EFFECT.

Code: Select all

Aspc=1
ConB=1

Num=1
Coil=10

A0=".55"                                // 1 or LESS
A1="A0 * &#123; sin&#40;Coil*2*Pi*s&#41;
         , cos&#40;Coil*2*Pi*s&#41;
         &#125;"

B0=""
B1="t"
B2=""

B3="", B4="", B5="", B6="", B7=""

B8="B1"
B9="sin&#40;Pi/6&#41;"          // z

B10="&#40;2*s-1&#41;"

B11=""
B12="A1 * sqrt&#40;1-B10^2&#41;"
B13="A0 * B10"

C0="cos&#40; B8 &#41; * row&#40;B12,0&#41; + sin&#40; B8 &#41; * B13"           // x'
C1="cos&#40; B8 &#41; * B13        - sin&#40; B8 &#41; * row&#40;B12,0&#41;"    // y'

C2="cos&#40; B9 &#41; * row&#40;B12,1&#41; + sin&#40; B9 &#41; * C1"            // z'

X0=" C0"
Y0=" C2"

Meta="reactive=3 detail=3 density=3 morphable=5"
Vers=500

This second piece of code, uses the delta time required to create the [last]frame, and sums the time increments. If I didn't screw anything up, changing the target frame rate, shouldn't have any effect. So now the question you are left with, is WHY would I bother to go through this extra level of complexity, when the first, more forward, piece of code would suffice???

:oops: okay, I screwed up and got a little ahead of my self... so I modified the code a bit to confirm what (was suppose to be) going on...

Code: Select all

Aspc=1
ConB=1

Num=2
Coil=10

A0=".45"                                // 1 or LESS
A1="A0 * &#123; sin&#40;Coil*2*Pi*s&#41;
         , cos&#40;Coil*2*Pi*s&#41;
         &#125;"

B0="t-B1"
B1="t"
B2="select&#40;Id, B2, B2 + B0&#41;"	// Weight Factor &#40;33*B0&#41;	

B3="", B4="", B5="", B6="", B7=""

B8="select&#40;Id, t, B2&#41;"
B9="sin&#40;Pi/6&#41;"          // z

B10="&#40;2*s-1&#41;"			// Could certainly be Avar

B11=""
B12="A1 * sqrt&#40;1-B10^2&#41;"	// Could certainly be Avar
B13="A0 * B10"			// Could certainly be Avar

C0="cos&#40; B8 &#41; * row&#40;B12,0&#41; + sin&#40; B8 &#41; * B13"           // x'
C1="cos&#40; B8 &#41; * B13        - sin&#40; B8 &#41; * row&#40;B12,0&#41;"    // y'

C2="cos&#40; B9 &#41; * row&#40;B12,1&#41; + sin&#40; B9 &#41; * C1"            // z'

X0=" C0 + select&#40;Id, .5, -.5&#41;"
Y0=" C2"

Meta="reactive=3 detail=3 density=3 morphable=5"
Vers=500

First lesson you should learn... Challenge everything I post... :?

Well no guarantee this was worth the wait, but I did check my code this time :? (maybe), and you need to keep your eyes on the left ball. Standalone is the best test platform. You should vary the music genres selections, including silence). It probably could use to be tuned up a bit...

Code: Select all

Aspc=1
ConB=1

Num=2
Coil=10
rate=2.5


A0=".45"                                // 1 or LESS
A1="A0 * &#123; sin&#40;Coil*2*Pi*s&#41;
         , cos&#40;Coil*2*Pi*s&#41;
         &#125;"

B0="select&#40;Id, B0, &#40;t-B1&#41;&#41;"	// Weight Factor &#40;33*B0&#41;	
B1="t"

B2="select&#40;Id, B2, &#40;Bass + B2*&#40;40-1&#41;&#41;/40 &#41;"
B3="select&#40;Id, B3, B3 + &#40;rate*B0*B2&#41;&#41;"	// rotation rate

B4="select&#40;Id, B4, B3&#41;"


B5="", B6="", B7=""

B8="select&#40;Id, t, B4&#41;"
B9="sin&#40;Pi/6&#41;"          // z

B10="&#40;2*s-1&#41;"			// Could certainly be Avar

B11="" 
B12="A1 * sqrt&#40;1-B10^2&#41;"	// Could certainly be Avar
B13="A0 * B10"			// Could certainly be Avar

C0="cos&#40; B8 &#41; * row&#40;B12,0&#41; + sin&#40; B8 &#41; * B13"           // x'
C1="cos&#40; B8 &#41; * B13        - sin&#40; B8 &#41; * row&#40;B12,0&#41;"    // y'

C2="cos&#40; B9 &#41; * row&#40;B12,1&#41; + sin&#40; B9 &#41; * C1"            // z'

X0=" C0 + select&#40;Id, .5, -.5&#41;"
Y0=" C2"

Meta="reactive=3 detail=3 density=3 morphable=5"
Vers=500

This should keep you busy :P ... NOT perfect, but not bad. Each sphere is reacting to a fft() frequency band. Turning off Flowfields may be in order. (Updated 12/21/13 -2)

Code: Select all

Aspc=1
ConB=1

Num=4
A0=".325- .024*&#40;Num-4&#41;"                               // Static Scale

Coil=10
Stps=768

A1="&#123; choice&#40;&#123;0,1&#125;/4&#41;
    , choice&#40;vectorLR&#40;Num, 0, Num-1&#41;&#41;
    &#125; * 0"				// *** Disabled ***/

A2="A0 * &#123; sin&#40;Coil*2*Pi*s&#41;
         , cos&#40;Coil*2*Pi*s&#41;
         &#125;"

B0="select&#40;Id, B0, max&#40;&#40;t-B1&#41;, 1/66&#41;&#41;"
B1="t"					// &#40;33*B0&#41;

Wght=1.6	// 1.6
RSpd=3.7	// Rotation Velocity
Plse=.9		// Pulse Amplitude
Idle=.05

A3="transpose&#40;&#123; &#40;48/33&#41;
              , &#40;24/33&#41;
              &#125; &#41;"			// &#91;Rows&#93; Damping &#40;Weight&#41; Factors &#123;Speed, Size&#125;

A4="&#123; vectorLR&#40;Num, .15, .6&#41;
    , vector&#40;Num, 1&#41;
    &#125;"

B2="&#40;&#40;33*Wght&#41;*B0&#41; * fft&#40;t*col&#40;A1,0&#41; + row&#40;A4,0&#41;&#41;"

B3="select&#40;Id, B3, A3/B0 &#41;"
B4="select&#40;Id, B4, &#40;B2 + B4*&#40;B3-1&#41;&#41;/B3 &#41;"

B5="select&#40;Id, B5, B5 + B0*max&#40;Idle, &#40;RSpd*sin&#40;atan&#40;row&#40;B4,0&#41;&#41;&#41;&#41;&#41;&#41;"	// rotation rate
B6="select&#40;Id, B6, &#40;1+atan&#40;row&#40;B4,1&#41;/Plse&#41;&#41;&#41;"				// Pulse


A5="&#40;2*s-1&#41;"
A6="A2 * sqrt&#40;1-A5^2&#41;"
A7="A0 * A5"

B7="&#40;col&#40;A1,1&#41; + Id&#41; % Num"
B8=" col&#40;B5, B7&#41;"

C0="cos&#40; B8 &#41; * row&#40;A6,0&#41; + sin&#40; B8 &#41; * A7"              // x'
C1="cos&#40; B8 &#41; * A7        - sin&#40; B8 &#41; * row&#40;A6,0&#41;"       // y'

B9="sin&#40;t/6&#41;"	// z Pi/6
C2="cos&#40; B9 &#41; * row&#40;A6,1&#41; + sin&#40; B9 &#41; * C1"              // z'

B10="col&#40;B6, B7&#41;"

A8="&#40;&#40;.5+ .05*&#40;Num-4&#41;&#41;*&#123;-1, 1&#125;&#41;"
B11="map1D&#40;X_Extents*A8, &#40;Id%&#40;Num/2&#41;&#41;/&#40;&#40;Num/2&#41;-1&#41;, 1&#41;"
B12="select&#40;Id<&#40;Num/2&#41;, -.5, .5&#41;"

X0=" B10 * C0 + B11"
Y0=" B10 * C2 + B12"

Lwdt="1.1"
Meta="reactive=3 detail=3 density=3 morphable=5"
Vers=500


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

Nice (non-reactive) Particle

Post by jerohm »

Currently set as WS ...

Code: Select all

/* XYZ - Nice Particle &#40;No Reactivity&#41; - jrm
*/

Aspc=1 
ConB=1
Stps=512

Num="4*choice&#40;&#123;1,2&#125;&#41;"
A0="choice&#40;&#123;0,1&#125;&#41;/8"


A1="&#123; cos&#40;2*Pi*vectorLR&#40;5,0,1&#41; &#41;
    , sin&#40;2*Pi*vectorLR&#40;5,0,1&#41; &#41;
    &#125;"                                  // Square

A2="&#123; cos&#40;2*Pi*s&#41;
    , sin&#40;2*Pi*s&#41;
    &#125;"                                  // Coicle ;0&#41; 

A3="map1D&#40; row&#40;A1, 0&#41;, s, 1 &#41;"          // x
A4="map1D&#40; row&#40;A1, 1&#41;, s, 1 &#41;"          // y
A5="2 * &#40;1-hypot&#40;A3,A4&#41;&#41;"               // z
A6="Pi/&#40;Num/2&#41;"


B0="t/4 + A6*Id"
B1="A0*t"

// Rotate around the y axis 
C0="A3 * cos&#40; B0 &#41; + A5 * sin&#40; B0 &#41;"    // x' 

X0="&#40;C0 * cos&#40; B1 &#41; + A4 * sin&#40; B1 &#41;&#41;"  // x'' 
Y0="&#40;A4 * cos&#40; B1 &#41; - C0 * sin&#40; B1 &#41;&#41;"  // y' 

X1="row&#40;A2,0&#41;"
Y1="row&#40;A2,1&#41;"

   Meta="reactive=3 detail=4 density=4 morphable=5"
// Meta="reactive=0 detail=4 density=4"
Vers=500

8)

FrankN
Posts: 316
Joined: Thu Mar 07, 2013 11:19 pm

Post by FrankN »

jerohm, you are a cool dude. 8)

User avatar
BTT
Administrator
Posts: 2162
Joined: Sun Jun 20, 2010 9:34 pm
Location: United Kingdom

Post by BTT »

Hello All
FrankN wrote:jerohm, you are a cool dude. 8)
He's not the Messiah - he's a very naughty boy.


Regards BTT

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

Simple, but I like it...

Post by jerohm »

This was written to be a Particle and arguably, it is barely perceptible... until you appreciate it :wink:

I added logic to run as a WS also, but there isn't any reactivity.
Take it for what it is worth...
or ignore.

Code: Select all

Aspc=1
ConB=1
Num=5


A0="exp&#40;1&#41;-1"                           // e="2.718281828"
A1="vectorLR&#40;Num, 0, Num-1&#41;"
A2="&#40;end_time > 1e30&#41;"                  // IsWaveShape? - O'Mearagic
A3="choice&#40;&#123;0, A2&#125;&#41;"

B0="hypot&#40;X_EXTENTS, Y_EXTENTS&#41;"
B1="B0 * log&#40;1+&#40;A0&#41;*&#40;wrap&#40;pos&#40;&#40;t/15&#41; - &#40;Id/Num&#41;&#41;&#41;&#41;&#41;"

B2="abs&#40;sin&#40;t/1.5 - &#40;Id/Num&#41;&#41;&#41;"

B3="select&#40;A3, select&#40;&#40;B1<1&#41;, B2, select&#40;&#40;&#40;col&#40;B4,Id&#41;==1&#41; || &#40;B2 >=.997&#41;&#41;, 1, B2 &#41; &#41;
             , 1&#41;"
X0="&#40;B1*B3&#41; * sin&#40;2*Pi*s&#41;"
Y0=" B1     * cos&#40;2*Pi*s&#41;"

B4="select&#40;&#40;Id!=A1&#41;, B4, B3&#41;"

B5="select&#40;A2, 1, 1/128 + wrap&#40;t/30&#41;/4&#41;"
Pen="B5"

Lwdt="B1"
Meta="reactive=3 detail=3 density=3 morphable=5"        // Obviously reactive ACTUALLY 0 &#40;aka Particle Only&#41;
Vers=400


FrankN
Posts: 316
Joined: Thu Mar 07, 2013 11:19 pm

Post by FrankN »

Is O'Mearagic your word for O'Meara Magic? :D

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

Post by jerohm »

yeah :wink: , not all that intuitively obvious! (and people accuse PERL of being idiomatic)

I used to use (dt>0), but this has to be evaluated for each frame, and is false when (t==0) for BOTH WS and Particles... It DOES generate an interesting effect at the start of a config though, that grows on you ... or me...
8)

User avatar
BTT
Administrator
Posts: 2162
Joined: Sun Jun 20, 2010 9:34 pm
Location: United Kingdom

Post by BTT »

Hello jerohm

Better check all your configs just in case you have used a name you wouldn't want made public. :wink:
.
Regards BTT

ColorMap Creator for G-Force and Aeon --- SoundSpectrum Forum Administrator.

Post Reply