Writing (or coding) waveshapes

Discussion forum for G-Force users

Moderators: BTT, andy55, b.dwall, juxtiphi

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

Post by FrankN »

Thanks, Jerohm!

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

Rotating SOLID Cube

Post by jerohm »

This is a Particle, I guess. It actually is just another exercise on how to accomplish a specific goal( ...also, I kinda wanted to make sure my brain still worked). I started with the code from a previous post, and went from there. If you want to do me one up, make it spin (like the cube)... or find a more elegant solution.


Code: Select all

/* Rotating SOLID Cube (VectorC version - jrm)

The ORIGINAL config was created by Thomas Geier (ziggystar(at)gmx.de), who made the programming
and Aaron Pinsker, who had the idea for this.

*/

Aspc=1          //We want the tetraeder to look like one
ConB=1          //Let G-Force draw the lines (connect the two points)


A0=".8"                         // This is the size of the cube
A1="1 + rnd( 4 )"               //[UNREF]  Cube line width
A2="clip( .5 + rnd( 1 ) )"      //[UNREF]  Cube intensity

/*
 X  Y  Z  Cube Coordinates
=========
-1, 1, 1
-1,-1, 1
 1,-1, 1
 1, 1, 1
-1, 1,-1
-1,-1,-1
 1,-1,-1
 1, 1,-1

or transposed:

Coor      0   1   2   3   4   5   6   7
=========================================
X      { -1, -1,  1,  1, -1, -1,  1,  1 }
Y      {  1, -1, -1,  1,  1, -1, -1,  1 }
Z      {  1,  1,  1,  1, -1, -1, -1, -1 }

*/

X=0     // Row #s; Yes, this is valid
Y=1
Z=2

Stps=11

// Coordinates:
//        0   1   2   3   4   5   6   7
// ======================================
A3=" { { -1, -1,  1,  1, -1, -1,  1,  1 }
     , {  1, -1, -1,  1,  1, -1, -1,  1 }
     , {  1,  1,  1,  1, -1, -1, -1, -1 } } *.5"    // X, Y, Z; Cube

// Plot Path (order):

A4="A0 * { col(A3,1), col(A3,2), col(A3,3), col(A3,0), col(A3,1)
         , col(A3,5), col(A3,4), col(A3,7), col(A3,3), col(A3,0)
         , col(A3,4) }"   // X, Y, Z


A5="{ { 1, 1,-1,-1 }
    , {-1, 1, 1,-1 }
    }"

A6="{ row(A4,X)
    , row(A4,Y)
    }"

B0="t/6"

/*** >>> Replaced, 26Sept <<<
 B1="trunc&#40;B0/&#40;Pi/2&#41;&#41; % 4"
 B2="A6 * col&#40;A5,B1&#41;"

 B3="B2 * cos&#40; B0 &#41;"
 B4="B2 * sin&#40; B0 &#41;"
***/

// >>> okay... this IS Better &#40;Understand Why?&#41; <<< &#58;
B1=""		//&#91;UNREF&#93; 
B2="col&#40; A5
       , &#40;B0/&#40;Pi/2&#41;&#41; % 4&#41;"

B3="A6 * &#40;B2 * cos&#40; B0 &#41;&#41;"
B4="A6 * &#40;B2 * sin&#40; B0 &#41;&#41;"


// X'= &#40;X  * cos&#40;t0&#41; - Y * sin&#40;t0&#41;&#41;
// Y'= &#40;X  * sin&#40;t0&#41; + Y * cos&#40;t0&#41;&#41;
// Y"= &#40;Y' * sin&#40;t1&#41; + Z * cos&#40;t1&#41;&#41;, assumes &#40;t0 == t1&#41;
//   OR
// Y"= &#40;X * sin&#40;t0&#41; + Y * cos&#40;t0&#41;&#41; * sin&#40;t1&#41; + Z * cos&#40;t1&#41;

B5="  row&#40;B3,X&#41; - row&#40;B4,Y&#41;"					// X'
B6="&#40; row&#40;B4,X&#41; + row&#40;B3,Y&#41; &#41; * sin&#40; Pi/16 &#41;  + row&#40;A4,Z&#41;"      // Y"

X0="B5"
Y0="B6"


// Pen="a2"
LWdt="1.5"       //The line width &#40;I made changing. Looks good&#41;

// Meta="reactive=0 detail=3 density=3"		// for pre 5.00
Vers=500

27Sept
I really WANTED one of you to come up with this solution, before me... Is there anybody out there??
:?
Note, I negated row(A3, Y) because one could argue it was inconsistent in the first place. :oops:
(... and I HOPE multiplication by 1 is reduced by the compiler... )

Code: Select all

/* Spinning SOLID Cube &#40;VectorC version - jrm&#41;

The ORIGINAL config was created by Thomas Geier &#40;ziggystar&#40;at&#41;gmx.de&#41;, who made the programming
and Aaron Pinsker, who had the idea for this.

*/

Aspc=1          //We want the tetraeder to look like one
ConB=1          //Let G-Force draw the lines &#40;connect the two points&#41;


A0=".8"                         // This is the size of the cube
A1="1 + rnd&#40; 4 &#41;"               //&#91;UNREF&#93;  Cube line width
A2="clip&#40; .5 + rnd&#40; 1 &#41; &#41;"      //&#91;UNREF&#93;  Cube intensity

/*
 X  Y  Z  Cube Coordinates
=========
-1, 1, 1
-1,-1, 1
 1,-1, 1
 1, 1, 1
-1, 1,-1
-1,-1,-1
 1,-1,-1
 1, 1,-1

or transposed&#58;

Coor      0   1   2   3   4   5   6   7
=========================================
X      &#123; -1, -1,  1,  1, -1, -1,  1,  1 &#125;
Y      &#123;  1, -1, -1,  1,  1, -1, -1,  1 &#125;
Z      &#123;  1,  1,  1,  1, -1, -1, -1, -1 &#125;

*/

X=0     // Row #s; Yes, this is valid
Y=1
Z=2

// Coordinates&#58;
//        0   1   2   3   4   5   6   7
// ======================================
A3=" &#123; &#123; -1, -1,  1,  1, -1, -1,  1,  1 &#125;
     ,-&#123;  1, -1, -1,  1,  1, -1, -1,  1 &#125;
     , &#123;  1,  1,  1,  1, -1, -1, -1, -1 &#125; &#125; *.5"    // X, Y, Z; Cube

// Plot Path &#40;order&#41;&#58;
//
Stps=11
A4="A0 * &#123; col&#40;A3,1&#41;, col&#40;A3,2&#41;, col&#40;A3,3&#41;, col&#40;A3,0&#41;, col&#40;A3,1&#41;
         , col&#40;A3,5&#41;, col&#40;A3,4&#41;, col&#40;A3,7&#41;, col&#40;A3,3&#41;, col&#40;A3,0&#41;
         , col&#40;A3,4&#41; &#125;"                             // rows&#40;X, Y, Z&#41;

/**** >>> Replaced, 27Sept <<<
A5="&#123; &#123;  1,  1, -1, -1 &#125;
    , &#123; -1,  1,  1, -1 &#125;
    &#125;"

// 28Sep - so how many of you guys realized that col&#40;A5,0-3&#41; == col&#40;A5,4-7&#41; ??
// so it can be reduced to only the first 4 cols - do'h!
//
A5="&#123; &#123;  1, -1,  1, -1,  1, -1,  1, -1 &#125;
    , &#123;  1,  1,  1,  1,  1,  1,  1,  1 &#125;
    , &#123;  1,  1, -1, -1,  1,  1, -1, -1 &#125;
    &#125;"

****/

A5="&#123; &#123;  1, -1,  1, -1 &#125;
    , &#123;  1,  1,  1,  1 &#125;
    , &#123;  1,  1, -1, -1 &#125;
    &#125;"

B0="t/6"
B1=""		//&#91;UNREF&#93; 
B2="col&#40; A5
       , &#40;B0/&#40;Pi/2&#41;&#41; % 4&#41;"    // 28Sep, 8 -> 4

B3="A4 * &#40;B2 * cos&#40; B0 &#41;&#41;"
B4="A4 * &#40;B2 * sin&#40; B0 &#41;&#41;"

// X'= &#40;X  * cos&#40;t0&#41; - Y * sin&#40;t0&#41;&#41;
// Y'= &#40;X  * sin&#40;t0&#41; + Y * cos&#40;t0&#41;&#41;
// Y"= &#40;Y' * sin&#40;t1&#41; + Z * cos&#40;t1&#41;&#41;, assumes &#40;t0 == t1&#41;
//   OR
// Y"= &#40;X * sin&#40;t0&#41; + Y * cos&#40;t0&#41;&#41; * sin&#40;t1&#41; + Z * cos&#40;t1&#41;

B5="&#40; row&#40;B3,X&#41; - row&#40;B4,Y&#41; &#41;"					// X'
B6="&#40; row&#40;B4,X&#41; + row&#40;B3,Y&#41; &#41; * sin&#40; B0 &#41;  + row&#40;B3,Z&#41;"         // Y"

X0="B5"
Y0="B6"


// Pen="a2"
LWdt="1.5"       //The line width &#40;I made changing. Looks good&#41;

// Meta="reactive=0 detail=3 density=3"		// for pre 5.00
Vers=500

28Sept
okay, this is the logical conclusion to this post, and combines the previous two configs into one... It randomly executes one of the two presentations, depending on A1. This represents pretty much the process I always go through whenever I write a new config. It is evolutionary, and there are a lot of baby steps and revelations along the way (that no one sees except me). I hope somebody finds it useful :?
- jrm

Code: Select all

/* Rotating&#40;0&#41;/Spinning&#40;1&#41; SOLID Cube &#40;VectorC version - jrm&#41;

The ORIGINAL config was created by Thomas Geier &#40;ziggystar&#40;at&#41;gmx.de&#41;, who made the programming
and Aaron Pinsker, who had the idea for this.

*/

Aspc=1          //We want the tetraeder to look like one
ConB=1          //Let G-Force draw the lines &#40;connect the two points&#41;


A0=".8"                         // This is the size of the cube

A1="choice&#40;&#123;0, 1&#125;&#41;"             // Rotate&#40;0&#41;, Spin&#40;1&#41;
A2="&#40;!A1&#41; * Pi/32"              // Rotate Z angle &#40;static&#41;


/*
 X  Y  Z  Cube Coordinates
=========
-1, 1, 1
-1,-1, 1
 1,-1, 1
 1, 1, 1
-1, 1,-1
-1,-1,-1
 1,-1,-1
 1, 1,-1

or transposed&#58;

Coor      0   1   2   3   4   5   6   7
=========================================
X      &#123; -1, -1,  1,  1, -1, -1,  1,  1 &#125;
Y      &#123;  1, -1, -1,  1,  1, -1, -1,  1 &#125;
Z      &#123;  1,  1,  1,  1, -1, -1, -1, -1 &#125;

*/

X=0     // Row #s; Yes, this is valid
Y=1
Z=2

// Coordinates&#58;
//        0   1   2   3   4   5   6   7
// ======================================
A3=" &#123; &#123; -1, -1,  1,  1, -1, -1,  1,  1 &#125;
     , &#123;  1, -1, -1,  1,  1, -1, -1,  1 &#125; * &#40;-1 ^ A1&#41;
     , &#123;  1,  1,  1,  1, -1, -1, -1, -1 &#125; &#125; *.5"        // X, Y, Z; Cube

// Plot Path &#40;order&#41;&#58;
//
Stps=11
A4="A0 * &#123; col&#40;A3,1&#41;, col&#40;A3,2&#41;, col&#40;A3,3&#41;, col&#40;A3,0&#41;, col&#40;A3,1&#41;
         , col&#40;A3,5&#41;, col&#40;A3,4&#41;, col&#40;A3,7&#41;, col&#40;A3,3&#41;, col&#40;A3,0&#41;
         , col&#40;A3,4&#41; &#125;"                                 // rows&#40;X, Y, Z&#41;

A5="select&#40;A1, &#123; &#123;  1, -1,  1, -1 &#125;
               , &#123;  1,  1,  1,  1 &#125;
               , &#123;  1,  1, -1, -1 &#125;
               &#125;
             , &#123; &#123;  1,  1, -1, -1 &#125;
               , &#123; -1,  1,  1, -1 &#125;
               , &#123;  1,  1,  1,  1 &#125;
               &#125; &#41;"

B0="t/6"
B1="col&#40; A5
       , &#40;B0/&#40;Pi/2&#41;&#41; % 4&#41;"

B2="A4 * &#40;B1 * cos&#40; B0 &#41;&#41;"
B3="A4 * &#40;B1 * sin&#40; B0 &#41;&#41;"

// X'= &#40;X  * cos&#40;t0&#41; - Y * sin&#40;t0&#41;&#41;
// Y'= &#40;X  * sin&#40;t0&#41; + Y * cos&#40;t0&#41;&#41;
// Y"= &#40;Y' * sin&#40;t1&#41; + Z * cos&#40;t1&#41;&#41;, assumes &#40;t0 == t1&#41;
//   OR
// Y"= &#40;X * sin&#40;t0&#41; + Y * cos&#40;t0&#41;&#41; * sin&#40;t1&#41; + Z * cos&#40;t1&#41;

B4="&#40; row&#40;B2,X&#41; - row&#40;B3,Y&#41; &#41;"                                          // X'
B5="&#40; row&#40;B3,X&#41; + row&#40;B2,Y&#41; &#41; * sin&#40;&#40;A1*B0&#41; + A2&#41;
    +  &#40;A1* row&#40;B2,Z&#41;&#41; + &#40;&#40;!A1&#41;* row&#40;A4,Z&#41;&#41;"                            // Y"

// ALL of these are valid solutions, but runtime efficiency is really a function of
// HOW SMART the compile was done... which I have no idea,
// but relative to flowfield processing time, it may be irrelevant anyway - jrm
// 
//  +  &#40;A1* row&#40;B2,Z&#41;&#41; + &#40;&#40;!A1&#41;* row&#40;A4,Z&#41;&#41;"                            // Y"
//  +  select&#40;A1, row&#40;B2,Z&#41;, row&#40;A4,Z&#41;&#41;"                                // Y"
//  +  row&#40; select&#40;A1, B2, A4&#41;, Z&#41;"                                     // Y"

X0="B4"
Y0="B5"

LWdt="1.5"

// Meta="reactive=0 detail=3 density=3"		// for pre 5.00
Vers=500

In any case, enjoy, or ignore :wink:

User avatar
DanPin
Posts: 161
Joined: Tue Mar 15, 2016 8:43 pm
Location: Los Angeles County, California

Post by DanPin »

Okay, we're back on track!

It took some hard work on finishing this waveshape. It was nearly successful after I tested it. If anyone knows this, I'll have it pending for tweaking or approval:

Bouncing Bars.txt

Code: Select all

C0="&#40; sin&#40; .3 * t * PI &#41; &#41;"
C1="pos&#40; .3 * BASS &#41;"
C2="cos&#40; PI * &#40; s - .5 &#41; &#41;"

X0=".5 + C1 * C2"
Y0="C0"

X1="-C1 * C2"
Y1="-C0"

X2=".5 + C1 * C2"
Y2="-C0"

Y3="-C1 * C2"
Y3="C0"

ConB=1
LWdt="BASS * C2"

Vers=540
Let me know if it needs tweaking.

wenyue
Posts: 1
Joined: Sun Nov 06, 2016 3:36 am

Post by wenyue »

.
EDITED BY BTT - REASON:- REMOVED SPAM CONTENT.

User avatar
DanPin
Posts: 161
Joined: Tue Mar 15, 2016 8:43 pm
Location: Los Angeles County, California

Post by DanPin »

I have reconfigured C0 and changed it to B0 (which is evaluated at the start of each frame). However, it still needs tweaking, so if Jerohm can help me out with that, please let me know.

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

Post by jerohm »

For that matter, C1 should also be a Bvar. I ran your code, and it doesn't blowup, but I have no idea what you were trying to do!?! Why don't you post IN WORDS, exactly what you are attempting to do.

But if you are serious, you need to feel comfortable drawing objects WAY before you play with reactivity, 'Pen', or 'Lwdt'... that comes LATER. Why don't you try drawing a geometric object and making it spin, and/or move around the screen? You need to have a firm grasp of polar and rectangular coordinates FIRST (as well as how 'Num_S_Steps' figures in).

Some good starting points:
Wikipedia Polar coordinate system
Wikipedia Rotation of axes

All the easy problems have already been solved. Be prepared to do MOST of the effort yourself [translated: you better have exhausted all options on your own, BEFORE you ask me]... I already [mostly] know this stuff, and don't do real well holding hands. My willingness to help will be a directly proportional to the effort YOU expend. That is all folks.

Strike 1
Forget you ever heard of 'VectorC' ... It has absolutely no relevance as far as you are concerned. Where is the EXACT DESCRIPTION of what you are attempting to do in WORDS that I requested???? If you can't provide that, how do you expect anybody else to read your mind?? (I also have a problem screwing up this thread with gibberish - Start a new thread... it can be solely YOUR OWN!).
VVVVVVV
Last edited by jerohm on Mon Nov 07, 2016 5:03 pm, edited 1 time in total.

User avatar
DanPin
Posts: 161
Joined: Tue Mar 15, 2016 8:43 pm
Location: Los Angeles County, California

Post by DanPin »

jerohm wrote:For that matter, C1 should also be a Bvar.
C0 is actually B0. Again, I have changed it. In that case, here it is:

Code: Select all

B0="&#40; sin&#40; .3 * t * PI &#41; &#41;" 
C0="pos&#40; .3 * BASS &#41;" 
C1="cos&#40; PI * &#40; s - .5 &#41; &#41;" 

X0=".5 + C0 * C1" 
Y0="B0" 

X1="-C0 * C1" 
Y1="-B0" 

X2=".5 + C0 * C1" 
Y2="-B0" 

Y3="-C0 * C1" 
Y3="C0" 

ConB=1 
LWdt="BASS * C1" 

Vers=540
JRM, it may need to be tweaked and rewritten in the VectorC compiler form. So if you could help me out with that, it'll be very appreciated.

UPDATE: As far as you're telling me that I don't know what VectorC is, I have corrected the above scentence.

EDITED BY BTT - REASON:- REMOVED LINK.

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

Post by BTT »

Hello DanPin


Hello Danpin - As you know links other than SoundSpectrum are not allowed on the forum. I removed a link you posted yesterday, and now another one today. PLEASE do not post links other than SoundSpectrum again. Thank you
.
Regards BTT

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

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

20th Anniversary of G-Force initial release (right??)

Post by jerohm »

how time flies...
(Particle, Oldie... I write smarter code now, but this should still work)

Code: Select all

//* Time Pieces &#40;JRM&#41;

	2009Nov15	JRM - Creation
		Original trajectory code by David Tryse &#40;DT - ZoomPlanet.txt&#41;

*/
 Stps="trunc&#40;Num_S_Steps/12&#41;*12"
 
 NUM="1 + round&#40;rnd&#40;4&#41;&#41;"
 Aspc=1
 ConB=1
 PDur=40
 
 A0="t"
 A1="max&#40; 30, &#40;END_TIME - A0&#41;&#41;"

 A2="4-pos&#40;-sign&#40;1-rnd&#40;2&#41;&#41;&#41;"

 A3="&#40;Num-1&#41; * pos&#40;sign&#40;1-rnd&#40;2&#41;&#41;&#41;"	// random '0' or 'Num-1' &#40;discrete&#41;
 A4="&#40;&#40;PI/4&#41; * rnd&#40;4&#41;&#41;+&#40;PI/8&#41;"
 A5="2*PI"

 A6="NUM_S_STEPS"
 A7="12"			// divisions
 A8="A6/A7"			// Steps/division
 A9="A6/4"			// 3,12,9,6

 A10="-.5 * A5"
 A11="&#40;.2-rnd&#40;.4&#41;&#41;"
 A12="rnd&#40;7&#41;"
 A13="4+rnd&#40;1.5&#41;"


 C0="&#40;A5 * s&#41; + A10"
 C1="round&#40;A6 * s&#41;"		// sample id, &#40;1, NUM_SAMPLE_BIN&#41;
 C2="&#40;&#40;C1 % A8&#41; == 0&#41;"
 C3="&#40;&#40;C1 % A9&#41; == 0&#41;"


 B0="abs&#40;A3-ID&#41;"
 B1="srand&#40; &#40;&#40;&#40;A5/NUM&#41; + A11&#41;* B0&#41; + &#40;A5/8 * A12&#41;&#41; + &#40;t/8&#41;"

 B2="max&#40;t-&#40;A0-&#40;B0*A13&#41;&#41;, 0&#41;"
 B3="&#40;&#40;-1 ^ ID&#41; * cos&#40; B1 &#41;&#41;/A2"
 B4="&#40;&#40;-1 ^ ID&#41; * sin&#40; B1 &#41;&#41;/A2"
 
// B6=size, B7=posX, B8=posY &#40;Original Code by David Tryse&#41;
//
 B5="dt * &#40;B2/&#40;A1-B0*A13&#41;/&#40;1.2-rnd&#40;.2&#41;&#41;&#41;"		// time elapsed&#58;0-1
 B6="0.3*B5+50*clip&#40;0.02*0.01*&#40;3*B5&#41;^12&#41;"		// Size
 B7="&#40;-1^B0&#41; * &#40;&#40;&#40;3.5+rnd&#40;1&#41;&#41; * sin&#40;B5&#41;/&#40;1.5+rnd&#40;.5&#41;&#41; + &#40;B3/.6&#41; - B6&#41;&#41;"	//  x
 B8="&#40;sin&#40;B5*&#40;4+rnd&#40;.5&#41;&#41;&#41;/&#40;1.5+rnd&#40;.5&#41;&#41; + B4 - B6&#41;"			//  y
 
C4="B6 * &#40;1-&#40;.08 * &#40;C2+C3&#41;&#41;&#41;"

X0="B7 + C4 * cos&#40; C0 &#41;"
Y0="B8 + C4 * sin&#40; C0 &#41;"

// Clock Face &#40;Hand Resource Optimized 21Apr2017&#41;
//
A16="2*Pi * 1.5 * 12"	// &#40;00-12&#41;&#58;00 Start
A14=".7 * clamp&#40;1-&#40;2*s&#41;&#41;"
A15=".7 * clamp&#40;&#40;2*s&#41;-1&#41; * .7"
A17="transpose&#40;&#123; 1
              , 1/12&#125;&#41;/1.5"
B9="A17*&#40;t+rnd&#40;A16&#41;&#41;"

C5="C4 * &#40; A14 * &#123; vector&#40; Num_S_Steps, sin&#40;row&#40;B9,0&#41;&#41;&#41;
                         , vector&#40;Num_S_Steps, cos&#40;row&#40;B9,0&#41;&#41;&#41;
                 &#125;
         + A15 * &#123; vector&#40; Num_S_Steps, sin&#40;row&#40;B9,1&#41;&#41;&#41;
                         , vector&#40;Num_S_Steps, cos&#40;row&#40;B9,1&#41;&#41;&#41;
                 &#125; &#41;"

X1="B7 + row&#40;C5, 0&#41;"
Y1="B8 + row&#40;C5, 1&#41;"


B10="&#40;B6 <= 7&#41;*&#40;40*&#40;B5+0.2&#41;^8 + .5&#41;"
LWdt="B10"

Pen="1"

// Meta="reactive=1 detail=4 density=4"
Vers=391


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

Post by BTT »

Hello jerohm

Thanks for sharing another great Particle, been a long time since your last config.
.
Regards BTT

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

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

Re: Writing (or coding) waveshapes

Post by jerohm »

The version of Slither that was ultimately distributed, bears little resemblance to my original work. I modified my original and replaced lines(CONB=1), with Dots(CONB=0).

Code: Select all

// Slither - jrm
//   10Sept2015 rewrite(um, reorganized - Optimized???)
//   10Dec2021 changed lines(ConB == 1) to dots(ConB == 0)

Aspc=1 
ConB=0
Stps=28
Ys=24
Num="Ys*choice({1,2})"

A0="Num-Ys"		// 0 or Pos
A1="(end_time < 1e30)"  // (Particle == true); [ O'Mearagic ;0) ]

A2="choice({0,1})"
A3="choice({0,(A0>0)})"

A4="vectorLR(Num, 0, Num-1)"	// Id Offsets

A5="{     (A4 % Ys)/(Ys/4) -2

    ,     (A1||(A4>=A0))

    ,     select((A1||(A4<A0)), 1.365
                              , select(A3, 0, 1))  
    ,    !(A1||(A4<A0))
    ,    !(A1||(A4<A0))/2
    , 1 - (A1||(A4<A0))/4

    ,     (A1||(A2*(A4<A0)))

    }"				// ASSuming fetch, i.e. row(), is ALWAY(?) more efficient

A6="1.2/2"			// time weight, (0 - OFF)

B0="col(A5, Id)" 

B1="A6*t + row(B0,4)"
B2="B1   + row(B0,0)"
B3="B2   - B1/2"

A7="(1/(Num_S_Steps-1))"
A8="select( abs(round(s)-s) >= 2*A7, s, round(s))"
A9="((2*A8-1)/1.4)"
A10="{ A9
     , A9 ^ choice({1,3,1}) }"

B4="max(row(B0,2) * (X_Extents/Y_Extents), 1)"
B5="B4 * cos(B2)"

B6="row(A10,row(B0,1)) * (B4 * sin(B2) * cos(B3) - B5 * sin(B3))
    + row(B0,0)"     // z'

A11="trwv(2 * s)"
A12="choice({7,8,9})"
A13="select(((s<A7)||(s>=(1-A7))), A12, 1.8)"

B7="max( A12*max(fft(1-A11), fft(A11)), A13)"

Pen=" row(B0,5)"
Lwdt="row({ B7
         , 1.8}, row(B0,6))"

X0="A9*B5"
Y0="B6 + row(B0,3)"

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

12Jan2022
This is the original submission. It has to exist as a separate 'text file', because ConB can not be set with an expression (why???)

Code: Select all

// Slither - jrm
//   10Sept2015 rewrite(um, reorganized - Optimized???)

Aspc=1 
ConB=1
Stps=140
Ys=24
Num="Ys*choice({1, 2})"

A0="Num-Ys"		// 0 or Pos
A1="(end_time < 1e30)"  // (Particle == true); [ O'Mearagic ;0) ]

A2="choice({0,1})"
A3="choice({0,(A0>0)})"

A4="vectorLR(Num, 0, Num-1)"	// Id Offsets

A5="{ (A4 % Ys)/(Ys/4) -2

    ,     (A1||(A4>=A0))

    ,     select((A1||(A4<A0)), 1.365
                              , select(A3, 0, 1))  
    ,    !(A1||(A4<A0))
    ,    !(A1||(A4<A0))/2
    , 1 - (A1||(A4<A0))/128

    ,     (A1||(A2*(A4<A0)))

    }"				// ASSuming fetch, i.e. row(), is ALWAY more efficient

A6="1.2/2"			// time weight, (0 - OFF)

B0="col(A5, Id)" 

B1="A6*t + row(B0,4)"
B2="B1   + row(B0,0)"
B3="B2   - B1/2"

A7="(1/(Num_S_Steps-1))"
A8="select( abs(round(s)-s) >= 2*A7, s, round(s))"
A9="((2*A8-1)/1.4)"
A10="{ A9
     , A9 ^ choice({1,3,1}) }"

A11="clamp(2*sin(s*Pi)-.07)/7"
A12="s*20"

B4="max(row(B0,2) * (X_Extents/Y_Extents), 1)"
B5="B4 * cos(B2)"

B6="row(A10,row(B0,1)) * (B4 * sin(B2) * cos(B3) - B5 * sin(B3))
    + row(B0,0)"     // z'

X0="A9*B5"
Y0="B6 + row(B0,3) * A11*mag(A12)"		//  + (Id/Num) 

A13="{ select(((s<A7)||(s>=(1-A7))), choice({7,8,9}), 1)
     , vector(Num_S_Steps, .8)
     }"

Lwdt="row(A13, row(B0,6))"
Pen=" row(B0,5)"

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


Do with it what you will.
j

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

Re: Writing (or coding) waveshapes

Post by jerohm »

Code: Select all

// fft w/ single(x/y) - jrm (written @60fps)
//
ConB=0
Aspc=0

Bnds=16
ColW=512
BndW=200
Stps="Bnds*ColW"

A0="(Num_S_Steps -1)"
A1="1/A0"

A2="A0*s"		// Needs more thought!
A3="(ColW-BndW)/2"
A4=""

A5="vectorLR(Bnds, 0, 1)"
A6="pos(s-A1)"		// A6="vectorLR(A0+1, 0, (1-A1))"

B0="B0+1"
B1="select(B0%2, B1, map1d(fft(A5), A6, 0))"

B2="(1 - log10(1+BASS)/3)"

X0="(2*A6 -1)  *.98"
Y0="(2*B1 -B2)"
Lwdt="8"

Vers=530

I had a heck of a time trying to post this CODE segment. I got Server Errors that were dependent on the code content?!?!!... I eliminated A4 (not used anyway) and that seemed to allow posting, but the issue is far more insidious. I still have no idea what is going on.

Enjoy, or ignore.

User avatar
ShohS
Posts: 43
Joined: Fri Apr 06, 2018 11:46 am
Location: no one must know shhhh

Re: Writing (or coding) waveshapes

Post by ShohS »

My new waveshape:

Code: Select all

//Bloom Battle by ShohS 
Aspc=1 

stps="301"

NUM = "5"

A0="2+round(rnd(4))" 
A1="2*round(1+rnd(8))" 

A2="( 1 + rnd( .15 ) )"
A3="rnd(2 * pi)"


B0="cos( PI * ( s - .5 ) )"
B1="t * -A2 + A3 + 2 * pi * ID / NUM"
B2="sin( t*.6 )*.75+.25"
B3="sin( t*.6 +3 )*.75+.25"
B4="-t*.4"
B5="-t*.5"

C0=".3 + B2 * ((fft(s)*B0*.25)+ (bass*B0*.1) + (s*min(.2 , bass))) - (B0*.2) - (s*.2)" 
C1="(s * pi*2)" 


C2="C0 * sin(C1)" 
C3="C0 * cos(C1)*.7-.21" 

C4=".3 + B3 * ((fft(s)*B0*.25)+ (bass*B0*.1) + (s*min(.2 , bass))) - (B0*.2) - (s*.2)" 


C5="C4 * sin(C1)" 
C6="C4 * cos(C1)*.7-.21" 

C7="mag(s) * .2  * sin(8*pi*s)*B2" 
C8="mag(s) * .2  * cos(8*pi*s)*B2" 

C9="mag(s) * .2 * sin(8*pi*s)*B3" 
C10="mag(s) * .2 * cos(8*pi*s)*B3"


X0="(C2 * cos( B1 ) - C3 * sin( B1 ))+sin(B4)*.3-cos(B5)*.2"
Y0="(C2 * sin( B1 ) + C3 * cos( B1 ))+cos(B4)*.3-sin(B5)*.2"

X1="-(C5 * cos( B1 ) - C6 * sin( B1 ))-sin(B4)*.3+cos(B5)*.2"
Y1="-(C5 * sin( B1 ) + C6 * cos( B1 ))-cos(B4)*.3+sin(B5)*.2"

X2="(C7 * cos( B1 ) - C8 * sin( B1 ))+sin(B4)*.3-cos(B5)*.2"
Y2="(C7 * sin( B1 ) + C8 * cos( B1 ))+cos(B4)*.3-sin(B5)*.2"

X3="-(C9 * cos( B1 ) - C10 * sin( B1 ))-sin(B4)*.3+cos(B5)*.2"
Y3="-(C9 * sin( B1 ) + C10 * cos( B1 ))-cos(B4)*.3+sin(B5)*.2"

ConB=0 


LWdt="B0 * 5-(fft(s)*B0*2)-bass*B0*.7" 

Vers=540 
Don't mind the poor writing. My config writing skills have been reset because it's been so long since I made another one.
Nut

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

Re: Writing (or coding) waveshapes

Post by jerohm »

Step sine was written and submitted as a PARTICLE. It was modified by SS and released as a waveshape .
This is my original work; it represents some of my first attempts to code using the VectorC paradigm.

Code: Select all

/*  'A' Step Sine (PARTICLE)
	2010Sep05	JRM	Creation
	2011Jul30	JRM	reWrite (1-3 Invocations)
	2011Aug05	JRM	(VectorC) Proof of concept edit
*/
Aspc=0
ConB=1
Stps=1024
Num="1 + trunc(rnd(3-.001))"

A0="(2*s-1)"

// Randomness SEEMS to work better THIS way, rather than 'srand()' & 'Bvars'
//  (and should be more efficient anyway...)

//
// Wouldn't it be WONDERFUL if this notation could have been SIMPLIFIED!!
//  [i.e., if 'choice(vector(Num, {1,2,4}))' worked like 'rnd(vector(Num, 1))'  ]
//

A1="map1d({1,2,4},        trunc(rnd(vector(Num, 3-.001)))/2, 0)"	// 1/Period
A2="map1d({16,32,64,128}, trunc(rnd(vector(Num, 4-.001)))/3, 0)"	// Steps
A3="map1d({-1,1},         round(rnd(vector(Num, 1))), 0)
     * (1 - 4*rnd(vector(Num, 1))/A2)"					// Direction/Speed

A4="A1 * Num_S_Steps"
A5="1/Num_S_Steps"							// Slide[T] - Always
A6="map1D({-1,1},         round(rnd(vector(Num, 1))), 0)
      * A4"								// Slide[L:R]

A7="(A2/A1) * 1.5"							// Slide speed
A8="(A2/A1) * A5 * 2*Pi"						//   AKA, "(A2/A4) * 2*Pi"

A9="map1D({0,1},          round(rnd(vector(Num, 1))), 0)
      * (A2>=64)"							// Mag() Overlay - 64/128 Only

A10="(1-(A9/20))"
A11="(127-(vectorLR(Num, 0, (Num-1))))/128"
A12="75*s"

// Equation to be plotted...

B0="A5 * abs(col(A6, Id)-((col(A7, Id)*t + Id) % col(A4, Id)))"
B1="col(A8, Id) * trunc(((s + B0)*Num_S_Steps)/col(A2, Id)) + Id"

X0="A0"
Y0="col(A10, Id) * sin(B1 + (col(A3, Id) * t)) + col(A9, Id) * mag(A12)/8"

LWdt=".8"
Pen="col(A11, Id)"							// "(127-(Id*2))/128"
// Meta="reactive=1 detail=3 density=3"

Vers=400

:?

User avatar
juxtiphi
Moderator
Posts: 1437
Joined: Sat Jan 15, 2005 1:29 pm

Re: Writing (or coding) waveshapes

Post by juxtiphi »

Cool Beans!!! You've given some life to the forum!!

Post Reply