Skip to main content

Custom Functions with GSB

· 2 min read
Ray S.
Systems Engineer
Custom Functions with GSB

What is GSB?

GSB (GoSuraj-Strudel Bakery) is a library utility for quickly adding custom functions to the Strudel Live Coding environment.

Think of it as quick alternative to pre-baking code into your Live Coding environment (of course, you can always include the createGsb function in your pre-bake code).

It acts like a "bakery".

You set it up. Add your custom functions, and GSB "bakes" them into the Strudel language so you can use them like any other part of the language.

Video

This recording shows how to Live Code custom functions to create a drum beat in #Strudel GSB (GoSuraj-Strudel Bakery)

#strudel #livecoding #algorave #drumbeat #tutorial #howto #gosuraj

Socials

Sources: Song: Made Up by GoSuraj Library: GSB by GoSuraj Strudel theme: gosurajBtw (unofficial port) VFX: Laset VFX by GoSuraj

Why Use GSB?

GSB was created to speed up Live Coding.

It lets you create aliases and add functions to the Strudel language.

Usage

/**
* GoSuraj-Strudel Bakery (GSB)
*
* Add custom functions and GSB will bake them into Strudel.
*
* GSB makes the functions available on all patterns. For example, a custom gain function like `pattern.$g(1)`.
*
* GSB is a quick alternative to pre-baking as GSB functions become part of the language and it all happens right here.
*/
function createGsb(doh={}) { // Welcome to the "bakery"
Object.entries({
// This stuff "pre-heats" the "oven"
g: (x, p) => p.gain(x),
// ...
...doh,
}).forEach(([n, f]) => register('$' + n, f))
}

// This "starts" the oven
createGsb({
// Add your "treats" here
// Here's a custom delay function:
d: (x, p) => p.delay(x),
// That's an example, you can "season" it to taste later
})

$:s("bd").$d(1)

Comments

Community Rules
This is a community. Please be constructive and polite in your comments and interactions. No toxic negativity.
Comments use GitHub via giscus. By interacting with comments, you consent to GitHub's data processing. See our Privacy Policy for more information.