Writing (or coding) waveshapes

Discussion forum for G-Force users

Moderators: BTT, andy55, b.dwall, juxtiphi

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

Re: Bueller?...Bueller?...Bueller???? ....

Post by JayPro »

Jerohm;

Assigning a Meta 1 to Reactive--at least in most cases I've seen this applied--instructs the rendering engine to read the config as a non-responsive Particle.

The Morphable param is therefore unnecessary to add, in that only true WaveShapes can use it.

Then again, I may be telling you something you might already know.

"God is syntax."

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

Post by jerohm »

Thanks -
I would LIKE to think I will learn SOMETHING new each day 'til I'm NOT :D . I posted MY final version of the pulsating pentagram. which was actually the precursor to Polygon Promenade.

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

Post by bnh »

Thank you again jerhom and jaypro for your patience. As a point of interest, the most viewed Exercise thus far, the one with the greatest number of downloads and the one with the longest time spent viewing, is the one that demonstrates the differences in Aspc=1 and Aspc=0

Before you retire, I’m hoping you’ll answer a few more questions to the code you submitted in the previous posts, the one where Stps 6 creates a star and not a pentagon. My brain expands slowly, and once I get into writing variations, hours slip by before I can get to your next challenge.

For those of us who are still under the learning curve, here are some results of just part of your earlier post.

Code: Select all

X'="A1 * cos( 2 * PI * s )"   //  (A1 == A2) Draws a 'Regular Polygon' BASED on 'Stps' granularity 
Y'="A2 * sin( 2 * PI * s )"
I took the first piece of code you suggested (shown above) and started to play with it.

Exercise 19-A:

http://www.bnh.net/gforce/%28new%29mine2-3.mov

The above link (which I couldn't make active using the forum's url tag) shows jerhom’s basic code, except that I’ve bent the X and Y coordinates. Nothing yet to write home about.

Exercise 19-B:

http://www.bnh.net/gforce/%28new%29mine2-6.mov

In the above link I added some movement using the time index ( t/2) on the X axis. Still not very interesting.

Exercise 19-C:

http://www.bnh.net/gforce/%28new%29mine2-5.mov

In the above link, I reduced the number of Stps to 5, predicted the appearance of the “squared” shape, then distorted that square by the uneven X/Y coordinates, and was not disappointed.

There’s an interesting illusion going on with this figure. Our mind connects those dots in such a way that we see a rotating figure, an oval on its back, rather than the cycle of two coordinate pairs moving on a flat plane in straight lines, i.e. the X and Y coordinates. You have to concentrate on the paired dots to see that they are really just cycling back and forth along their STRAIGHT axis.

Exercise 19-D:

http://www.bnh.net/gforce/%28new%29mine2-5.mov

The illusion is more enhanced in the above referenced link (19-D) . When ConB=1, the “squared” shape (distorted by the unequal X/Y coordinates) seems to “wobble” as well as rotate. This is weird in the general scheme of things, but maybe not useful in building WaveShapes.

Exercise 20: The Juggler Series

Finally, some interesting variations started to appear. I call this series of WaveShapes the juggler series, and they are still built on the first config jerhom wrote.

Exercise 20-A:

http://www.bnh.net/gforce/%28new%29mine2-8.mov

Exercise 20-B:

http://www.bnh.net/gforce/%28new%29mine2-9.mov

The above link just adds some sound fluctuations (BASS) to the X axis.

Exercise 21: The Tossed Salad Variations

When I increased the number of Stps to 20, added the sound function (BASS) to both the X and Y axis, and changed the X/Y coordinates slightly, some interesting things I had not predicted started to appear.

Exercise 21-A:

http://www.bnh.net/gforce/%28new%29mine2-13.mov

It’s a little difficult to see what’s happening in this variation, but it’s there.

Exercise 22-B:

http://www.bnh.net/gforce/%28new%29mine2-14.mov

The above link clearly shows what’s happening. A variety of shapes are created by the cycling of the Stps value itself. All these shapes in just one config.

Even though I forgot to turn the “green dot” in the Task Bar to “red”, the zooming effect is caused by the fact that both the X and Y axis are being affected by the sound impulses added by the BASS code.

Slowing down the time index, say from t/2 to t/5, and applying a less vigorous sound sample would likely make this config more usable. It’s difficult to see how these shapes will look until you apply a “real sound” track. I’m using the “High Energy” option built into the Tool Bar here just to demonstrate the WaveShapes.

Exercise 22-C: The Slinky

http://www.bnh.net/gforce/%28new%29mine2-20.mov
Making changes to jerhom’s basic config produced very different results, most of which I couldn’t accurately predict. They only made sense in hindsight, which I’m sure is due to my lack of math and coding experience. Here’s a Slinky variation produced when Stps was raised to 50, but the sin and cos values were also halved. Once again, the effect would likely be more useful if a less vigorous sound sample were applied.

I'd like to give this Slinky a try in a script that uses the XPOS and YPOS values.

Questions for jerhom or jaypro.

1. Is there a way to control the sound "responsiveness" of the mag/BASS/fft functions when coding WaveShapes? You can set an overall-sensitivity to the sound input on the Tool Bar, which is level that is really geared at an AVERAGE of the input volume. That’s fine for hip-hop/rock/rap/pop music, etc., where the music is compressed and that overall volume doesn’t fluctuate to any great extent. But in other forms of music, e.g. classical, Broadway, narration, etc. the range of volume is much wider. The "average" volume setting is at times too sensitive and the WaveShape is spreading way out, or not sensitive enough and the WaveShape disappears.

Some WaveShapes. with some combinations of FlowFields, look best when they react very mildly to the mag/BASS/fft., especially when used in combinations with particles. And there are other times when you want a rather strong reaction from the WaveShape, but the volume from the sound source is relatively weak.

Varying either the output of your sound or the input sensitivity on the Tool Bar with each WaveShape just isn’t practical, especially when writing scripts.

Are there some secret, profound math formulas you apply to the mag/BASS/fft that would control their responsiveness? I’ve tried using + BASS instead of * BASS, or +mag instead of * mag, but that really doesn’t work.

2. Is there a way to hide the WaveShape? Sometimes you just want it actively stirring up the FlowField but not really visible. I’ve tried reducing LWdt, and the thinnest I’ve obtained is about .06. But I would like to make it really invisible? Is there a way to do that?
Last edited by bnh on Tue Aug 10, 2010 1:04 pm, edited 3 times in total.

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

Post by jerohm »

1. Is there a way to control the sound "responsiveness" of the mag/BASS/fft functions

This is an interesting[read: complicated] problem that I attempted to address in the 'Pulsating Pentagram' Waveshape. BASS, which is a unidimensional value, i.e., NOT 'NumBins' dimensional as fft('FNum/NUM_FFT_BINS') and mag('SNum/NUM_SAMPLE_BINS') are [refer to: "..\WaveShapes\Rotating Corridor.txt"], can vary so quickly, that trying to use it, without taming its reactivity can produce disconcerting visuals.
In that example, I averaged the value over several (12+1) frames, and further refined is value by applying the log function.

Code: Select all

A2=12
B0="((B0*A2)+BASS)/(A2+1)"
B1="Y_EXTENTS/1.5 * log(2+B0)" 
Visit http://en.wikipedia.org/wiki/Logarithm , and you SHOULD be able to deduce that even when B0 jumps wildly (~[0:7]), B1 will react much more tamely, but NEVER being less than "Y_EXTENTS/1.5 * log(2)", i.e. if (B0 == 0).


2. Is there a way to hide the WaveShape?

'LWdt' controls the perceived 'girth'. So setting it to 0, or less, should hide your shape. It is evaluated for each step 's', which allows you to create some interesting effects. The real issue is that if your WS has MORE than one 'X/Y shape' defined, it will rule ALL of them. For NOW (I MAY retract this statement in the future), the only way I know how to control individual 'X/Y shapes', is to put each one of them in their own copy. [I have the tendency to use invocations to mean (Num>1) copies AND WS (re)startup ... I hope you don't get confused]

Code: Select all

// I used FlowField: SOLs Point and Hang, but feel free to use YOUR Favorite
//
Aspc=1 
ConB=1 
Stps="round(7.51 + rnd(2.98))"  // 10 is ~ upper limit
Num=3

B0="t/(2+ID) * (-1 ^ID)"
B1="PI*(2+(2*ID))*s + B0" 

B2="1 - (ID/4)"

X0="B2 * cos( B1 )" // X
Y0="B2 * sin( B1 )" // Y

LWdt="1.5*pos(sign(sin(ID+t/4)))"	// Switches LWdt on/off
Pen="1-(ID/NUM)"

Meta="reactive=5 detail=3 density=2 morphable=4" 
Vers=390
[After thoughts...]
When I wrote the above example, it was really off the cuff and I didn't do much thinking about any implications... however when I watch it, I see triangles and pentagons appear, where I would NOT have expected to see them since 'STPS' is being set between (
8-10). I DID play with the period, without really thinking ... see, I learn something every day!

Code: Select all

/* Vortex Flow.txt
	2010Mar28 JRM	; Second [Attempt at a] FlowField
	2010May10 JRM	; A8, 2-5 foci (?)
	2010May14 JRM	; Reduction/Simplification
*/
Aspc=1

A0="pos(sign(1-rnd(2)))"	// random  0 or 1  (discrete)
A1="abs(A0-1)"			// complement(A0), (discrete)
A2="sign(1-rnd(2))"		// +(horizonal)/-(vertical)1

A3="A2 * (.05 - (A1 * rnd(.01)))"	// Density
A4="(5 + (sign(1-rnd(2*A2)) * 3))"	// Slope (2|8)
A5="PI/A4"

A6="(.2 * sqrt(A4/2)) + pos(A2)*.4"
A7="PI * (A6 + rnd(.2))"
A8="round(1+rnd(3))"		// 2010May10

D0="A8 * (A5 + theta + (A7/(2.25-r)))"

srcX="x + (A3 * sin(D0)) + .005"
srcY="y + (A3 * cos(D0)) + .005"

Vers=393
As an adjunct, I posted a FlowField that was passed up by Andy (WTF is wrong with it anyway? :shock: ... :wink: ) that works particuliarly well with the above example... it is random, so select it as the only Flowfield and enable (GREEN) the slideshow. I like "The Haight" Colormap. No explanation of IT will EVER follow... I still don't fully understand the technicals of FFs. You can either appreciate it or ignore it.

Each 'task' copy of the given WS alters its behavior using 'ID'. But, but but ... each 'task' has its own unique shape (without having to mess with that whole virtual 's' nonsense outlined earlier)!?! What does that tell you about 'Stps' and (Num >1) (This SHOULD surprise you ... it did ME!) ... hmmmm????

In this example we toggle 'LWdt' between 0 and 1.5 using the Sine function over time ( and offset by ID ). How would the effect differ IF we REMOVE the sign() function and just use:

Code: Select all

LWdt="1.5*pos(sin(ID+t/4))"
:wink:

'Pen' is set it ensure each object has a different color/hue. As with 'LWdt', 'Pen' is evaluated for each 's'. I THINK I read somewhere setting Pen to '0' was suppose to mean NO color (though I can't find the reference), but I don't believe it is true. I THINK it is just one of the extremes of a given Colormap ... but don't quote me.

Make sure to **NOTE** the properties of:
AnyInteger raised to the 0 power
and
-1 raised to AnyInteger power

they will serve you well grasshopper


... and that Star thing? Remember I SAID:

Code: Select all

X'="A1 * cos( 2 * PI * s )"   //  (A1 == A2) Draws a 'Regular Polygon' BASED on 'Stps' granularity 
Y'="A2 * sin( 2 * PI * s )"
I conveniently forgot :P to mention when we changed the period from "( 2 * PI * s )" -> "( 2* 2 * PI * s )"! For ODD number sided object we jump OVER every other point while connecting the dots; for EVEN, the number of sides is halved and traced-over.

(In case you haven't noticed, all(?) the variables are case INDEPENDENT, so you will see slight variations in different peoples code)

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


My Mindless Self Indulgences
... nothing special, except the music...


Cry Me a River

Walk on the Wild Side

Low Spark of High Heeled Boys (Live) - 1 of 2

Low Spark of High Heeled Boys (Live) - 2 of 2
Last edited by jerohm on Thu Aug 12, 2010 5:18 pm, edited 1 time in total.

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

Post by bnh »

The following Exercises are variations on jerhom’s config shown below:

Code: Select all

Aspc=1 
ConB=1 
// Stps=6   // Best set [A2="A1"] when dealing with SMALL(Non-Default) 'Stps' 

A0="PI * 2"  // Constant 
C0="(A0 * s)" 
C1="(t/2)" 

A1=".5"      // " + rnd(.25)" remove variability 
A2="A1/1.25" // Guarantee an Ellipse 
C2="A1 * cos( C0 )"  // X 
C3="A2 * sin( C0 )"  // Y 

X0="C2 * cos(C1) - C3 * sin(C1)" // C2(X) rotated by C1 radians 
Y0="C3 * cos(C1) + C2 * sin(C1)" // C3(Y) rotated by C1 radians 

Meta="reactive=5 detail=3 density=2 morphable=4" 
Vers=390
Exercise 23-A:

http://www.bnh.net/gforce/%28new%29mine2-21a.mov

The above link shows the results of jerhom’s config and the rotating ellipse.

Exercise 23-B:

http://www.bnh.net/gforce/%28new%29mine2-21d.mov

I had been looking for WaveShapes that would illuminate only the outside of the screen in some interesting fashion, leaving the center of the screen empty for inserting video or text. To better demonstrate this idea I reference a couple of FlowFields in the .mov file to try.

Exercise 23-C: Diagonal Sweep

http://www.bnh.net/gforce/%28new%29mine2-21e.mov

The neat thing about jerhom’s config file is that “rotate” doesn’t mean just “spin.” In the above link I was able to create a straight-line diagonal sweep across the screen with a little spiral at each corner. The spiral breaks up the cycle. This is one of those WaveShapes that depends on a specific FlowField, and I suggest a couple in the .mov file. It’s also one of those WaveShapes that doesn’t want any action from the sound modifiers, e.g. mag, BASS or fft.

Exercise 23-D:

http://www.bnh.net/gforce/%28new%29mine2-23a.mov

In Jerhom’s config, the figure is actually defined in the A0-A3 plus C0, C2 and C3 variables. C1 is just the speed of rotation. The actual rotation is then added in the X/Y statements. This means replication of the WaveShape is very easy. To demonstrate this, I made an octagon by changing Stps=9, replicated the octagon shape by adding X1/Y1 and X2/Y2, separated X1/Y1 and X2/Y2 from the X0/Y0 shape (+.5 and -.5), and then caused the two new shapes to rotate in opposite directions, sort of like a cog-wheel effect.


Replication of the WaveShape can also come with the addition of certain FlowFieds. To see this effect, you can add (RG) Holodeck (for two rows of rotating octagons), (RG) Sitting Inside Looking Out (for 5 rotating octagons), G-Life (two rows of rotating octagons),

I’m sure someone can improve on this config.

Exercise 23-E: The Letter "B"

http://www.bnh.net/gforce/%28new%29mine2-27.mov

To arrive at the letter “B” from essentially this same config, I added a non-moving straight line to the left side of the screen, “rounded” the octagons by adding a lot more Stps (55), changed to ConB=0 so I could more easily see the rotation of the figures, all of which can be seen in the above referenced link.

In retrospect, it probably wasn’t worth the effort, unless your name begins with the letter “B.” I’ll leave it to Bob, Brenda, Bartholomew and the Bank of Billoxi to improve on this config.

Has anyone constructed the alphabet out of WaveShapes?

Exercise 24-A: Opposing Circles Show Need for Volume Control

http://www.bnh.net/gforce/%28new%29mine2-31b.mov

What I did find potentially useful came came when I applied the BASS function to move the “rounded pentagons” in non-colliding directions.

This is an example where control over the sound input sensitivity (discussed earlier) is essential. If the input volume is too strong, the rotating WaveShapes go off the screen. If the input volume is too weak, the WaveShapes don’t move in opposite directions. Just the right volume of sound stimulation is required to make this effect work.

I don’t know what it would take to control a ToolBar function with a WaveShape config. I know there is some control over the ToolBar via scripting, but nothing in scripting I’ve found permits control over the volume sensitivity. If the volume input sensitivity could be controlled via a script command that would help.

Exercise 24-B: The Pool Cue

http://www.bnh.net/gforce/%28new%29mine2-31a.mov

The straight line (X1/Y1) becomes a pool cue, also tied to the BASS function. You just have to have just the right sound effect – OR CONTROL OVER THE SOUND INPUT SENSITIVITY -- to pull this effect off. In the above reference .mov file, I have to manually control the input sensitivity on the ToolBar to get the desired effect.

Question for jerhom or jaypro:

RealPlayer uses what appears to be configs from G-Force and offers them free for additional download on their website. Last year there was a config called Tom Tom On The Road. It looked like a highway with a receding center stripe running down the middle. There was another config file of a stick-figure dancing on a square. They are no longer listed on their site. Do any of these ring a bell?
Last edited by bnh on Tue Aug 10, 2010 1:10 pm, edited 7 times in total.

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

WaveShape or Particle?

Post by jerohm »

A while back I pondered if there was a way to determine, from within the code, whether a Config was running as a Particle or WaveShape? At least in GF4 (probably previous versions also) this seems to work:

(dt == 0) WaveShape
(dt, [0->1]) Particle

So WHAT!, you ask...

You can modify Bob Covey's Lightning Strikes.txt'
From:

Code: Select all

// stroke gets thinner as it divides...
LWdt="5 * (pos(1-s))^.7"
 
Meta="reactive=4 detail=4 density=4 morphable=4"
To:

Code: Select all

// stroke gets thinner as it divides...
B1="select(dt, (fft(.2) > .2) , 1)"    // Tune fft(x) and threshold to YOUR liking if you wish
LWdt="B1 * 5 * (pos(1-s))^.7"          // Binary, "5 * (pos(1-s))^.7"/OFF 
Pen="B1"                               // Binary, 1/0
 
Meta="reactive=3 detail=3 density=3 morphable=4"
and you have a new really Cool Particle WITHOUT changing the original intent of the author (UNLESS Bob's original intent was for this NOT to also be a Particle :lol: )

Code: Select all

// *** Pre GF4  This SHOULD Probably work, but get on 4.0 ***
//
// stroke gets thinner as it divides...
B1="((float)(dt != 0) * (float)(fft(.2) > .2))+ (float)(dt == 0)" // FUGLY!!
LWdt="B1 * 5 * (pos(1-s))^.7"
Pen="B1"

Meta="reactive=3 detail=3 density=3 morphable=4"
Now its YOUR turn to think up cool uses!
*** Note ***
in the example, the result of our 'dt' evaluation loads a 'B" variable ...
You will have trouble IF you make this test and store the result in an 'A' variable ... why?

:wink:
Last edited by jerohm on Wed Aug 18, 2010 3:06 pm, edited 3 times in total.

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

Okay....

Post by JayPro »

What does the "d" in dt stand for?

THis seems like a function/corollary for the timing function.

I wanted to ask this for years; but was afraid of the answer I'd get, fearing an avalanche of trigonometric jargon.
"God is syntax."

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

Post by jerohm »

In calculus, you see 'dt' all of the time... and I ASSUME it means 'delta [change over] time'. Basically, it has the same meaning here. Any documentation you will find on it, is specifically in reference to a 'Particle' and goes from 0 -> 1 over the run duration of the Particle.

There is also a 'START_TIME' variable that I believe is BROKEN and is always 0... which it shouldn't be. Often you will see it derived by the GF statement:

Code: Select all

A0="t"    // Invocation Start Time

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

Only if you are interested ...

Post by jerohm »

Updated: 2010Sep30

Code: Select all

// Example of using B3 as an array[Id] (unique r/w storage, Num > 1)
// &#40;Really >>LESS<< Boring, AND USEFUL Technique&#40;s&#41; - jrm&#41;

Aspc="1"
ConB=1
Num=6

Stps="NUM_SAMPLE_BINS"	// NUM_S_STEPS

A0="&#123;&#123;1, 0, 0, 0, 0, 0 &#125;
    ,&#123;0, 1, 0, 0, 0, 0 &#125;
    ,&#123;0, 0, 1, 0, 0, 0 &#125;
    ,&#123;0, 0, 0, 1, 0, 0 &#125;
    ,&#123;0, 0, 0, 0, 1, 0 &#125;
    ,&#123;0, 0, 0, 0, 0, 1 &#125;
&#125;"				// Num x Num Mask&#40;s&#41;

B0="select&#40;&#40;col&#40;B3, Id&#41; == 0&#41; || &#40; wrap&#40;t+Id/Num&#41; < .01 &#41;
    , &#40;.3 + rnd&#40;.3&#41;&#41;, col&#40;B3, Id&#41;&#41;"	// select a random radi every so often

B1="&#40; &#40;B1*49&#41; + &#40;atan&#40; fft&#40; vectorLR&#40;NUM_S_STEPS, 0, 1&#41; &#41;&#41;/1.56&#41;&#41; / 50"	// &#91;0->~1&#93;
B2="&#40; &#40;B2*49&#41; + &#40;atan&#40; fft&#40; vectorLR&#40;NUM_S_STEPS, 1, 0&#41; &#41;&#41;/1.56&#41;&#41; / 50"	// &#91;0->~1&#93;

// >> LESS << Boring Visuals - Set Flowfield '&#40;Empty&#41;' !!

X0="&#40;B0+&#40;B1+B2&#41;&#41; * cos&#40; &#40;t/4&#41; + s * &#40;PI*2&#41;&#41;" 
Y0="&#40;B0+&#40;B1+B2&#41;&#41; * sin&#40; &#40;t/4&#41; + s * &#40;PI*2&#41;&#41;" 


B3="&#40;B3 * !row&#40;A0, Id&#41;&#41; + &#40;B0 * row&#40;A0, Id&#41;&#41;"	// WRITE!, B3&#91;Id&#93;

/*********** OR This &#40;verbose&#41; test works too! ***********

B3="select&#40;&#40;Id == 0 &#41;
       , &#123; col&#40;B0, 0&#41;, col&#40;B3, 1&#41;, col&#40;B3, 2&#41;, col&#40;B3, 3&#41;, col&#40;B3, 4&#41;, col&#40;B3, 5&#41; &#125;
       , select&#40;&#40;Id == 1 &#41;
         , &#123; col&#40;B3, 0&#41;, col&#40;B0, 0&#41;, col&#40;B3, 2&#41;, col&#40;B3, 3&#41;, col&#40;B3, 4&#41;, col&#40;B3, 5&#41; &#125;
         , select&#40;&#40;Id == 2 &#41;
           , &#123; col&#40;B3, 0&#41;, col&#40;B3, 1&#41;, col&#40;B0, 0&#41;, col&#40;B3, 3&#41;, col&#40;B3, 4&#41;, col&#40;B3, 5&#41; &#125;
           , select&#40;&#40;Id == 3 &#41;
             , &#123; col&#40;B3, 0&#41;, col&#40;B3, 1&#41;, col&#40;B3, 2&#41;, col&#40;B0, 0&#41;, col&#40;B3, 4&#41;, col&#40;B3, 5&#41; &#125;
             , select&#40;&#40;Id == 4 &#41;
               , &#123; col&#40;B3, 0&#41;, col&#40;B3, 1&#41;, col&#40;B3, 2&#41;, col&#40;B3, 3&#41;, col&#40;B0, 0&#41;, col&#40;B3, 5&#41; &#125;
               , &#123; col&#40;B3, 0&#41;, col&#40;B3, 1&#41;, col&#40;B3, 2&#41;, col&#40;B3, 3&#41;, col&#40;B3, 4&#41;, col&#40;B0 ,0&#41; &#125;
               &#41; 
             &#41;
           &#41;
         &#41;
       &#41;"
***********/

LWdt=1
Pen="B0"

Meta="reactive=4 detail=3 density=3 morphable=4"
Vers=400
Last edited by jerohm on Thu Sep 30, 2010 2:25 pm, edited 2 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 wrote:In calculus (editor's emphasis), you see 'dt' all of the time...


See? Me=Oil. Advanced Mathematics=Vinegar. :P
"God is syntax."

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

Post by jerohm »

If you find an error in my code, you get my Overwhelming Gratitude, but Nothing more ... :wink:

Code: Select all

/* Controlled Reactivity Study &#91;aka Horseplay&#93;
*/
Stps="NUM_SAMPLE_BINS"  // NUM_S_STEPS

// Suggested Start &#91;Only!, of course&#93;&#58; CM&#40;'The Haight'&#41;, FF&#40;'&#40;Empty&#41;'&#41;
// test streams, choosen for their different characteristics
//  &#40;not necessarily content ;0&#41;
//
// - http&#58;//indieheartradio.com&#58;8000
//  or
// - http&#58;//208.80.52.106&#58;80/CBS_R20_794P_F128CMP3?SRC=AOL&DIST=AOL&TGT=Winamp

Aspc="1"
ConB=1
Num=5

// Modify A0-A4 at will &#91;Original Default Values&#93;
//
A0="20"                 // &#91;20&#93; Frame Averaging

A1="0x1f"               // &#91;0x1f&#93; Enable Bitmap 0x01 == &#40;Id == 0&#41;; 0x10 == &#40;ID == 4&#41;
A2=1                    // &#91;1&#93; Normalization On&#40;1&#41;/Off&#40;0&#41;
A3=0                    // &#91;0&#93;   Normalization type mag&#91;0&#93;/fft&#91;1&#93;
A4=".5"                 // &#91;.5&#93;  Normalization Scale


A5="vectorLR&#40;NUM_S_STEPS, 0, 1&#41;"
B0="dot&#40;abs&#40;mag&#40;A5&#41;&#41;&#41;/cols&#40;A5&#41; * 5"     // &#40;mag&#41; Reactivity &#40;* 5&#41;
B1="&#40;&#40;B1*&#40;A0-1&#41;&#41; + &#40;B0 * 5&#41; &#41;/A0"       // Id&#91;0&#93;; SCALED&#40;5x5&#41; and AVERAGED&#40;A0&#41;

B2="&#40;Max&#40;B2,B0&#41;+B0&#41;/2"
B3="B2/&#40;B0+.0001&#41;"                      // &#91;mag&#93; Normalization

B4="B0*B3"
B5="&#40;&#40;B5*&#40;A0-1&#41;&#41; + B4&#41;/A0"              // Id&#91;1&#93;; Normalized AVERAGED&#40;A0&#41;

B6="atan&#40;BASS&#41;"
B7="&#40;&#40;B7*&#40;A0-1&#41;&#41; + &#40;B6 *.2&#41; &#41;/A0"       // Id&#91;2&#93;; SCALED&#40;.2&#41; and AVERAGED&#40;A0&#41;

B8="log10&#40;1+B6&#41;"
B9="&#40;&#40;B9*&#40;A0-1&#41;&#41; + &#40;B8 *.2&#41; &#41;/A0"       // Id&#91;3&#93;; SCALED&#40;.2&#41; and AVERAGED&#40;A0&#41;


FNUM="15"               // NUM_FFT_BINS
A6="vectorLR&#40;NUM_FFT_BINS, 0, 1&#41;"
B10="dot&#40;&#40;fft&#40;A6&#41;&#41;&#41;/cols&#40;A6&#41;"           // &#40;fft&#41; Reactivity
B11="&#40;&#40;B11*&#40;A0-1&#41;&#41; + &#40;B10&#41; &#41;/A0"        // Id&#91;4&#93;; SCALED&#40;1&#58;1&#41; and AVERAGED&#40;A0&#41;

B12="&#40;Max&#40;B12,B10&#41;+B10&#41;/2 +.0001"
B13="B12/&#40;B10+.0001&#41;"                   // &#91;fft&#93; Normalization

B14="select&#40;Id, select&#40;&#40;Id==1&#41;, B5, select&#40;&#40;Id==2&#41;, B7, select&#40;&#40;Id==3&#41;, B9, B11&#41;&#41;&#41;, B1&#41;"

B15="&#40;&#40;B15*&#40;A0-1&#41;&#41; + &#40;A4*select&#40;A3,B13,B3&#41;&#41;&#41;/A0"        // &#91;Scaled & Averaged&#93; Normalization 

B16="&#40;&#40;Id/10&#41;+.2&#41; +  select&#40;A2,B15,1&#41; * B15 * &#40;B14 * &#40;A1 & &#40;1<<Id&#41;&#41;&#41;"

X0="B16 * cos&#40;s*&#40;Pi*2&#41;&#41;"        // x
Y0="B16 * sin&#40;s*&#40;Pi*2&#41;&#41;"        // y

Pen=".5 + &#40;Id/Num&#41;"
Meta="reactive=3 detail=3 density=3 morphable=4"
Vers=400

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

Post by bnh »

jerohm wrote:

Code: Select all

/* Controlled Reactivity Study &#91;aka Horseplay&#93;
*/
Stps="NUM_SAMPLE_BINS"  // NUM_S_STEPS
Aspc="1"
ConB=1
Num=5

// Modify A0-A4 at will &#91;Original Default Values&#93;
//
A0="20"                 // &#91;20&#93; Frame Averaging

A1="0x1f"               // &#91;0x1f&#93; Enable Bitmap 0x01 == &#40;Id == 0&#41;; 0x10 == &#40;ID == 4&#41;
A2=1                    // &#91;1&#93; Normalization On&#40;1&#41;/Off&#40;0&#41;
A3=0                    // &#91;0&#93;   Normalization type mag&#91;0&#93;/fft&#91;1&#93;
A4=".5"                 // &#91;.5&#93;  Normalization Scale


A5="vectorLR&#40;NUM_S_STEPS, 0, 1&#41;"
B0="dot&#40;abs&#40;mag&#40;A5&#41;&#41;&#41;/cols&#40;A5&#41; * 5"     // &#40;mag&#41; Reactivity &#40;* 5&#41;
B1="&#40;&#40;B1*&#40;A0-1&#41;&#41; + &#40;B0 * 5&#41; &#41;/A0"       // Id&#91;0&#93;; SCALED&#40;5x5&#41; and AVERAGED&#40;A0&#41;

Question for Jerohm:

In the above referenced code, would you please explain A1?

Here are some variations on your WaveShape combined with 3 and 4 pixel ColorMaps (using only 3 or 4 pixels instead of 256.) The sprite backgrounds, when used, are 64-shades-of-gray stripes or 64-shades-of-gray solid panels.

1. 3 Pixel CM (RGB). Sprite in background with EPen=.9

Image

2. 4 Pixel CM (RBGY). Sprite in background is 64-shades- of- gray panel.

Image

3. Movie with FF=Gravity.

http://www.bnh.net/gforce/reactive1.mov
Last edited by bnh on Sun Oct 17, 2010 12:38 pm, edited 1 time in total.

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

Post by jerohm »

I used the above test WaveShape to compare different Reactivity algorithms and attributes. As previously mentioned, BASS is just a little too unwieldy unless tamed by some means. The same can be said about individual fft(x) bins, to a lessor degree.

Andy seems to like 'atan(...)', which limits values to (~+/-1.57, namely Pi/2). Before studying what others had already done, I gravitated to log10(1+x) for x>0, which keeps things between 0-1 at a slightly different rolloff rate. Which is better? ... pretty much personal choice.

'A1' allows the user to select WHICH Id(s), algorithm(s) hear [SIC ... :lol: ], to display. '0x' format is being used; the standard hexidecimal representation (supported, but undocumented). Setting A1 to '0x1F', sets the 5 least significant bits, where each maps to an Id, 0,1,2,3,4 ... and thus setting them ALL for display. '0x11' would turn on Id[0] and Id[4] Only (make sense?).

I didn't add any commentary to be previous post because I started playing with the 'vector' functions ... and although they provide alternate views and paths, they add a degree of complexity that I am Not qualified/prepared to explain. That is not to say YOU can't use proven :roll: idiomatic constructs in your work :wink:

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

I used:

Code: Select all

/*  fft&#40;&#41; study
*/
ConB=1
FNum=185		// "NUM_FFT_BINS"
Num=185	// Can NOT use "NUM_FFT_BINS", doesn't Work!
Stps=2

A0="2-&#40;2/Num&#41;"
A1=".975"
A2="vectorLR&#40;NUM_FFT_BINS, 0, 1&#41;"

B0="ID/Num"
B1="&#40;A0*B0&#41; - &#40;A0/2&#41;"	// X Position

B2="select&#40;Id, B2, fft&#40;A2&#41;&#41;"	// tricky fft&#40;Id/&#40;Num-1&#41;&#41;
C0="col&#40;B2, Id&#41; * s"

X0=" B1"
Y0="&#40;2*C0-A1&#41;"		// Intensity *2

Pen=1
LWdt=1

Meta="reactive=5 detail=4 density=4 morphable=4"
Vers=391
and these Logarithmic Frequency sweeps

LSweep40-20KHz.mp3
LSweep1170-10270Hz.mp3
LSweep115-4150Hz.mp3

using the WinAmp plugin, and WinAmp driving the Standalone via VC. I tried (really) to create some YouTube footage to show you my results, but ran into some unexplainable phenomena that I need to sort out. You can play around for yourselves. What seems to be true is that the WinAmp plugin has an optimal active range of ~1170-10270Hz where the Standalone reacts optimally to ~115-4150Hz ... which certainly explains why people have had trouble writing stuff that reacts to the Bass line. I have included a 40-20K sweep for reference. I can do WMP, but it would be interesting to know about other player results... Don't be afraid to challange my results ... they may be wrong. Also there is a mapping function defined in the Preferences that I have NOT taken into consideration.

15Oct2010
8) Look what I found in '\Program Files\SoundSpectrum\G-Force\Resources\Common\Boot Finish.txt'

Code: Select all

// See script docs for info
SetFFTParams&#40; 120, 4000, 6, .008, .07, false &#41;;
16Oct2010
This is applicable to the Standalone version only. You can add the 'SetFFTParams()' to the end of your '...Scripts\Startup.txt' if you want to play around. You can't put in just any values ... I personally have tried

Code: Select all

SetFFTParams&#40; 50,5000, 3, .008, .07, false &#41;;
without any serious repercussions.

oh yeah, the unexplainable phenomena previously cited seems to have to do with WinAmp, Virtual Cable, GF & Fraps feedback, but I don't have enough details at this point
Last edited by jerohm on Sat Oct 16, 2010 8:06 pm, edited 1 time in total.

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

Post by bnh »

Great research. The rolloff phenomenon explains a problem I was having while scripting a piano piece using a variation of the Linvincible Waveshape. The music chromatically extends to the extreme ends of the piano, similar to using two audio sweeps going in opposite directions at the same time. The WaveShape response was disappointing and the effect was not what I expected. Now I understand why.

An FFT setting of 120 is around C3, the octave below middle C, which leaves 2+ octaves to reach the extremes of the piano. No wonder the WaveShape wouldn't track. Now I can find that file you mention and make some adjustments.

I'm assuming that Standalone, when presented with a stereo .wav audio track with good isolation between channels, sums those two channels to the extent that it might as well be a mono track?

I'm going to have to abandon experimenting with your reactive WaveShape for the moment because I'm having too many problems with 4.0.1. When I reverted to 3.92 and loaded your reactive WaveShape, the screen lit up like I was reading a book in Kindle.

The above photos were taken with 4.0.1, and I started to see some variations in the delayed reaction to flowfields I couldn't explain. You are correct. I live in a state of confusion, before, during and after I try to understand math. :)

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

Post by jerohm »

This is a modified version of an example above... It relies on the ACTUAL underlying vector nature of the implementation... so you won't find any documentation (other than 'VectorC.h'). Certain constructs that I would expect to work, don't ... so do NOT assume anything ... It is just kinda interesting IF you are curious.

have fun...

Code: Select all

// Example of using B3 as an array&#91;Id&#93; &#40;unique r/w storage, Num > 1&#41; 
// &#40;Really >>LESS<< Boring, AND USEFUL Technique&#40;s&#41; - jrm&#41;
//
// &#40;*&#41; Yet Another Alternate &#40;non-intuitive&#41; Solution 

Aspc="1" 
ConB=1 
Num=3                   // &#40;*&#41; Reduced to make clearer 

Stps="NUM_SAMPLE_BINS"  // NUM_S_STEPS 

// A0="&#123;&#123;1, 0, 0, 0, 0, 0 &#125; 
//    , &#123;0, 1, 0, 0, 0, 0 &#125; 
//    , &#123;0, 0, 1, 0, 0, 0 &#125; 
//    , &#123;0, 0, 0, 1, 0, 0 &#125; 
//    , &#123;0, 0, 0, 0, 1, 0 &#125; 
//    , &#123;0, 0, 0, 0, 0, 1 &#125; 
// &#125;"            // Num x Num Mask&#40;s&#41; &#91;&#40;*&#41; Previous Solution&#93;

A0="vectorLR&#40;Num, 0, Num-1&#41;"    // &#40;*&#41; &#123; 0, 1, 2 &#125;
 

B0="select&#40;&#40;col&#40;B3, Id&#41; == 0&#41; || &#40; wrap&#40;t+Id/Num&#41; < .01 &#41; 
    , &#40;.3 + rnd&#40;.3&#41;&#41;, col&#40;B3, Id&#41;&#41;"   // select a random radi every so often 

B1="&#40; &#40;B1*49&#41; + &#40;atan&#40; fft&#40; vectorLR&#40;NUM_S_STEPS, 0, 1&#41; &#41;&#41;/1.56&#41;&#41; / 50"   // &#91;0->~1&#93; 
B2="&#40; &#40;B2*49&#41; + &#40;atan&#40; fft&#40; vectorLR&#40;NUM_S_STEPS, 1, 0&#41; &#41;&#41;/1.56&#41;&#41; / 50"   // &#91;0->~1&#93; 

// >> LESS << Boring Visuals - Set Flowfield '&#40;Empty&#41;' !! 

X0="&#40;B0+&#40;B1+B2&#41;&#41; * cos&#40; &#40;t/4&#41; + s * &#40;PI*2&#41;&#41;" 
Y0="&#40;B0+&#40;B1+B2&#41;&#41; * sin&#40; &#40;t/4&#41; + s * &#40;PI*2&#41;&#41;" 


// B3="&#40;B3 * !row&#40;A0, Id&#41;&#41; + &#40;B0 * row&#40;A0, Id&#41;&#41;"   // WRITE!, B3&#91;Id&#93;

// Note that A0 is a 'vector', namely '&#123;0, 1, 2&#125;' so the evaluation against 'Id' occurs for each
// element.  What is particuliarly interesting, is that attempting to pre-evaluate '&#40;Id == A0&#41;'
// and assign it to its own B variable DOES NOT SEEM TO WORK as one might expect, i.e.,
//
//   B4="&#40;Id == A0&#41;"                    // DOES NOT WORK AS EXPECTED
//   B3="&#40;B3 * !B4&#41; + &#40;B0 * B4&#41;"        // DOES NOT WORK AS EXPECTED 
//
   B3="&#40;B3 * !&#40;Id == A0&#41;&#41; + &#40;B0 * &#40;Id == A0&#41;&#41;"     // &#40;*&#41; WRITE!, B3&#91;Id&#93;


LWdt=1 
Pen="B0" 

Meta="reactive=4 detail=3 density=3 morphable=4" 
Vers=400 
In case you fail to appreciate the power of this idiomatic construct, I applied it to a still earlier example that depended on (rather complicated) bit masking and was limited by the bit width of the B variable. Here I cranked the instance count to 19, because of visual appeal. :wink:

Code: Select all

// Polygon Promenade v2 jrm 22Oct2010
Aspc=1 
ConB=1
Num=19

A0="vectorLR&#40;Num, 0, Num-1&#41;"
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
B2="log10&#40;2-B1&#41;* 2"			// Spiral Density - Personal Choice
B3="A2*B0/1.5"				// descent direction & rate


C0="B2 * 3 * cos&#40; B3 &#41;"		// 'X' trajectory  
C1="B2 * 3 * 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.
 
B4=""
B5=""

// &#40;Sides+1&#41; per Regular Polygon, MIN 4, triangle

B6="select&#40;&#40;B1 == 0&#41; || &#40;col&#40;B7, Id&#41; == 0&#41;
   , select&#40;col&#40;B7, Id&#41;, round&#40;3.51+ rnd&#40;6.49&#41;&#41;, &#40;Id % 8&#41;+4 &#41;
   , col&#40;B7, Id&#41;&#41;"

A3="PI * 2"     // Constant 
C2="&#40;A3 * &#40;trunc&#40;s*B6&#41;/&#40;B6-1&#41;&#41;&#41; - &#40;t/A2&#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"

B7="&#40;B7 * !&#40;Id == A0&#41;&#41;  + &#40;B6 * &#40;Id == A0&#41;&#41;"	// WRITE!, B7&#91;Id&#93;


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

Post Reply