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

This node class imposes a sequence of one or more "voice-leading" operations upon the pitches of notes produced by children of this node, within a segment of the notes. More...

#include <VoiceleadingNode.hpp>

+ Inheritance diagram for csound::VoiceleadingNode:

Public Member Functions

virtual void addChild (Node *node)
virtual void apply (Score &score, const VoiceleadingOperation &priorOperation, const VoiceleadingOperation &currentOperation)
 Apply the current voice-leading operation to the score, within the specified range of notes.
virtual void C (double time, double C_)
 Beginning at the specified time and continuing to the beginning of the next operation or the end of the score, whichever comes first, conform notes produced by this node or its children to the specified prime chord and transposition.
virtual void C (double time, std::string C_)
 Same as PT, except that a single number is used in place of the P and T numbers.
virtual void CL (double time, double C_, bool avoidParallels=true)
 Same as CV, except the chord is specified by jazz-type name (e.g.
virtual void CL (double time, std::string C_, bool avoidParallels=true)
 Same as PTL, except the chord is specified by a single number instead of P and T numbers.
virtual void clear ()
virtual Eigen::MatrixXd createTransform ()
virtual void CV (double time, double C_, double V_)
 Same as C, except the chord can be specified by jazz-type name (e.g.
virtual void CV (double time, std::string C_, double V_)
 Same as PTV, except the chord is specified by a single number instead of the P and T numbers.
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 std::vector< double > getModality () const
virtual void K (double time)
 Find the C of the previous segment, and contextually invert it; apply the resulting C to the current segment.
virtual void KL (double time, bool avoidParallels=true)
 Find the C of the previous segment, and contextually invert it; apply the resulting C to the current segment, using the closest voiceleading from the pitches of the previous segment.
virtual void KV (double time, double V_)
 Find the C of the previous segment, and contextually invert it; apply the resulting C to the current segment with voicing V.
virtual void L (double time, bool avoidParallels=true)
 Beginning at the specified time and continuing to the beginning of the next operation or the end of the score, whichever comes first, conform notes produced by this node or its children to the smoothest voice-leading from the pitches of the previous segment.
virtual void produceOrTransform (Score &collectingNode, size_t beginAt, size_t endAt, const Eigen::MatrixXd &coordinates)
 Applies all of the stored voice-leading operations to the specified range of notes in the score.
virtual void PT (double time, double P_, double T)
 Beginning at the specified time and continuing to the beginning of the next operation or the end of the score, whichever comes first, conform notes produced by this node or its children to the specified prime chord and transposition.
virtual void PTL (double time, double P_, double T, bool avoidParallels=true)
 Beginning at the specified time and continuing to the beginning of the next operation or the end of the score, whichever comes first, conform notes produced by this node or its children to the specified chord; the voicing of the chord will be the smoothest voice-leading from the pitches of the previous chord.
virtual void PTV (double time, double P_, double T, double V_)
 Beginning at the specified time and continuing to the beginning of the next operation or the end of the score, whichever comes first, conform notes produced by this node or its children to the specified prime chord, transposition, and voicing.
virtual void Q (double time, double Q_)
 Find the C of the previous segment, and contextually transpose it; apply the resulting C to the current segment.
virtual void QL (double time, double Q_, bool avoidParallels=true)
 Find the C of the previous segment, and contextually transpose it; apply the resulting C to the current segment, using the closest voiceleading from the pitches of the previous segment.
virtual void QV (double time, double Q_, double V_)
 Find the C of the previous segment, and contextually transpose it; apply the resulting C to the current segment with voicing V.
virtual void setElement (size_t row, size_t column, double value)
 Sets the indicated element of the local transformation of coordinate system.
virtual void setModality (const std::vector< double > &pcs)
virtual void transform (Score &score, bool rescaleTime=false)
 Apply all of the voice-leading operations stored within this node to the score.
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 void V (double time, double V_)
 Beginning at the specified time and continuing to the beginning of the next operation or the end of the score, whichever comes first, conform notes produced by this node or its children to the specified voicing of the chord.
 VoiceleadingNode ()
virtual ~VoiceleadingNode ()

Data Fields

bool avoidParallels
 If true (the default), voice-leadings will avoid parallel fifths.
double base
 The lowest pitch of the range of voicings, as a MIDI key number (default = 36).
std::vector< Node * > children
 Child Nodes, if any.
size_t divisionsPerOctave
 The number of equally tempered divisions of the octave (default = 12).
std::vector< double > modality
 Context for the K and Q operations; must have the same cardinality as the pitch-classes in use.
std::map< double,
VoiceleadingOperation
operations
 Voice-leading operations stored in order of starting time.
double range
 The range of voicings, from the lowest to the highest pitch, as a MIDI key number (default = 60).
bool rescaleTimes
 If true (the default), rescale times of voice-leading operations in proportion to the duration of the notes produced by this and its child nodes.

Protected Attributes

Eigen::MatrixXd localCoordinates

Detailed Description

This node class imposes a sequence of one or more "voice-leading" operations upon the pitches of notes produced by children of this node, within a segment of the notes.

These operations comprise: prime chord (P), transpose (T), unordered pitch-class set (C, equivalent to PT), contextual inversion (K), contextual transposition (Q), voicing (V) within a specified range of pitches, and voice-lead (L). The values of P, T, C, and V each form an additive cyclic group whose elements are defined by counting through all possible values in order. Note that C is not the same as "pitch-class set number" in the sense of M = sum over pitch-classes of (2 ^ pitch-class); it is rather one less than M. Not all combinations of operations are consistent. P requires T. PT cannot be used with C. V cannot be used with L. If neither PT nor C is specified, the existing C of the notes is used. K and Q require a previous section, and cannot be used with P, T, or C. The consistent combinations of operations are thus: PT, PTV, PTL, C, CV, CL, K, KV, KL, Q, QV, QL, V, and L.

Constructor & Destructor Documentation

csound::VoiceleadingNode::VoiceleadingNode ( )
virtual csound::VoiceleadingNode::~VoiceleadingNode ( )
virtual

Member Function Documentation

virtual void csound::Node::addChild ( Node node)
virtualinherited
virtual void csound::VoiceleadingNode::apply ( Score score,
const VoiceleadingOperation priorOperation,
const VoiceleadingOperation currentOperation 
)
virtual

Apply the current voice-leading operation to the score, within the specified range of notes.

If voice-leading proper is to be performed, the prior voice-leading operation is used to determine how to lead the voices.

virtual void csound::VoiceleadingNode::C ( double  time,
double  C_ 
)
virtual

Beginning at the specified time and continuing to the beginning of the next operation or the end of the score, whichever comes first, conform notes produced by this node or its children to the specified prime chord and transposition.

Note that C (equivalent to PT) specifies what musicians normally call a chord.

virtual void csound::VoiceleadingNode::C ( double  time,
std::string  C_ 
)
virtual

Same as PT, except that a single number is used in place of the P and T numbers.

virtual void csound::VoiceleadingNode::CL ( double  time,
double  C_,
bool  avoidParallels = true 
)
virtual

Same as CV, except the chord is specified by jazz-type name (e.g.

EbM7) instead of C number.

virtual void csound::VoiceleadingNode::CL ( double  time,
std::string  C_,
bool  avoidParallels = true 
)
virtual

Same as PTL, except the chord is specified by a single number instead of P and T numbers.

virtual void csound::Node::clear ( )
virtualinherited
virtual Eigen::MatrixXd csound::Node::createTransform ( )
virtualinherited
virtual void csound::VoiceleadingNode::CV ( double  time,
double  C_,
double  V_ 
)
virtual

Same as C, except the chord can be specified by jazz-type name (e.g.

EbM7) instead of C number.

virtual void csound::VoiceleadingNode::CV ( double  time,
std::string  C_,
double  V_ 
)
virtual

Same as PTV, except the chord is specified by a single number instead of the P and T numbers.

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 std::vector<double> csound::VoiceleadingNode::getModality ( ) const
virtual
virtual void csound::VoiceleadingNode::K ( double  time)
virtual

Find the C of the previous segment, and contextually invert it; apply the resulting C to the current segment.

Contextual inversion is that inversion of C in which the first two pitch-classes are exchanged.

virtual void csound::VoiceleadingNode::KL ( double  time,
bool  avoidParallels = true 
)
virtual

Find the C of the previous segment, and contextually invert it; apply the resulting C to the current segment, using the closest voiceleading from the pitches of the previous segment.

Contextual inversion is that inversion of C in which the first two pitch-classes are exchanged.

virtual void csound::VoiceleadingNode::KV ( double  time,
double  V_ 
)
virtual

Find the C of the previous segment, and contextually invert it; apply the resulting C to the current segment with voicing V.

Contextual inversion is that inversion of C in which the first two pitch-classes are exchanged.

virtual void csound::VoiceleadingNode::L ( double  time,
bool  avoidParallels = true 
)
virtual

Beginning at the specified time and continuing to the beginning of the next operation or the end of the score, whichever comes first, conform notes produced by this node or its children to the smoothest voice-leading from the pitches of the previous segment.

Optionally, parallel fifths can be avoided. Note that L specifies what musicians normally call voice-leading.

virtual void csound::VoiceleadingNode::produceOrTransform ( Score collectingNode,
size_t  beginAt,
size_t  endAt,
const Eigen::MatrixXd &  coordinates 
)
virtual

Applies all of the stored voice-leading operations to the specified range of notes in the score.

if rescaleTimes is true, the times of the operations will be rescaled to fit the times in the range of notes.

Reimplemented from csound::Node.

Reimplemented in csound::ChordLindenmayer.

virtual void csound::VoiceleadingNode::PT ( double  time,
double  P_,
double  T 
)
virtual

Beginning at the specified time and continuing to the beginning of the next operation or the end of the score, whichever comes first, conform notes produced by this node or its children to the specified prime chord and transposition.

Note that PT specifies what musicians normally call a chord, e.g. "E flat major ninth." However, chords do not have to be in twelve tone equal temperament.

virtual void csound::VoiceleadingNode::PTL ( double  time,
double  P_,
double  T,
bool  avoidParallels = true 
)
virtual

Beginning at the specified time and continuing to the beginning of the next operation or the end of the score, whichever comes first, conform notes produced by this node or its children to the specified chord; the voicing of the chord will be the smoothest voice-leading from the pitches of the previous chord.

Optionally, parallel fifths can be avoided. Note that PTL specifies what musicians normally call the voice-leading of a chord.

virtual void csound::VoiceleadingNode::PTV ( double  time,
double  P_,
double  T,
double  V_ 
)
virtual

Beginning at the specified time and continuing to the beginning of the next operation or the end of the score, whichever comes first, conform notes produced by this node or its children to the specified prime chord, transposition, and voicing.

Note that PTV specifies what musicians normally call the voicing, or inversion, of a chord.

virtual void csound::VoiceleadingNode::Q ( double  time,
double  Q_ 
)
virtual

Find the C of the previous segment, and contextually transpose it; apply the resulting C to the current segment.

Contextual transposition transposes C up by Q if C is an I-form, and down by Q if C is a T-form.

virtual void csound::VoiceleadingNode::QL ( double  time,
double  Q_,
bool  avoidParallels = true 
)
virtual

Find the C of the previous segment, and contextually transpose it; apply the resulting C to the current segment, using the closest voiceleading from the pitches of the previous segment.

Contextual transposition transposes C up by Q if C is an I-form, and down by Q if C is a T-form.

virtual void csound::VoiceleadingNode::QV ( double  time,
double  Q_,
double  V_ 
)
virtual

Find the C of the previous segment, and contextually transpose it; apply the resulting C to the current segment with voicing V.

Contextual transposition transposes C up by Q if C is an I-form, and down by Q if C is a T-form.

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::VoiceleadingNode::setModality ( const std::vector< double > &  pcs)
virtual
virtual void csound::VoiceleadingNode::transform ( Score score,
bool  rescaleTime = false 
)
virtual

Apply all of the voice-leading operations stored within this node to the score.

Enables voice-leading operations to be used outside the context of a music graph.

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::VoiceleadingNode::V ( double  time,
double  V_ 
)
virtual

Beginning at the specified time and continuing to the beginning of the next operation or the end of the score, whichever comes first, conform notes produced by this node or its children to the specified voicing of the chord.

Note that V specifies what musicians normally call the voicing or inversion of the chord.

Field Documentation

bool csound::VoiceleadingNode::avoidParallels

If true (the default), voice-leadings will avoid parallel fifths.

double csound::VoiceleadingNode::base

The lowest pitch of the range of voicings, as a MIDI key number (default = 36).

std::vector<Node *> csound::Node::children
inherited

Child Nodes, if any.

size_t csound::VoiceleadingNode::divisionsPerOctave

The number of equally tempered divisions of the octave (default = 12).

Note that the octave is always size 12. The size of a division of the octave is then 1 in 12-tone equal temperament, 0.5 in 24-tone equal temperament, 1.33333 in 9-tone equal temperament, and so on.

Eigen::MatrixXd csound::Node::localCoordinates
protectedinherited
std::vector<double> csound::VoiceleadingNode::modality

Context for the K and Q operations; must have the same cardinality as the pitch-classes in use.

std::map<double, VoiceleadingOperation> csound::VoiceleadingNode::operations

Voice-leading operations stored in order of starting time.

double csound::VoiceleadingNode::range

The range of voicings, from the lowest to the highest pitch, as a MIDI key number (default = 60).

bool csound::VoiceleadingNode::rescaleTimes

If true (the default), rescale times of voice-leading operations in proportion to the duration of the notes produced by this and its child nodes.