This class implements a Lindenmayer system in music space for a turtle that writes either notes into a score, or Jones-Parks grains into a memory soundfile.
More...
#include <Lindenmayer.hpp>
Inherits csound::ScoreNode.
Public Member Functions |
| virtual void | addChild (Node *node) |
| virtual void | addRule (std::string command, std::string replacement) |
| virtual void | clear () |
| virtual ublas::matrix< double > | createTransform () |
| virtual double & | element (size_t row, size_t column) |
| virtual void | generate () |
| virtual double | getAngle () const |
| virtual std::string | getAxiom () const |
| virtual int | getIterationCount () const |
| virtual ublas::matrix< double > | getLocalCoordinates () const |
| | Returns the local transformation of coordinate system.
|
| virtual std::string | getReplacement (std::string command) |
| virtual Score & | getScore () |
| | Lindenmayer () |
| virtual void | produceOrTransform (Score &score, size_t beginAt, size_t endAt, const ublas::matrix< double > &coordinates) |
| | The default implementation does nothing.
|
| virtual void | setAngle (double angle) |
| virtual void | setAxiom (std::string axiom) |
| virtual void | setElement (size_t row, size_t column, double value) |
| virtual void | setIterationCount (int count) |
| virtual ublas::matrix< double > | traverse (const ublas::matrix< double > &globalCoordinates, Score &score) |
| | The default implementation postconcatenates its own local coordinate system with the global coordinates, then passes the score and the product of coordinate systems to each child, thus performing a depth-first traversal of the music graph.
|
| virtual | ~Lindenmayer () |
Data Fields |
| std::vector< Node * > | children |
| | Child Nodes, if any.
|
| std::string | importFilename |
Protected Member Functions |
| virtual ublas::matrix< double > | createRotation (int dimension1, int dimension2, double angle) const |
| virtual int | getDimension (char dimension) const |
| virtual void | initialize () |
| virtual void | interpret (std::string command, bool render) |
| virtual void | rewrite () |
| virtual void | updateActual (Event &event) |
Protected Attributes |
| double | angle |
| std::string | axiom |
| clock_t | beganAt |
| clock_t | elapsed |
| clock_t | endedAt |
| int | iterationCount |
| ublas::matrix< double > | localCoordinates |
std::map< std::string,
std::string > | rules |
| Score | score |
| Event | turtle |
| Event | turtleOrientation |
| std::stack< Event > | turtleOrientationStack |
| std::stack< Event > | turtleStack |
| Event | turtleStep |
| std::stack< Event > | turtleStepStack |
Detailed Description
This class implements a Lindenmayer system in music space for a turtle that writes either notes into a score, or Jones-Parks grains into a memory soundfile.
The Z dimension of note space is used for chirp rate. The actions of the turtle are rescaled to fit the specified bounding hypercube. The turtle commands are represented by letters (all n default to 1):
-
G = Write the current state of the turtle into the soundfile as a grain.
-
Mn = Translate the turtle by adding to its state its step times its orientation times n.
-
Rabn = Rotate the turtle from dimension a to dimension b by angle 2 pi / (angleCount * n)
-
Uan = Vary the turtle state on dimension a by a normalized (-1 through +1) uniformly distributed random variable times n.
-
Gan = Vary the turtle state on dimension a by a normalized (-1 through +1) Gaussian random variable times n.
-
T=an = Assign to dimension a of the turtle state the value n.
-
T*an = Multiply dimension a of the turtle state by n.
-
T/an = Divide dimension a of the turtle state by n.
-
T+an = Add to dimension a of the turtle state the value n.
-
T-an = Subtract from dimension a of the turtle state the value n.
-
S=an = Assign to dimension a of the turtle step the value n.
-
S*an = Multiply dimension a of the turtle step by n.
-
S/an = Divide dimension a of the turtle step by n.
-
S+an = Add to dimension a of the turtle step the value n.
-
S-an = Subtract from dimension a of the turtle step the value n.
-
[ = Push the current state of the turtle state onto a stack.
-
] = Pop the current state of the turtle from the stack.
The abbreviations for the dimensions are:
-
i = instrument
-
t = time
-
d = duration
-
k = MIDI key number
-
v = MIDI velocity number
-
p = phase
-
x = pan
-
y = height
-
z = depth
-
s = pitch-class set as Mason number
Constructor & Destructor Documentation
| csound::Lindenmayer::Lindenmayer |
( |
|
) |
|
| virtual csound::Lindenmayer::~Lindenmayer |
( |
|
) |
[virtual] |
Member Function Documentation
| virtual void csound::Node::addChild |
( |
Node * |
node |
) |
[virtual, inherited] |
| virtual void csound::Lindenmayer::addRule |
( |
std::string |
command, |
|
|
std::string |
replacement | |
|
) |
| | [virtual] |
| virtual void csound::Lindenmayer::clear |
( |
|
) |
[virtual] |
| virtual ublas::matrix<double> csound::Lindenmayer::createRotation |
( |
int |
dimension1, |
|
|
int |
dimension2, |
|
|
double |
angle | |
|
) |
| | const [protected, virtual] |
| virtual ublas::matrix<double> csound::Node::createTransform |
( |
|
) |
[virtual, inherited] |
| virtual double& csound::Node::element |
( |
size_t |
row, |
|
|
size_t |
column | |
|
) |
| | [virtual, inherited] |
| virtual void csound::Lindenmayer::generate |
( |
|
) |
[virtual] |
| virtual double csound::Lindenmayer::getAngle |
( |
|
) |
const [virtual] |
| virtual std::string csound::Lindenmayer::getAxiom |
( |
|
) |
const [virtual] |
| virtual int csound::Lindenmayer::getDimension |
( |
char |
dimension |
) |
const [protected, virtual] |
| virtual int csound::Lindenmayer::getIterationCount |
( |
|
) |
const [virtual] |
| virtual ublas::matrix<double> csound::Node::getLocalCoordinates |
( |
|
) |
const [virtual, inherited] |
Returns the local transformation of coordinate system.
| virtual std::string csound::Lindenmayer::getReplacement |
( |
std::string |
command |
) |
[virtual] |
| virtual Score& csound::ScoreNode::getScore |
( |
|
) |
[virtual, inherited] |
| virtual void csound::Lindenmayer::initialize |
( |
|
) |
[protected, virtual] |
| virtual void csound::Lindenmayer::interpret |
( |
std::string |
command, |
|
|
bool |
render | |
|
) |
| | [protected, virtual] |
| virtual void csound::ScoreNode::produceOrTransform |
( |
Score & |
score, |
|
|
size_t |
beginAt, |
|
|
size_t |
endAt, |
|
|
const ublas::matrix< double > & |
compositeCordinates | |
|
) |
| | [virtual, inherited] |
| virtual void csound::Lindenmayer::rewrite |
( |
|
) |
[protected, virtual] |
| virtual void csound::Lindenmayer::setAngle |
( |
double |
angle |
) |
[virtual] |
| virtual void csound::Lindenmayer::setAxiom |
( |
std::string |
axiom |
) |
[virtual] |
| virtual void csound::Node::setElement |
( |
size_t |
row, |
|
|
size_t |
column, |
|
|
double |
value | |
|
) |
| | [virtual, inherited] |
| virtual void csound::Lindenmayer::setIterationCount |
( |
int |
count |
) |
[virtual] |
| virtual ublas::matrix<double> csound::Node::traverse |
( |
const ublas::matrix< double > & |
globalCoordinates, |
|
|
Score & |
score | |
|
) |
| | [virtual, inherited] |
The default implementation postconcatenates its own local coordinate system with the global coordinates, then passes the score and the product of coordinate systems to each child, thus performing a depth-first traversal of the music graph.
Reimplemented in csound::Hocket, and csound::Sequence.
| virtual void csound::Lindenmayer::updateActual |
( |
Event & |
event |
) |
[protected, virtual] |
Field Documentation