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

A random value will be sampled from the specified distribution, translated and scaled as specified, and set in the specified row and column of the local coordinates. More...

#include <Random.hpp>

+ Inheritance diagram for csound::Random:

Public Member Functions

virtual void addChild (Node *node)
virtual void clear ()
virtual void createDistribution (std::string distribution)
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 Eigen::MatrixXd getLocalCoordinates () const
 Returns the local transformation of coordinate system.
virtual Eigen::MatrixXd getRandomCoordinates () const
virtual void produceOrTransform (Score &score, size_t beginAt, size_t endAt, const Eigen::MatrixXd &compositeCoordinates)
 This function is called by the traverse() function.
 Random ()
virtual double sample () const
virtual void setElement (size_t row, size_t column, double value)
 Sets the indicated element of the local transformation of coordinate system.
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 ~Random ()

Static Public Member Functions

static void seed (int s)

Data Fields

double a
double b
double c
std::vector< Node * > children
 Child Nodes, if any.
int column
std::string distribution
int eventCount
bool incrementTime
double Lambda
double maximum
double mean
double minimum
double q
int row
double sigma

Static Public Attributes

static boost::mt19937 mersenneTwister

Protected Attributes

boost::variate_generator
< boost::mt19937,
boost::bernoulli_distribution<> > * 
bernoulli_distribution_generator
boost::variate_generator
< boost::mt19937,
boost::exponential_distribution<> > * 
exponential_distribution_generator
void * generator_
boost::variate_generator
< boost::mt19937,
boost::geometric_distribution<> > * 
geometric_distribution_generator
Eigen::MatrixXd localCoordinates
boost::variate_generator
< boost::mt19937,
boost::lognormal_distribution<> > * 
lognormal_distribution_generator
boost::variate_generator
< boost::mt19937,
boost::normal_distribution<> > * 
normal_distribution_generator
boost::variate_generator
< boost::mt19937,
boost::triangle_distribution<> > * 
triangle_distribution_generator
boost::variate_generator
< boost::mt19937,
boost::uniform_int<> > * 
uniform_int_generator
boost::variate_generator
< boost::mt19937,
boost::uniform_real<> > * 
uniform_real_generator
boost::variate_generator
< boost::mt19937,
boost::uniform_smallint<> > * 
uniform_smallint_generator

Detailed Description

A random value will be sampled from the specified distribution, translated and scaled as specified, and set in the specified row and column of the local coordinates.

The resulting matrix will be used in place of the local coordinates when traversing the music graph. If eventCount is greater than zero, a new event will be created for each of eventCount samples, which will be transformed by the newly sampled local coordinates.

Constructor & Destructor Documentation

csound::Random::Random ( )
virtual csound::Random::~Random ( )
virtual

Member Function Documentation

virtual void csound::Node::addChild ( Node node)
virtualinherited
virtual void csound::Node::clear ( )
virtualinherited
virtual void csound::Random::createDistribution ( std::string  distribution)
virtual
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 Eigen::MatrixXd csound::Node::getLocalCoordinates ( ) const
virtualinherited

Returns the local transformation of coordinate system.

virtual Eigen::MatrixXd csound::Random::getRandomCoordinates ( ) const
virtual
virtual void csound::Random::produceOrTransform ( Score collectingScore,
size_t  beginAt,
size_t  endAt,
const Eigen::MatrixXd &  compositeCordinates 
)
virtual

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.

virtual double csound::Random::sample ( ) const
virtual
static void csound::Random::seed ( int  s)
static
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 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.

Field Documentation

double csound::Random::a
double csound::Random::b
boost::variate_generator<boost::mt19937, boost::bernoulli_distribution<> >* csound::Random::bernoulli_distribution_generator
protected
double csound::Random::c
std::vector<Node *> csound::Node::children
inherited

Child Nodes, if any.

int csound::Random::column
std::string csound::Random::distribution
int csound::Random::eventCount
boost::variate_generator<boost::mt19937, boost::exponential_distribution<> >* csound::Random::exponential_distribution_generator
protected
void* csound::Random::generator_
protected
boost::variate_generator<boost::mt19937, boost::geometric_distribution<> >* csound::Random::geometric_distribution_generator
protected
bool csound::Random::incrementTime
double csound::Random::Lambda
Eigen::MatrixXd csound::Node::localCoordinates
protectedinherited
boost::variate_generator<boost::mt19937, boost::lognormal_distribution<> >* csound::Random::lognormal_distribution_generator
protected
double csound::Random::maximum
double csound::Random::mean
boost::mt19937 csound::Random::mersenneTwister
static
double csound::Random::minimum
boost::variate_generator<boost::mt19937, boost::normal_distribution<> >* csound::Random::normal_distribution_generator
protected
double csound::Random::q
int csound::Random::row
double csound::Random::sigma
boost::variate_generator<boost::mt19937, boost::triangle_distribution<> >* csound::Random::triangle_distribution_generator
protected
boost::variate_generator<boost::mt19937, boost::uniform_int<> >* csound::Random::uniform_int_generator
protected
boost::variate_generator<boost::mt19937, boost::uniform_real<> >* csound::Random::uniform_real_generator
protected
boost::variate_generator<boost::mt19937, boost::uniform_smallint<> >* csound::Random::uniform_smallint_generator
protected