Csound and CsoundAC API
5.17
|
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 | clearOutputSoundfileName () |
virtual void | createCsoundScore (std::string addToScore="", double extendSeconds=5.0) |
Translate the generated score to a Csound score and export it for performance. | |
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 int | 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 () const |
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 () const |
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 () const |
Returns a MusicXML filename based on the filename of this, by appending ".ly" to the filename. | |
virtual Eigen::MatrixXd | getLocalCoordinates () const |
Returns the local transformation of coordinate system. | |
virtual std::string | getMidiFilename () const |
Returns a MIDI filename based on the filename of this, by appending ".mid" to the filename. | |
virtual std::string | getMp3SoundfileName () const |
Returns a soundfile name for an MP3 file based on the filename of this, by appending ".mp3" to the filename. | |
virtual std::string | getMusicXmlFilename () const |
Returns a MusicXML filename based on the filename of this, by appending ".xml" to the filename. | |
virtual std::string | getNormalizedSoundfileName () const |
Returns a soundfile name based on the filename of this, by appending ".norm.wav" to the filename. | |
virtual std::string | getOutputSoundfileName () const |
Returns a soundfile name based on the filename of this, by appending ".wav" to the filename, which is the default, or a non-default ouput name which need not be a file but must be set using setOutputSoundfileName(). | |
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 int | normalizeOutputSoundfile (double levelDb=-3.0) |
Assuming the score has been rendered, uses sox to translate the output soundfile to a normalized soundfile. | |
virtual int | perform () |
Uses csound to perform the current score. | |
virtual int | performAll () |
Convenience function that calls performMaster(), and translateMaster(). | |
virtual int | performMaster () |
Convenience function that calls saveMidi(), saveMusicXML(), and perform(). | |
virtual int | processArgs (const std::vector< std::string > &args) |
Pass the invoking program's command-line arguments to processArgs() and it will perform the following commands: | |
virtual int | processArgv (int argc, const char **argv) |
Pass the invoking program's command-line arguments to processArgs() and it will perform with possibly back-end-dependent options. | |
virtual void | produceOrTransform (Score &collectingScore, size_t beginAt, size_t endAt, const Eigen::MatrixXd &compositeCordinates) |
This function is called by the traverse() function. | |
virtual void | removeArrangement () |
Remove instrument number, gain, and pan assignments (convenience wrapper for Score::removeArrangement()). | |
virtual int | render () |
Convenience function that erases the existing score, appends optional text to it, invokes generate(), invokes createCsoundScore(), and invokes perform(). | |
virtual int | 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) |
Sets the indicated element of the local transformation of coordinate system. | |
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 | setOutputSoundfileName (std::string name) |
Sets a non-default output name (could be an audio device not a file). | |
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 | stop () |
virtual int | tagFile (std::string filename) const |
virtual int | translateMaster () |
Convenience function that calls rescaleOutputSoundfile(), translateToCdAudio(), and translateToMp3(). | |
virtual int | translateToCdAudio (double levelDb=-3.0) |
Assuming the score has been rendered, uses sox to translate the output soundfile to normalized CD-audio format. | |
virtual int | 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 int | 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 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 | 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 |
Eigen::MatrixXd | localCoordinates |
std::string | outputFilename |
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 |
|
virtualinherited |
|
virtual |
Re-assign instrument number for export to Csound score (convenience wrapper for Score::arrange()).
|
virtual |
Re-assign instrument number and adjust gain for export to Csound score (convenience wrapper for Score::arrange()).
|
virtual |
Re-assign instrument number, adjust gain, and change pan for export to Csound score (convenience wrapper for Score::arrange()).
|
virtual |
Re-assign instrument by name for export to Csound score.
|
virtual |
Re-assign instrument by name and adjust gains for export to Csound score.
|
virtual |
Re-assign instrument by name, adjust gain, and change pan for export to Csound score.
|
virtual |
Clear all contents of this.
Reimplemented from csound::ScoreModel.
|
virtualinherited |
|
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.
|
virtualinherited |
|
virtualinherited |
Returns a reference to the indicated element of the local transformation of coordinate system.
|
virtual |
Generates a score based on a music graph defined by the child nodes of this.
Reimplemented from csound::ScoreModel.
|
staticinherited |
Generates a versioned filename.
|
virtualinherited |
|
virtualinherited |
|
virtualinherited |
Returns a soundfile name for a CD audio track based on the filename of this, by appending ".cd.wav" to the filename.
|
virtualinherited |
Returns whether or not the pitches in generated scores will be conformed to the nearest equally tempered pitch.
|
virtualinherited |
|
virtual |
Return the self-contained Orchestra.
|
virtual |
Return Csound command line (convenience wrapper for CppSound::getCommand()).
|
virtual |
Return the Csound orchestra (convenience wrapper for CppSound::getOrchestra()).
|
virtual |
Return the Csound score header that is prepended to generated scores.
|
virtualinherited |
Returns the filename of this, which is used as a base for derived filenames (soundfile, MIDI file, etc.).
|
virtualinherited |
Returns a MusicXML filename based on the filename of this, by appending ".fms" to the filename.
|
virtualinherited |
|
virtualinherited |
Returns a MusicXML filename based on the filename of this, by appending ".ly" to the filename.
|
virtualinherited |
Returns the local transformation of coordinate system.
|
virtualinherited |
Returns a MIDI filename based on the filename of this, by appending ".mid" to the filename.
|
virtualinherited |
Returns a soundfile name for an MP3 file based on the filename of this, by appending ".mp3" to the filename.
|
virtualinherited |
Returns a MusicXML filename based on the filename of this, by appending ".xml" to the filename.
|
virtualinherited |
Returns a soundfile name based on the filename of this, by appending ".norm.wav" to the filename.
|
virtualinherited |
Returns a soundfile name based on the filename of this, by appending ".wav" to the filename, which is the default, or a non-default ouput name which need not be a file but must be set using setOutputSoundfileName().
|
virtual |
Returns the address of this as a long integer.
Reimplemented from csound::ScoreModel.
|
virtual |
Returns the address of this as a Node pointer.
Reimplemented from csound::ScoreModel.
|
virtualinherited |
Returns the time the score was generated.
|
virtualinherited |
|
virtualinherited |
Returns the number of equally tempered intervals per octave (the default is 12, 0 means non-equally tempered).
|
virtual |
Reimplemented from csound::ScoreModel.
|
staticinherited |
Returns the current locale time as a string.
|
virtualinherited |
Assuming the score has been rendered, uses sox to translate the output soundfile to a normalized soundfile.
|
virtual |
Uses csound to perform the current score.
Reimplemented from csound::Composition.
|
virtualinherited |
Convenience function that calls performMaster(), and translateMaster().
|
virtualinherited |
Convenience function that calls saveMidi(), saveMusicXML(), and perform().
|
virtual |
Pass the invoking program's command-line arguments to processArgs() and it will perform the following commands:
–csound Render generated score using set Csound orchestra. –midi Render generated score as MIDI file and play it (default). –pianoteq Play generated MIDI sequence file with Pianoteq. –pianoteq-wav Render score to soundfile using Pianoteq, post-process it, and play it. –playmidi Play generated MIDI filev post-process it, and play it. –playwav Play rendered or normalized output soundfile. –post Post-process Csound output soundfile: normalize, CD, MP3, tag, and play it.
Reimplemented from csound::Composition.
|
virtualinherited |
Pass the invoking program's command-line arguments to processArgs() and it will perform with possibly back-end-dependent options.
Default implementation calls the std::string overload.
|
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 in csound::ChordLindenmayer, csound::VoiceleadingNode, csound::RemoveDuplicates, csound::Random, csound::Cell, csound::CounterpointNode, csound::MCRM, csound::ScoreNode, and csound::Rescale.
|
virtual |
Remove instrument number, gain, and pan assignments (convenience wrapper for Score::removeArrangement()).
|
virtual |
Convenience function that erases the existing score, appends optional text to it, invokes generate(), invokes createCsoundScore(), and invokes perform().
Reimplemented from csound::Composition.
|
virtualinherited |
Convenience function that calls clear(), generate(), performAll().
|
virtualinherited |
|
virtualinherited |
|
virtualinherited |
Sets whether or not the pitches in generated scores will be conformed to the nearest equally tempered pitch.
|
virtualinherited |
|
virtual |
Sets the self-contained Orchestra.
|
virtual |
Set Csound command line (convenience wrapper for CppSound::setCommand()).
|
virtual |
Set the Csound orchestra (convenience wrapper for CppSound::setOrchestra()).
|
virtual |
Set a Csound score fragment to be prepended to the generated score (createCsoundScore is called with it).
|
virtualinherited |
Sets the indicated element of the local transformation of coordinate system.
|
virtualinherited |
Sets the filename of this – basically, the title of the composition.
|
virtualinherited |
|
virtualinherited |
Sets a non-default output name (could be an audio device not a file).
|
virtualinherited |
|
virtualinherited |
Sets the number of equally tempered intervals per octave (the default is 12, 0 means non-equally tempered).
|
virtual |
|
virtualinherited |
|
virtualinherited |
Convenience function that calls rescaleOutputSoundfile(), translateToCdAudio(), and translateToMp3().
|
virtualinherited |
Assuming the score has been rendered, uses sox to translate the output soundfile to normalized CD-audio format.
|
virtualinherited |
Assuming the score has been rendered, uses sox and LAME to translate the output soundfile to normalized MP3 format.
|
virtualinherited |
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.
|
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.
|
virtualinherited |
Write as if to stderr.
|
protectedinherited |
|
protectedinherited |
|
inherited |
Child Nodes, if any.
|
protectedinherited |
|
protectedinherited |
|
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.
|
protected |
Self-contained Csound object.
|
protected |
Prepended to generated score.
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |