Csound and CsoundAC API  5.17
Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes
csound::Lindenmayer Class Reference

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>

+ Inheritance diagram for csound::Lindenmayer:

Public Member Functions

virtual void addChild (Node *node)
virtual void addRule (std::string command, std::string replacement)
virtual void clear ()
virtual Eigen::MatrixXd createTransform ()
virtual double & element (size_t row, size_t column)
 Returns a reference to the indicated element of the local transformation of coordinate system.
virtual void generate ()
virtual double getAngle () const
virtual std::string getAxiom () const
virtual int getIterationCount () const
virtual Eigen::MatrixXd getLocalCoordinates () const
 Returns the local transformation of coordinate system.
virtual std::string getReplacement (std::string command)
virtual ScoregetScore ()
 Lindenmayer ()
virtual void produceOrTransform (Score &collectingScore, size_t beginAt, size_t endAt, const Eigen::MatrixXd &coordinates)
 This function is called by the traverse() function.
virtual void setAngle (double angle)
virtual void setAxiom (std::string axiom)
virtual void setElement (size_t row, size_t column, double value)
 Sets the indicated element of the local transformation of coordinate system.
virtual void setIterationCount (int count)
virtual Eigen::MatrixXd traverse (const Eigen::MatrixXd &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.
double duration
 If not 0, the score is rescaled to this duration.
std::string importFilename

Protected Member Functions

virtual Eigen::MatrixXd 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
Eigen::MatrixXd localCoordinates
std::map< std::string,
std::string > 
rules
Score score
Event turtle
Event turtleOrientation
std::stack< EventturtleOrientationStack
std::stack< EventturtleStack
Event turtleStep
std::stack< EventturtleStepStack

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):

The abbreviations for the dimensions are:

  1. i = instrument
  2. t = time
  3. d = duration
  4. k = MIDI key number
  5. v = MIDI velocity number
  6. p = phase
  7. x = pan
  8. y = height
  9. z = depth
  10. 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)
virtualinherited
virtual void csound::Lindenmayer::addRule ( std::string  command,
std::string  replacement 
)
virtual
virtual void csound::Lindenmayer::clear ( )
virtual

Reimplemented from csound::Node.

virtual Eigen::MatrixXd csound::Lindenmayer::createRotation ( int  dimension1,
int  dimension2,
double  angle 
) const
protectedvirtual
virtual Eigen::MatrixXd csound::Node::createTransform ( )
virtualinherited
virtual double& csound::Node::element ( size_t  row,
size_t  column 
)
virtualinherited

Returns a reference to the indicated element of the local transformation of coordinate system.

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
protectedvirtual
virtual int csound::Lindenmayer::getIterationCount ( ) const
virtual
virtual Eigen::MatrixXd csound::Node::getLocalCoordinates ( ) const
virtualinherited

Returns the local transformation of coordinate system.

virtual std::string csound::Lindenmayer::getReplacement ( std::string  command)
virtual
virtual Score& csound::ScoreNode::getScore ( )
virtualinherited
virtual void csound::Lindenmayer::initialize ( )
protectedvirtual
virtual void csound::Lindenmayer::interpret ( std::string  command,
bool  render 
)
protectedvirtual
virtual void csound::ScoreNode::produceOrTransform ( Score collectingScore,
size_t  beginAt,
size_t  endAt,
const Eigen::MatrixXd &  compositeCordinates 
)
virtualinherited

This function is called by the traverse() function.

The default implementation does nothing. If a derived node produces new Events, then it must transform them by the composite coordinates, then append them to the collecting score. If a derived node transforms Events produced by child Nodes, then it must transform only Events in the collecting score starting at the startAt index and continuing up to, but not including, the endAt index. These bookmarks, in turn, must be set in the Traverse function by all Nodes that produce events.

Reimplemented from csound::Node.

Reimplemented in csound::Cell, csound::MCRM, and csound::Rescale.

virtual void csound::Lindenmayer::rewrite ( )
protectedvirtual
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 
)
virtualinherited

Sets the indicated element of the local transformation of coordinate system.

virtual void csound::Lindenmayer::setIterationCount ( int  count)
virtual
virtual Eigen::MatrixXd csound::Node::traverse ( const Eigen::MatrixXd &  globalCoordinates,
Score score 
)
virtualinherited

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::Koch, csound::Stack, csound::Intercut, csound::Hocket, and csound::Sequence.

virtual void csound::Lindenmayer::updateActual ( Event event)
protectedvirtual

Field Documentation

double csound::Lindenmayer::angle
protected
std::string csound::Lindenmayer::axiom
protected
clock_t csound::Lindenmayer::beganAt
protected
std::vector<Node *> csound::Node::children
inherited

Child Nodes, if any.

double csound::ScoreNode::duration
inherited

If not 0, the score is rescaled to this duration.

clock_t csound::Lindenmayer::elapsed
protected
clock_t csound::Lindenmayer::endedAt
protected
std::string csound::ScoreNode::importFilename
inherited
int csound::Lindenmayer::iterationCount
protected
Eigen::MatrixXd csound::Node::localCoordinates
protectedinherited
std::map<std::string, std::string> csound::Lindenmayer::rules
protected
Score csound::ScoreNode::score
protectedinherited
Event csound::Lindenmayer::turtle
protected
Event csound::Lindenmayer::turtleOrientation
protected
std::stack<Event> csound::Lindenmayer::turtleOrientationStack
protected
std::stack<Event> csound::Lindenmayer::turtleStack
protected
Event csound::Lindenmayer::turtleStep
protected
std::stack<Event> csound::Lindenmayer::turtleStepStack
protected