Csound and CsoundAC API 5.13
Public Member Functions | Static Public Member Functions | Protected Attributes
csound::Composition Class Reference

Base class for user-defined musical compositions. More...

#include <Composition.hpp>

Inheritance diagram for csound::Composition:

Public Member Functions

virtual void clear ()
 Clear all contents of this.
 Composition ()
virtual void generate ()
 Generate performance events and store them in the score.
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 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 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 ScoregetScore ()
 Return the self-contained Score.
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 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 ()
 Performs the current score to create an output soundfile, which should be tagged with author, timestamp, copyright, title, and optionally album.
virtual void performAll ()
 Convenience function that calls performMaster(), and translateMaster().
virtual void performMaster ()
 Convenience function that calls saveMidi(), saveMusicXML(), and perform().
virtual void render ()
 Convenience function that calls clear(), generate(), 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 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 void write (const char *text)
 Write as if to stderr.
virtual ~Composition ()

Static Public Member Functions

static std::string generateFilename ()
 Generates a versioned filename.
static std::string makeTimestamp ()
 Returns the current locale time as a string.

Protected Attributes

std::string album
std::string artist
bool conformPitches
std::string copyright
std::string filename
std::string license
Score score
std::string timestamp
std::string title
double tonesPerOctave

Detailed Description

Base class for user-defined musical compositions.

Contains a Score object for collecting generated Events such as notes and control messages.


Constructor & Destructor Documentation

csound::Composition::Composition ( )
virtual csound::Composition::~Composition ( ) [virtual]

Member Function Documentation

virtual void csound::Composition::clear ( ) [virtual]

Clear all contents of this.

Probably should be overridden in derived classes.

Reimplemented in csound::MusicModel, and csound::ScoreModel.

virtual void csound::Composition::generate ( ) [virtual]

Generate performance events and store them in the score.

Must be overidden in derived classes.

Reimplemented in csound::MusicModel, and csound::ScoreModel.

static std::string csound::Composition::generateFilename ( ) [static]

Generates a versioned filename.

virtual std::string csound::Composition::getAlbum ( ) const [virtual]
virtual std::string csound::Composition::getArtist ( ) const [virtual]
virtual std::string csound::Composition::getCdSoundfileName ( ) [virtual]

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]

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]
virtual std::string csound::Composition::getFilename ( ) const [virtual]

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]

Returns a MusicXML filename based on the filename of this, by appending ".fms" to the filename.

virtual std::string csound::Composition::getLicense ( ) const [virtual]
virtual std::string csound::Composition::getLilypondFilename ( ) [virtual]

Returns a MusicXML filename based on the filename of this, by appending ".ly" to the filename.

virtual std::string csound::Composition::getMidiFilename ( ) [virtual]

Returns a MIDI filename based on the filename of this, by appending ".mid" to the filename.

virtual std::string csound::Composition::getMp3SoundfileName ( ) [virtual]

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]

Returns a MusicXML filename based on the filename of this, by appending ".xml" to the filename.

virtual std::string csound::Composition::getNormalizedSoundfileName ( ) [virtual]

Returns a soundfile name based on the filename of this, by appending ".norm.wav" to the filename.

virtual std::string csound::Composition::getOutputSoundfileName ( ) [virtual]

Returns a soundfile name based on the filename of this, by appending ".wav" to the filename.

virtual Score& csound::Composition::getScore ( ) [virtual]

Return the self-contained Score.

virtual std::string csound::Composition::getTimestamp ( ) const [virtual]

Returns the time the score was generated.

virtual std::string csound::Composition::getTitle ( ) const [virtual]
virtual double csound::Composition::getTonesPerOctave ( ) const [virtual]

Returns the number of equally tempered intervals per octave (the default is 12, 0 means non-equally tempered).

static std::string csound::Composition::makeTimestamp ( ) [static]

Returns the current locale time as a string.

virtual void csound::Composition::normalizeOutputSoundfile ( double  levelDb = -3.0) [virtual]

Assuming the score has been rendered, uses sox to translate the output soundfile to a normalized soundfile.

virtual void csound::Composition::perform ( ) [virtual]

Performs the current score to create an output soundfile, which should be tagged with author, timestamp, copyright, title, and optionally album.

The default implementation does nothing. Must be overridden in derived classes.

Reimplemented in csound::MusicModel.

virtual void csound::Composition::performAll ( ) [virtual]

Convenience function that calls performMaster(), and translateMaster().

virtual void csound::Composition::performMaster ( ) [virtual]

Convenience function that calls saveMidi(), saveMusicXML(), and perform().

virtual void csound::Composition::render ( ) [virtual]

Convenience function that calls clear(), generate(), perform().

Reimplemented in csound::MusicModel.

virtual void csound::Composition::renderAll ( ) [virtual]

Convenience function that calls clear(), generate(), performAll().

virtual void csound::Composition::setAlbum ( std::string  value) [virtual]
virtual void csound::Composition::setArtist ( std::string  value) [virtual]
virtual void csound::Composition::setConformPitches ( bool  conformPitches) [virtual]

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]
virtual void csound::Composition::setFilename ( std::string  filename) [virtual]

Sets the filename of this -- basically, the title of the composition.

virtual void csound::Composition::setLicense ( std::string  value) [virtual]
virtual void csound::Composition::setTitle ( std::string  value) [virtual]
virtual void csound::Composition::setTonesPerOctave ( double  tonesPerOctave) [virtual]

Sets the number of equally tempered intervals per octave (the default is 12, 0 means non-equally tempered).

virtual void csound::Composition::translateMaster ( ) [virtual]

Convenience function that calls rescaleOutputSoundfile(), translateToCdAudio(), and translateToMp3().

virtual void csound::Composition::translateToCdAudio ( double  levelDb = -3.0) [virtual]

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]

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]

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 void csound::Composition::write ( const char *  text) [virtual]

Write as if to stderr.


Field Documentation

std::string csound::Composition::album [protected]
std::string csound::Composition::artist [protected]
std::string csound::Composition::copyright [protected]
std::string csound::Composition::filename [protected]
std::string csound::Composition::license [protected]
std::string csound::Composition::timestamp [protected]
std::string csound::Composition::title [protected]