Skip to content
LEDGloves Docs

Main Algorithm Pattern Generator

Name: ALGORITHM

The Main Pattern Generator a pattern generator with unique features. It is used to generate procedural patterns from a few simple paramaters. Many different styles of patterns can be created by changing certain paramaters. This pattern generator is flexiable enough to emulate most other chips patterns, as long as they are not motion-reactive. Use the studio or the tutorial below to create presets for your devices.

https://studio.ledgloves.com
Main Algorithm Editor View 1

Edit normal paramaters with sliders, or add and edit color paramaters with color pickers, or by using a color preset. For chips that have multiple pixels, a set of parameters will be available for each pixel.

Example Preset with Editor: blellow.txt preset for Blellow.

ALGORITHM,
	ONTIME2=33,
	OFFTIME2=110,
	LBM1=42, ; Last Blank Mod for ROW 1
	R1COLOR1=#0000FF, ; πŸ’™
	R1COLOR2=#FFFF00, ; πŸ’›
	R2COLOR1=#FFFF00, ; πŸ’›

Single-LED Chips vs Multi-LED Chips

For example, the Synergy chips have 2 LEDs, so there are 2 sets of parameters. The first set of parameters is for the bulb, and the second set of parameters is for the second LED on top. For chips that have only one LED, only the first set of parameters will be used, etc, and the others will be ignored.

https://studio.ledgloves.com
in Algorithm Editor View 2

Want to configure a preset file yourself?

TL;DR: Use the LEDGloves Studio to create presets for your devices. Follow on below if you want to craft your own presets text files from scratch.

The Main Pattern Generator has many options to configure. This can get compliated when also adding in each LED has its own set of parameters. To help with this, the Main Pattern Generator has a some standard parameter names to help keep things organized.

For example seeing something like ONTIME1 and ONTIME2 is for LED 1 and LED 2, respectively. This is the same for all parameters.

Color paramaters are slightly different. The first number is the LED number, and the second number is the color number. This is the same for all color parameters. So, R1COLOR1 is the first color for LED 1, and R2COLOR2 is the second color for LED 2. This is the same for all color parameters. If you assign a color or row that is beyond what a device has, it will be ignored. The color values are in HTML Color Code format, which is a # followed by a 6-digit color code.

The current maximum number of colors is 10, and the current maximum number of rows is 2. If you assign a color or row that is beyond what a device has, it will be ignored.


Parameters List

The paramaters for this pattern generator are listed below. The paramaters are grouped by row. The first row is the front LED on multi-LED chips, and the second row is the top LED on multi-LED chips. For single-LED chips, only the first row is used.

Row 1 Parameters List (Front LED on Multi-LED Chips)

ParameterTypeDescriptionMinMaxDefault
ONTIME1NumberOn Duration for R1 Colors.125010
OFFTIME1NumberOff Duration for R1 Colors.025010
OFFCOLOR1ColorOff/ Idle Color <X> data for R1.
RGB(0, 0, 0)       #000000
RGB(255, 255, 255)       #FFFFFF
RGB(0, 0, 0)       #000000
NUMCOLORS1NumberNumber of colors for R1.1101
R1COLOR<X>ColorColor <X> data for R1.
RGB(0, 0, 0)       #000000
RGB(255, 255, 255)       #FFFFFF
RGB(0, 0, 0)       #000000
FCM1NumberFirst Color Time Mod for R1.02550Β (Disable)
LBM1NumberLast Blank Mod for R1.02550Β (Disable)
KANDI1NumberKandi Mod for R1.02550Β (Disable)

Row 2 Parameters List (Top LED on Multi-LED Chips)

ParameterTypeDescriptionMinMaxDefault
ONTIME2NumberOn Duration for R2 Colors.125010
OFFTIME2NumberOff Duration for R2 Colors.025010
OFFCOLOR2ColorOff/ Idle Color <X> data for R2.
RGB(0, 0, 0)       #000000
RGB(255, 255, 255)       #FFFFFF
RGB(0, 0, 0)       #000000
NUMCOLORS2NumberNumber of colors for R2.1101
R2COLOR<X>ColorColor <X> data for R2.
RGB(0, 0, 0)       #000000
RGB(255, 255, 255)       #FFFFFF
RGB(0, 0, 0)       #000000
FCM2NumberFirst Color Time Mod for R2.02550Β (Disable)
LBM2NumberLast Blank Mod for R2.02550Β (Disable)
KANDI2NumberKandi Mod for R2.02550Β (Disable)

Row 1 Parameters (Front LED on Multi-LED Chips)

ALGORITHM: ONTIME1

Parameter Name: ONTIME1
TypeMinMaxDefaultDescription
Number125010Color On Duration for R1 Colors.

ONTIME1 is the duration of time in milliseconds that the color will be on for. This is the first row of colors for multi-LED chips, and the only row of colors for single-LED chips.

ALGORITHM: OFFTIME1

Parameter Name: OFFTIME1
TypeMinMaxDefaultDescription
Number025010Color Off Duration for R1 Colors.

OFFTIME1 is the duration of time in milliseconds that the color will be off for. This is the first row of colors for multi-LED chips, and the only row of colors for single-LED chips.

ALGORITHM: FCM1

Parameter Name: FCM1
TypeMinMaxDefaultDescription
Number02550First Color Time Mod for R1 Color 1

FCM1 is the first color time mod for the first row of colors. A value of 0 will disable this feature. Values from 1-255 will override the ONTIME for the first color in the sequence.

ALGORITHM: LBM1

Parameter Name: LBM1
TypeMinMaxDefaultDescription
Number02550Last Blank Mod for R1 Colors.

LBM1 is the last blank mod for the first row of colors. A value of 0 will disable this feature. Values from 1-255 will override the OFFTIME for the last color in the sequence. This allows for long or shorter pauses when looping around to the first color in the pattern.

ALGORITHM: KANDI1

Parameter Name: KANDI1
TypeMinMaxDefaultDescription
Number02550Kandi Mod for R1 Colors

KANDI1 is the kandi mod for the first row of colors. A value of 0 will disable this feature. Values from 1-255 apply the KANDI effect to the first row of colors.

KANDI cycles through the colors in the pattern, and shuffles between them based on the value of KANDI. For example, if you have three colors, ColorA, ColorB, and ColorC, KANDI will dither or stutter between two colors by the set value before moving on to the next pair of colors to cycle between.

If KANDI is set to three, then the color cycle becomes A -> B -> A -> B -> A -> B, (Change) B -> C -> B -> C -> B -> C, (Change)... etc

ALGORITHM: OFFCOLOR1

Parameter Name: OFFCOLOR1
TypeMinMaxDefaultDescription
Color
RGB(0, 0, 0)       #000000
RGB(255, 255, 255)       #FFFFFF
RGB(0, 0, 0)       #000000
Off/ Idle Color data for R1.

OFFCOLOR1 is the off/ idle color for the first row of colors. This is the color that will be displayed when the pattern is not running. This is the first row of colors for multi-LED chips, and the only row of colors for single-LED chips.

ALGORITHM: NUMCOLORS1

Parameter Name: NUMCOLORS1
TypeMinMaxDefaultDescription
Number1101Number of colors for R1 Color

NUMCOLORS1 is the number of colors for the first row of colors.

ALGORITHM: R1COLOR<X>

Parameter Name: R1COLOR<X>
TypeMinMaxDefaultDescription
Color
RGB(0, 0, 0)       #000000
RGB(255, 255, 255)       #FFFFFF
RGB(0, 0, 0)       #000000
Color<X> data for R1

R1COLOR<X> is the color <X> data for that color in that row. There are 10 colors available for each row. Only the colors up to and including NUMCOLORS1 will be used.


Row 2 Parameters (Top LED on Multi-LED Chips)

These are ignored by Single-LED chips.

ALGORITHM: ONTIME2

Parameter Name: ONTIME2
TypeMinMaxDefaultDescription
Number125010Color On Duration for R2 Colors.

ONTIME2 is the duration of time in milliseconds that the color will be on for. This is the second row of colors for multi-LED chips, and is ignored for single-LED chips.

ALGORITHM: OFFTIME2

Parameter Name: OFFTIME2
TypeMinMaxDefaultDescription
Number025010Color Off Duration for R2 Colors.

OFFTIME2 is the duration of time in milliseconds that the color will be off for. This is the second row of colors for multi-LED chips, and is ignored for single-LED chips.

ALGORITHM: FCM2

Parameter Name: FCM2
TypeMinMaxDefaultDescription
Number02550First Color Time Mod for R2 Color 1

FCM2 is the first color time mod for the second row of colors. A value of 0 will disable this feature. Values from 1-255 will override the ONTIME for the first color in the sequence.

ALGORITHM: LBM2

Parameter Name: LBM2
TypeMinMaxDefaultDescription
Number02550Last Blank Mod for R2 Colors.

LBM2 is the last blank mod for the second row of colors. A value of 0 will disable this feature. Values from 1-255 will override the OFFTIME for the last color in the sequence. This allows for long or shorter pauses when looping around to the first color in the pattern.

ALGORITHM: KANDI2

Parameter Name: KANDI2
TypeMinMaxDefaultDescription
Number02550Kandi Mod for R2 Colors

KANDI2 is the kandi mod for the second row of colors. A value of 0 will disable this feature. Values from 1-255 apply the KANDI effect to the second row of colors.

KANDI cycles through the colors in the pattern, and shuffles between them based on the value of KANDI. For example, if you have three colors, ColorA, ColorB, and ColorC, KANDI will dither or stutter between two colors by the set value before moving on to the next pair of colors to cycle between.

If KANDI is set to three, then the color cycle becomes A -> B -> A -> B -> A -> B, (Change) B -> C -> B -> C -> B -> C, (Change)... etc

ALGORITHM: OFFCOLOR2

Parameter Name: OFFCOLOR2
TypeMinMaxDefaultDescription
Color
RGB(0, 0, 0)       #000000
RGB(255, 255, 255)       #FFFFFF
RGB(0, 0, 0)       #000000
Off/ Idle Color data for R2.

OFFCOLOR2 is the off/ idle color for the second row of colors. This is the color that will be displayed when the pattern is not running. This is the second row of colors for multi-LED chips, and is ignored for single-LED chips.

ALGORITHM: NUMCOLORS2

Parameter Name: NUMCOLORS2
TypeMinMaxDefaultDescription
Number1101Number of colors for R2 Color

NUMCOLORS2 is the number of colors for the second row of colors. The max number of colors is 10.

ALGORITHM: R2COLOR<X>

Parameter Name: R2COLOR<X>
TypeMinMaxDefaultDescription
Color
RGB(0, 0, 0)       #000000
RGB(255, 255, 255)       #FFFFFF
RGB(0, 0, 0)       #000000
Color <X> data for R2

R2COLOR<X> is the color <X> data for that color in that row. There are 10 colors available for each row. Only the colors up to and including NUMCOLORS2 will be used.


Preset File Examples

Here are some examples for manually creating a Color Sine Preset text file. You can also use the LEDGloves Studio Flashing Pattern Generator to create and save presets automatically. These examples could be saved to a text file like patterns/<preset_name>.txt.

Example 1 - Basic Example - Blellow Preset

This example results in a moody palette of colors that alternate due to the KANDI effect. The extra text after the ; characters are known as commants and aren’t used to change the pattern. You can add them, but to keep file sizes small, they should be avoided.

Example Preset with Editor: the blellow.txt preset for Blellow.

ALGORITHM,
	ONTIME2=33,
	OFFTIME2=110,
	R1COLOR1=#0000FF, ; πŸ’™
	R1COLOR2=#FFFF00, ; πŸ’›
	R2COLOR1=#FFFF00, ; πŸ’›
	LBM1=42,

The starting phrase ALGORITHM, tells the pattern generator that this is a Main Pattern Generator preset. The next lines are the parameters for the pattern. They can be on new lines or on the same line. Just make sure to add a comma , after each parameter.

Here, we change LBM1 or, the Last Blank modifer for row one to 42. This will result in a longer pause between the last color and the first color in the loop. We also change the ONTIME2 and OFFTIME2 to 33 and 110, respectively.

Example 2 - Moderate Example - Nihon Preset

This example results in a moody palette of colors that alternate due to the KANDI effect. The extra text after the ; characters are known as commants and aren’t used to change the pattern. You can add them, but to keep file sizes small, they should be avoided.

Example Preset with Editor: the nihon.txt preset for Nihon.

ALGORITHM,
	ONTIME2=5,
	OFFTIME2=2,
	NUMCOLORS1=2,
	FCM1=18,
	LBM1=50,
	R2OFFCOLOR=#080000,
	R1COLOR1=#FFFFFF,
	R1COLOR2=#FF0000,
	R2COLOR1=#111111,

In this case, a lot of the paramaters are left to their defaults. The ONTIME2 and OFFTIME2 are set to 5 and 2, respectively. This results in a pattern that is very fast and responsive. Other modifier paramaters like FCM1 and LBM1 are also set to 18 and 50, respectively. This changes the timings of the first color in the sequence and the last color in the sequence. This results in a longer pause between the last color and the first color in the loop.

Example 3 - Basic Example - Trans Flag Preset

This example results in a moody palette of colors that alternate due to the KANDI effect. The extra text after the ; characters are known as commants and aren’t used to change the pattern. You can add them, but to keep file sizes small, they should be avoided.

Example Preset with Editor: the trans_flag.txt preset for Trans Flag.

ALGORITHM,
	ONTIME1=1,
	OFFTIME1=3,
	OFFTIME2=82,
	NUMCOLORS1=5,
	NUMCOLORS2=2,
	LBM1=74,
	R1COLOR1=#3BB3B3, ; πŸ’™
	R1COLOR2=#FF00BF, ; πŸ’œ
	R1COLOR3=#B4B4B4, ; 🀍
	R1COLOR4=#FF00BF, ; πŸ’œ
	R1COLOR5=#3BB3B3, ; πŸ’™
	R2COLOR1=#3BB395, ; πŸ’™
	R2COLOR2=#FF00BF, ; πŸ’œ

This preset uses a lot of colors to create a specific sequence. Here, LBM1 is used to create a long pause after the colors, to give the effect of a continuous block of colors followed by a pause.

Example 4 - Advanced Example - Starry Night Preset

This example results in a moody palette of colors that alternate due to the KANDI effect. The extra text after the ; characters are known as commants and aren’t used to change the pattern. You can add them, but to keep file sizes small, they should be avoided.

Example Preset with Editor: the starry_night.txt preset for Starry Night.

ALGORITHM,
	ONTIME2=1,
	OFFTIME1=5,
	OFFTIME2=15,
	NUMCOLORS1=4,
	NUMCOLORS2=3,
	R1COLOR1=#006666, ; πŸ’™
	R1COLOR2=#001A66, ; πŸ’™
	R1COLOR3=#0080FF, ; πŸ’™
	R1COLOR4=#001A66, ; πŸ’™
	R2COLOR1=#FFFFFF, ; 🀍
	R2COLOR2=#FFBF00, ; πŸ’›
	LBM1=60,
	KANDI1=4,
	KANDI2=12,

In this case, a lot of the paramaters are left to their defaults, and we configure parameters like ONTIME2 and OFFTIME1 to be very short. This results in a pattern that is very fast and responsive. The KANDI effect is also enabled for both rows, which results in the colors alternating based on the modifer value.

Example 5 - Advanced Example - Rainbow Tracer Preset

This example results in a moody palette of colors that alternate due to the KANDI effect. The extra text after the ; characters are known as commants and aren’t used to change the pattern. You can add them, but to keep file sizes small, they should be avoided.

Example Preset with Editor: the rainbow_tracer.txt preset for Rainbow Tracer.

ALGORITHM, ONTIME1=7, ONTIME2=25, OFFTIME1=21, OFFTIME2=100, NUMCOLORS1=7, NUMCOLORS2=7,
; Row One colors
R1COLOR1=#FF0000, ; πŸ”΄
R1COLOR2=#FF4000, ; 🟠
R1COLOR3=#FFFF00, ; 🟑
R1COLOR4=#00FF00, ; 🟒
R1COLOR5=#0000FF, ; πŸ”΅
R1COLOR6=#4000FF, ; 🟣
R1COLOR7=#BF00FF, ; 🟣

; Row Two colors
R2COLOR1=#BF00FF, ; πŸ’œ
R2COLOR2=#4000FF, ; πŸ’œ
R2COLOR3=#0000FF, ; πŸ’™
R2COLOR4=#00FF00, ; πŸ’š
R2COLOR5=#FFFF00, ; πŸ’›
R2COLOR6=#FF4000, ; 🧑
R2COLOR7=#FF0000, ; ❀️

; the secret sauce
R1OFFCOLOR=#141414, ; ⚫
KANDI2=3,

This one has a lot of colors. The KANDI effect is also enabled for row two, which results in the colors alternating based on the modifer value.