patterncommands

package
v1.6.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2025 License: GPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Commands = map[string]Command{
	"reverse":  Reverse,
	"euclid":   Euclid,
	"merge":    Merge,
	"rabbit":   Rabbit,
	"mirror":   Mirror,
	"negative": Negative,
	"slice":    Slice,
	"from":     From,
	"until":    Until,
}

Functions

func Euclid added in v1.0.1

func Euclid(params []string, helper Helper) (res []*items.Event, err error)

$euclid(numTotal,numExposed,duration) generates a pattern of numTotal placeholders, where numExposed placeholders are #2 and the others #1. The distance between each placeholder is duration (in fraction of 4 beats, e.g. 0.25 would be a beat

func From added in v1.0.30

func From(params []string, helper Helper) (res []*items.Event, err error)

$from(=patt1,from) returns the tail of a pattern, starting at from

func Merge added in v1.0.1

func Merge(params []string, helper Helper) (res []*items.Event, err error)

$merge(=patt1,=patt2,...) merges the given patterns

func Mirror added in v1.0.1

func Mirror(params []string, helper Helper) (res []*items.Event, err error)

$mirror(=patt,zeroNote) mirrors the given pattern at zeroNote axis

func Negative added in v1.0.1

func Negative(params []string, helper Helper) (res []*items.Event, err error)

negative harmony This concept is derived, from the Theory of Harmony by Swiss composer Ernst Levy (1895 – 1981). $negative(=patt,mirrorNote)

func Rabbit added in v1.0.1

func Rabbit(params []string, helper Helper) (res []*items.Event, err error)

$rabbit(=patt,startNote,factor,percentage,num) by the formula x(n+1) = x(0)*factor * (1-p) where p is the percentage as decimal e.g. $rabbit(=patt,c#',2.5,80%,10) rabbit generates num notes starting by startNote growing by factor, limited by percentage simulating a rabbit population growth. The generated notes are passed to patt as parameters maybe it should be changed to generate a chord of number items that would than be passed as parameter to a pattern, e.g. =patt($rabbit(c#',2.5,80%,10)...)

func Reverse added in v1.0.1

func Reverse(params []string, helper Helper) (res []*items.Event, err error)

$revers(=patt) reverses the events in the given pattern

func Slice added in v1.0.30

func Slice(params []string, helper Helper) (res []*items.Event, err error)

$slice(=patt1,from,to) slices the given pattern

func Until added in v1.0.30

func Until(params []string, helper Helper) (res []*items.Event, err error)

$until(=patt1,to) returns the head of a pattern until to position

Types

type Command

type Command func(params []string, helper Helper) ([]*items.Event, error)

Command is a command that receives different arguments (there might be pattern names within) and returns events we provide different functions to the PatternCMD

type Helper

type Helper interface {
	GetCallEvents(endPos uint, callDef string, params ...string) ([]*items.Event, error)
	GetPipeEvents() ([]*items.Event, error)
	GetSketchDefEvents(sketchDef [][2]string) ([]*items.Event, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL