Csound and CsoundAC API 5.13
|
A ScoreModel that uses Csound to render generated scores, via the CppSound class. More...
#include <MusicModel.hpp>
Public Member Functions | |
virtual void | addChild (Node *node) |
virtual void | arrange (int oldInstrumentNumber, int newInstrumentNumber) |
Re-assign instrument number for export to Csound score (convenience wrapper for Score::arrange()). | |
virtual void | arrange (int oldInstrumentNumber, int newInstrumentNumber, double gain) |
Re-assign instrument number and adjust gain for export to Csound score (convenience wrapper for Score::arrange()). | |
virtual void | arrange (int oldInstrumentNumber, int newInstrumentNumber, double gain, double pan) |
Re-assign instrument number, adjust gain, and change pan for export to Csound score (convenience wrapper for Score::arrange()). | |
virtual void | arrange (int silenceInstrumentNumber, std::string csoundInstrumentName) |
Re-assign instrument by name for export to Csound score. | |
virtual void | arrange (int silenceInstrumentNumber, std::string csoundInstrumentName, double gain) |
Re-assign instrument by name and adjust gains for export to Csound score. | |
virtual void | arrange (int silenceInstrumentNumber, std::string csoundInstrumentName, double gain, double pan) |
Re-assign instrument by name, adjust gain, and change pan for export to Csound score. | |
virtual void | clear () |
Clear all contents of this. | |
virtual void | createCsoundScore (std::string addToScore="", double extendSeconds=5.0) |
Translate the generated score to a Csound score and export it for performance. | |
virtual ublas::matrix< double > | createTransform () |
virtual double & | element (size_t row, size_t column) |
virtual void | generate () |
Generates a score based on a music graph defined by the child nodes of this. | |
virtual std::string | getAlbum () const |
virtual std::string | getArtist () const |
virtual std::string | getCdSoundfileName () |
Returns a soundfile name for a CD audio track based on the filename of this, by appending ".cd.wav" to the filename. | |
virtual bool | getConformPitches () const |
Returns whether or not the pitches in generated scores will be conformed to the nearest equally tempered pitch. | |
virtual std::string | getCopyright () const |
virtual CppSound * | getCppSound () |
Return the self-contained Orchestra. | |
virtual std::string | getCsoundCommand () const |
Return Csound command line (convenience wrapper for CppSound::getCommand()). | |
virtual std::string | getCsoundOrchestra () const |
Return the Csound orchestra (convenience wrapper for CppSound::getOrchestra()). | |
virtual std::string | getCsoundScoreHeader () const |
Return the Csound score header that is prepended to generated scores. | |
virtual std::string | getFilename () const |
Returns the filename of this, which is used as a base for derived filenames (soundfile, MIDI file, etc.). | |
virtual std::string | getFomusFilename () |
Returns a MusicXML filename based on the filename of this, by appending ".fms" to the filename. | |
virtual std::string | getLicense () const |
virtual std::string | getLilypondFilename () |
Returns a MusicXML filename based on the filename of this, by appending ".ly" to the filename. | |
virtual ublas::matrix< double > | getLocalCoordinates () const |
Returns the local transformation of coordinate system. | |
virtual std::string | getMidiFilename () |
Returns a MIDI filename based on the filename of this, by appending ".mid" to the filename. | |
virtual std::string | getMp3SoundfileName () |
Returns a soundfile name for an MP3 file based on the filename of this, by appending ".mp3" to the filename. | |
virtual std::string | getMusicXmlFilename () |
Returns a MusicXML filename based on the filename of this, by appending ".xml" to the filename. | |
virtual std::string | getNormalizedSoundfileName () |
Returns a soundfile name based on the filename of this, by appending ".norm.wav" to the filename. | |
virtual std::string | getOutputSoundfileName () |
Returns a soundfile name based on the filename of this, by appending ".wav" to the filename. | |
virtual Score & | getScore () |
Return the self-contained Score. | |
virtual long | getThis () |
Returns the address of this as a long integer. | |
virtual Node * | getThisNode () |
Returns the address of this as a Node pointer. | |
virtual std::string | getTimestamp () const |
Returns the time the score was generated. | |
virtual std::string | getTitle () const |
virtual double | getTonesPerOctave () const |
Returns the number of equally tempered intervals per octave (the default is 12, 0 means non-equally tempered). | |
virtual void | initialize () |
MusicModel () | |
virtual void | normalizeOutputSoundfile (double levelDb=-3.0) |
Assuming the score has been rendered, uses sox to translate the output soundfile to a normalized soundfile. | |
virtual void | perform () |
Uses csound to perform the current score. | |
virtual void | performAll () |
Convenience function that calls performMaster(), and translateMaster(). | |
virtual void | performMaster () |
Convenience function that calls saveMidi(), saveMusicXML(), and perform(). | |
virtual void | produceOrTransform (Score &score, size_t beginAt, size_t endAt, const ublas::matrix< double > &compositeCordinates) |
The default implementation does nothing. | |
virtual void | removeArrangement () |
Remove instrument number, gain, and pan assignments (convenience wrapper for Score::removeArrangement()). | |
virtual void | render () |
Convenience function that erases the existing score, appends optional text to it, invokes generate(), invokes createCsoundScore(), and invokes perform(). | |
virtual void | renderAll () |
Convenience function that calls clear(), generate(), performAll(). | |
virtual void | setAlbum (std::string value) |
virtual void | setArtist (std::string value) |
virtual void | setConformPitches (bool conformPitches) |
Sets whether or not the pitches in generated scores will be conformed to the nearest equally tempered pitch. | |
virtual void | setCopyright (std::string value) |
virtual void | setCppSound (CppSound *orchestra) |
Sets the self-contained Orchestra. | |
virtual void | setCsoundCommand (std::string command) |
Set Csound command line (convenience wrapper for CppSound::setCommand()). | |
virtual void | setCsoundOrchestra (std::string orchestra) |
Set the Csound orchestra (convenience wrapper for CppSound::setOrchestra()). | |
virtual void | setCsoundScoreHeader (std::string header) |
Set a Csound score fragment to be prepended to the generated score (createCsoundScore is called with it). | |
virtual void | setElement (size_t row, size_t column, double value) |
virtual void | setFilename (std::string filename) |
Sets the filename of this -- basically, the title of the composition. | |
virtual void | setLicense (std::string value) |
virtual void | setTitle (std::string value) |
virtual void | setTonesPerOctave (double tonesPerOctave) |
Sets the number of equally tempered intervals per octave (the default is 12, 0 means non-equally tempered). | |
virtual void | translateMaster () |
Convenience function that calls rescaleOutputSoundfile(), translateToCdAudio(), and translateToMp3(). | |
virtual void | translateToCdAudio (double levelDb=-3.0) |
Assuming the score has been rendered, uses sox to translate the output soundfile to normalized CD-audio format. | |
virtual void | translateToMp3 (double bitrate=256.01, double levelDb=-3.0) |
Assuming the score has been rendered, uses sox and LAME to translate the output soundfile to normalized MP3 format. | |
virtual void | translateToNotation (const std::vector< std::string > partNames=std::vector< std::string >(), std::string header="") |
Saves the generated score in Fomus format and uses Fomus and Lilypond to translate that to a PDF of music notation. | |
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 void | write (const char *text) |
Write as if to stderr. | |
virtual | ~MusicModel () |
Static Public Member Functions | |
static std::string | generateFilename () |
Generates a versioned filename. | |
static std::string | makeTimestamp () |
Returns the current locale time as a string. | |
Data Fields | |
std::vector< Node * > | children |
Child Nodes, if any. | |
Protected Attributes | |
std::string | album |
std::string | artist |
bool | conformPitches |
std::string | copyright |
CppSound * | cppSound |
Pointer to a Csound object that is used to render scores. | |
CppSound | cppSound_ |
Self-contained Csound object. | |
std::string | csoundScoreHeader |
Prepended to generated score. | |
std::string | filename |
std::string | license |
ublas::matrix< double > | localCoordinates |
Score | score |
std::string | timestamp |
std::string | title |
double | tonesPerOctave |
A ScoreModel that uses Csound to render generated scores, via the CppSound class.
csound::MusicModel::MusicModel | ( | ) |
virtual csound::MusicModel::~MusicModel | ( | ) | [virtual] |
virtual void csound::Node::addChild | ( | Node * | node | ) | [virtual, inherited] |
virtual void csound::MusicModel::arrange | ( | int | oldInstrumentNumber, |
int | newInstrumentNumber | ||
) | [virtual] |
Re-assign instrument number for export to Csound score (convenience wrapper for Score::arrange()).
virtual void csound::MusicModel::arrange | ( | int | oldInstrumentNumber, |
int | newInstrumentNumber, | ||
double | gain | ||
) | [virtual] |
Re-assign instrument number and adjust gain for export to Csound score (convenience wrapper for Score::arrange()).
virtual void csound::MusicModel::arrange | ( | int | oldInstrumentNumber, |
int | newInstrumentNumber, | ||
double | gain, | ||
double | pan | ||
) | [virtual] |
Re-assign instrument number, adjust gain, and change pan for export to Csound score (convenience wrapper for Score::arrange()).
virtual void csound::MusicModel::arrange | ( | int | silenceInstrumentNumber, |
std::string | csoundInstrumentName | ||
) | [virtual] |
Re-assign instrument by name for export to Csound score.
virtual void csound::MusicModel::arrange | ( | int | silenceInstrumentNumber, |
std::string | csoundInstrumentName, | ||
double | gain | ||
) | [virtual] |
Re-assign instrument by name and adjust gains for export to Csound score.
virtual void csound::MusicModel::arrange | ( | int | silenceInstrumentNumber, |
std::string | csoundInstrumentName, | ||
double | gain, | ||
double | pan | ||
) | [virtual] |
Re-assign instrument by name, adjust gain, and change pan for export to Csound score.
virtual void csound::MusicModel::clear | ( | ) | [virtual] |
Clear all contents of this.
Reimplemented from csound::ScoreModel.
virtual void csound::MusicModel::createCsoundScore | ( | std::string | addToScore = "" , |
double | extendSeconds = 5.0 |
||
) | [virtual] |
Translate the generated score to a Csound score and export it for performance.
The time given by extendSeconds is used for a concluding e statement.
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::MusicModel::generate | ( | ) | [virtual] |
Generates a score based on a music graph defined by the child nodes of this.
Reimplemented from csound::ScoreModel.
static std::string csound::Composition::generateFilename | ( | ) | [static, inherited] |
Generates a versioned filename.
virtual std::string csound::Composition::getAlbum | ( | ) | const [virtual, inherited] |
virtual std::string csound::Composition::getArtist | ( | ) | const [virtual, inherited] |
virtual std::string csound::Composition::getCdSoundfileName | ( | ) | [virtual, inherited] |
Returns a soundfile name for a CD audio track based on the filename of this, by appending ".cd.wav" to the filename.
virtual bool csound::Composition::getConformPitches | ( | ) | const [virtual, inherited] |
Returns whether or not the pitches in generated scores will be conformed to the nearest equally tempered pitch.
virtual std::string csound::Composition::getCopyright | ( | ) | const [virtual, inherited] |
virtual CppSound* csound::MusicModel::getCppSound | ( | ) | [virtual] |
Return the self-contained Orchestra.
virtual std::string csound::MusicModel::getCsoundCommand | ( | ) | const [virtual] |
Return Csound command line (convenience wrapper for CppSound::getCommand()).
virtual std::string csound::MusicModel::getCsoundOrchestra | ( | ) | const [virtual] |
Return the Csound orchestra (convenience wrapper for CppSound::getOrchestra()).
virtual std::string csound::MusicModel::getCsoundScoreHeader | ( | ) | const [virtual] |
Return the Csound score header that is prepended to generated scores.
virtual std::string csound::Composition::getFilename | ( | ) | const [virtual, inherited] |
Returns the filename of this, which is used as a base for derived filenames (soundfile, MIDI file, etc.).
virtual std::string csound::Composition::getFomusFilename | ( | ) | [virtual, inherited] |
Returns a MusicXML filename based on the filename of this, by appending ".fms" to the filename.
virtual std::string csound::Composition::getLicense | ( | ) | const [virtual, inherited] |
virtual std::string csound::Composition::getLilypondFilename | ( | ) | [virtual, inherited] |
Returns a MusicXML filename based on the filename of this, by appending ".ly" to the filename.
virtual ublas::matrix<double> csound::Node::getLocalCoordinates | ( | ) | const [virtual, inherited] |
Returns the local transformation of coordinate system.
virtual std::string csound::Composition::getMidiFilename | ( | ) | [virtual, inherited] |
Returns a MIDI filename based on the filename of this, by appending ".mid" to the filename.
virtual std::string csound::Composition::getMp3SoundfileName | ( | ) | [virtual, inherited] |
Returns a soundfile name for an MP3 file based on the filename of this, by appending ".mp3" to the filename.
virtual std::string csound::Composition::getMusicXmlFilename | ( | ) | [virtual, inherited] |
Returns a MusicXML filename based on the filename of this, by appending ".xml" to the filename.
virtual std::string csound::Composition::getNormalizedSoundfileName | ( | ) | [virtual, inherited] |
Returns a soundfile name based on the filename of this, by appending ".norm.wav" to the filename.
virtual std::string csound::Composition::getOutputSoundfileName | ( | ) | [virtual, inherited] |
Returns a soundfile name based on the filename of this, by appending ".wav" to the filename.
virtual Score& csound::Composition::getScore | ( | ) | [virtual, inherited] |
Return the self-contained Score.
virtual long csound::MusicModel::getThis | ( | ) | [virtual] |
Returns the address of this as a long integer.
Reimplemented from csound::ScoreModel.
virtual Node* csound::MusicModel::getThisNode | ( | ) | [virtual] |
Returns the address of this as a Node pointer.
Reimplemented from csound::ScoreModel.
virtual std::string csound::Composition::getTimestamp | ( | ) | const [virtual, inherited] |
Returns the time the score was generated.
virtual std::string csound::Composition::getTitle | ( | ) | const [virtual, inherited] |
virtual double csound::Composition::getTonesPerOctave | ( | ) | const [virtual, inherited] |
Returns the number of equally tempered intervals per octave (the default is 12, 0 means non-equally tempered).
virtual void csound::MusicModel::initialize | ( | ) | [virtual] |
Reimplemented from csound::ScoreModel.
static std::string csound::Composition::makeTimestamp | ( | ) | [static, inherited] |
Returns the current locale time as a string.
virtual void csound::Composition::normalizeOutputSoundfile | ( | double | levelDb = -3.0 | ) | [virtual, inherited] |
Assuming the score has been rendered, uses sox to translate the output soundfile to a normalized soundfile.
virtual void csound::MusicModel::perform | ( | ) | [virtual] |
Uses csound to perform the current score.
Reimplemented from csound::Composition.
virtual void csound::Composition::performAll | ( | ) | [virtual, inherited] |
Convenience function that calls performMaster(), and translateMaster().
virtual void csound::Composition::performMaster | ( | ) | [virtual, inherited] |
Convenience function that calls saveMidi(), saveMusicXML(), and perform().
virtual void csound::Node::produceOrTransform | ( | Score & | score, |
size_t | beginAt, | ||
size_t | endAt, | ||
const ublas::matrix< double > & | compositeCordinates | ||
) | [virtual, inherited] |
The default implementation does nothing.
Derived nodes that produce notes from scratch should transform them using the composite transformation of coordinate system, which is passed in from the traverse() function.
Reimplemented in csound::Cell, csound::ChordLindenmayer, csound::CounterpointNode, csound::Hocket, csound::MCRM, csound::RemoveDuplicates, csound::Random, csound::Rescale, csound::ScoreNode, and csound::VoiceleadingNode.
virtual void csound::MusicModel::removeArrangement | ( | ) | [virtual] |
Remove instrument number, gain, and pan assignments (convenience wrapper for Score::removeArrangement()).
virtual void csound::MusicModel::render | ( | ) | [virtual] |
Convenience function that erases the existing score, appends optional text to it, invokes generate(), invokes createCsoundScore(), and invokes perform().
Reimplemented from csound::Composition.
virtual void csound::Composition::renderAll | ( | ) | [virtual, inherited] |
Convenience function that calls clear(), generate(), performAll().
virtual void csound::Composition::setAlbum | ( | std::string | value | ) | [virtual, inherited] |
virtual void csound::Composition::setArtist | ( | std::string | value | ) | [virtual, inherited] |
virtual void csound::Composition::setConformPitches | ( | bool | conformPitches | ) | [virtual, inherited] |
Sets whether or not the pitches in generated scores will be conformed to the nearest equally tempered pitch.
virtual void csound::Composition::setCopyright | ( | std::string | value | ) | [virtual, inherited] |
virtual void csound::MusicModel::setCppSound | ( | CppSound * | orchestra | ) | [virtual] |
Sets the self-contained Orchestra.
virtual void csound::MusicModel::setCsoundCommand | ( | std::string | command | ) | [virtual] |
Set Csound command line (convenience wrapper for CppSound::setCommand()).
virtual void csound::MusicModel::setCsoundOrchestra | ( | std::string | orchestra | ) | [virtual] |
Set the Csound orchestra (convenience wrapper for CppSound::setOrchestra()).
virtual void csound::MusicModel::setCsoundScoreHeader | ( | std::string | header | ) | [virtual] |
Set a Csound score fragment to be prepended to the generated score (createCsoundScore is called with it).
virtual void csound::Node::setElement | ( | size_t | row, |
size_t | column, | ||
double | value | ||
) | [virtual, inherited] |
virtual void csound::Composition::setFilename | ( | std::string | filename | ) | [virtual, inherited] |
Sets the filename of this -- basically, the title of the composition.
virtual void csound::Composition::setLicense | ( | std::string | value | ) | [virtual, inherited] |
virtual void csound::Composition::setTitle | ( | std::string | value | ) | [virtual, inherited] |
virtual void csound::Composition::setTonesPerOctave | ( | double | tonesPerOctave | ) | [virtual, inherited] |
Sets the number of equally tempered intervals per octave (the default is 12, 0 means non-equally tempered).
virtual void csound::Composition::translateMaster | ( | ) | [virtual, inherited] |
Convenience function that calls rescaleOutputSoundfile(), translateToCdAudio(), and translateToMp3().
virtual void csound::Composition::translateToCdAudio | ( | double | levelDb = -3.0 | ) | [virtual, inherited] |
Assuming the score has been rendered, uses sox to translate the output soundfile to normalized CD-audio format.
virtual void csound::Composition::translateToMp3 | ( | double | bitrate = 256.01 , |
double | levelDb = -3.0 |
||
) | [virtual, inherited] |
Assuming the score has been rendered, uses sox and LAME to translate the output soundfile to normalized MP3 format.
virtual void csound::Composition::translateToNotation | ( | const std::vector< std::string > | partNames = std::vector< std::string >() , |
std::string | header = "" |
||
) | [virtual, inherited] |
Saves the generated score in Fomus format and uses Fomus and Lilypond to translate that to a PDF of music notation.
A meter of 4/4 and a tempo of MM 120 is assumed. A vector of part names may be supplied.
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::Composition::write | ( | const char * | text | ) | [virtual, inherited] |
Write as if to stderr.
std::string csound::Composition::album [protected, inherited] |
std::string csound::Composition::artist [protected, inherited] |
std::vector<Node *> csound::Node::children [inherited] |
Child Nodes, if any.
bool csound::Composition::conformPitches [protected, inherited] |
std::string csound::Composition::copyright [protected, inherited] |
CppSound* csound::MusicModel::cppSound [protected] |
Pointer to a Csound object that is used to render scores.
Defaults to the internal Csound object, but can be re-set to an external Csound object.
CppSound csound::MusicModel::cppSound_ [protected] |
Self-contained Csound object.
std::string csound::MusicModel::csoundScoreHeader [protected] |
Prepended to generated score.
std::string csound::Composition::filename [protected, inherited] |
std::string csound::Composition::license [protected, inherited] |
ublas::matrix<double> csound::Node::localCoordinates [protected, inherited] |
Score csound::Composition::score [protected, inherited] |
std::string csound::Composition::timestamp [protected, inherited] |
std::string csound::Composition::title [protected, inherited] |
double csound::Composition::tonesPerOctave [protected, inherited] |