Extending LilyPond: 2.1.1 Music function syntax

### 2.1.1 Music function syntax

The general form for music functions is:

>     function =
>     #(define-music-function
>          (parser location arg1 arg2 …)
>          (type1? type2? …)
>        music)

where

`argN` | nth argument
`typeN?` | a scheme type predicate for which `argN` must return `#t`.
`music` | A music expression, optionally written in scheme, with any LilyPond code enclosed in hashed braces ( `#{…#}` ). Within LilyPond code blocks, use `$` to reference function arguments (eg., ‘`$arg1`’) or to start an inline scheme expression containing function arguments (eg., ‘`$(cons arg1 arg2)`’).

For a list of available type predicates, see Predefined type predicates. User-defined type predicates are also allowed.

#### See also

Notation Reference: Predefined type predicates.

Installed Files: ‘`lily/music-scheme.cc`’, ‘`scm/c++.scm`’, ‘`scm/lily.scm`’.

Other languages: deutsch, español.

#### LilyPond — Extending