This functor defines re-usable musical segments. These segments are defined as sub-CSPs (extended scripts). They implement relatively specific musical ideas (e.g., a contrapuntual line, a specific motif, or a homophonic chord progression), but they support a number of arguments in order to make them flexible enough that they are interesting for re-use.
Unfortunately, the documentation for many of the definitions here are not automatically extracted in the the HTML reference. Please check the source at ../Segments.oz for the documentation of these definitions.
Functor
Import
- FD
- FS
- Browser(browse:Browse)
- GUtils at "x-ozlib://anders/strasheela/source/GeneralUtils.ozf"
- LUtils at "x-ozlib://anders/strasheela/source/ListUtils.ozf"
- MUtils at "x-ozlib://anders/strasheela/source/MusicUtils.ozf"
- Score at "x-ozlib://anders/strasheela/source/ScoreCore.ozf"
- Pattern at "x-ozlib://anders/strasheela/Pattern/Pattern.ozf"
- HS at "x-ozlib://anders/strasheela/HarmonisedScore/HarmonisedScore.ozf"
- Fenv at "x-ozlib://anders/strasheela/Fenv/Fenv.ozf"
- HCP at "source/HomophonicChordProgression.ozf"
Export
Define
fun{GetNoteIndex N}
Expects a note with index parameter and returns the index variable value.
fun{MakeParametersAccessor Accessor}
Returns accessor function expecting a list of items (notes) and returning list of variables returned by Accessor (unary function or method). Example
{MakeParametersAccessor getPitch}
fun{PitchContourAccessor Ns}
fun{MakeAkkords_Seq Args}
Same as MakeAkkords, but returns sequential container of akkords.
proc{MakeChordSlicesForm Args MyScore}
Returns extended script for musical section where each segment in the section expresses a single chord.
Args:
'segments' (required): list of textual score specs: each spec which "express" one chord.
'chords' (required): function returning list of chord objects (wrapped in function to protect variables).
'constructors' (required): constructors as expected by Score.make.
further args: handed to top-level sequential.
NB: Each segment must be sim, and sim items are specified at feat 1.
NB: List of segments and list of chords must be of the same length (shorter list of chords causes fail).
Note: this def is rather restricted in generality.. Alternatives are, e.g., HS.score.harmoniseScore.
fun{PatternedPhrase Args}
Generates extended script for creating a phrase consisting of multiple segments, and for applying pattern constraints on these segments. The resulting score topology is as follows, where the segmenents are form segments created by other extended scripts.
seq(segment+)
Args:
'constructors': constructor spec for the top-level sims and seq, format as expected by Score.make. Features should be 'sim' and 'seq'.
'pAccessor' (default GUtils.identity): unary function applied to each segment, returning a value for the argument pattern, e.g, a parameter value (FD int) or a score object (see below).
'pattern' (default proc {$ Xs} skip end): unary procedure expecting/constraining the list of values returned by 'pAccessor' for all segments.
All other top-level arguments are given to the top-level seq.
Args.segments:
tuple of segment specifications, where each segment specifications is a record of the following arguments. (In principle it can be a record, but then the temporal order of segments depends on the order of features in the record)
'constructor': extended script (binary procedure) for creating the layer, commonly created with Score.defSubscript. Should return a score object (not a list of score objects).
All other arguments in Args.segments are given to this constructor.
The arguments of the returned extended script correspond to Args.
proc{PatternedSlices Args MyScore}
Extended script for creating a sequence of polyphonic form segments, resulting score topology, where the segmenents are form segments created by other extended scripts.
seq(sim(segment+)+)
The simultaneous containers can be though of as formal "slices", consisting of layers (the segmenents). Note that all slices are uniform in the sense that each slices consists of the same layers (i.e. the layers of each slices are created with the same constructors). However, depending on the flexibility of these layer constructors (e.g., their set of arguments) corresponding layers can also considerably differ across slices. Also, pattern constraints can be applied conveniently to lists of corresponding layers accross slices.
PatternedSlices can be used, for example, to create the score with the actual notes for a harmonic CSP. For example, each slices could express its own harmony (e.g., sim chord object).
Args:
'n': number of sims in the top-level seq (number of slices).
'constructors': constructor spec for the top-level sims and seq, format as expected by Score.make. Features should be 'sim' and 'seq'.
Args.layer:
record/tuple of layer specifications, where each layer specifications is a record of the following arguments. Each layer specification is used for creating all instances of this layer accross the slices.
iargs.constructor: extended script (binary procedure) for creating the layer, commonly created with Score.defSubscript. Should return a score object (not a list of score objects).
'pAccessor' (default GUtils.identity): unary function applied to each layer instance, returning a value for the argument pattern, e.g, a parameter value (FD int) or a score object (see below).
'pattern' (default proc {$ Xs} skip end): unary procedure expecting/constraining the list of values returned by 'pAccessor' for all instances of the present layer across slices.
In addition, (almost) all other constructor arguments are supported. These constructor arguments are supported in all formats introduced by Score.makeItems, such as each-args. However, it may be necessary to specify composite argument as each-args. For example, in order to specify an "rargs argument", the whole rargs record must be specified as each-args such as
unit(rargs: each # [unit() unit() ...] ...)
NB: arguments expected by Score.makeItems (n, constructor, handle, rule) *cannot* be handed to the layer constructors!
End