KnacK is a music composition framework for the ChucK programming language. It encourages organization of components in a standard way, enabling easier re-use in later projects.
It was originally developed by Colin Sullivan during the Music 220A course at Stanford’s CCRMA.
KnacK is divided into 3 main components:
- Aesthetics (high level data input)
An “Instrument” in KnacK is meant to encapsulate all unit generator functionality, and hide away anything that has to do with raw signal processing. The obvious exception here is if control over a ugen parameter is to be given to the “Performer” of the instrument.
A “Performer” in KnacK is the place where performance code is written, which can be anything from a general Arpeggiator which can play any
Instrument subclass, to a performer of a specific instrument which manipulates specific parameters.
A “Score” in KnacK is a way to handle the high level transitions and events in a piece. A
Score subclass is meant to be instantiated once, and is the entry point for the program.
I have spent some time thinking about event handling, and how this can be used to allow
Instrument instances to react to high-level “aesthetic” data. The idea here is that the composer can have high-level metrics such as “darkness” or “density”, which can be modified in the score directly, and all
Performer classes can react accordingly. I am still in the process of determining the best way to accomplish this using function objects (I am used to functions as first class values), but some code can be found in
Consider the following simple example (can be found in
examples/otf/. We have a
DistortedKick which simply plays the
DistortedKick.aif file when the
playNote method is called:
Then there is a
BoringKickPerformer which instantiates a
DistortedKick, and plays it on each beat.
To combine in a
Movement of a score, we can instantiate this player, and tell it how frequently to play.
Then when an
OtfDemo object is instantiated, and
play is called on it, we will hear our beat play for the duration specified.