Difference between revisions of "Humdrum Extras"

From CCARH Wiki
Jump to navigation Jump to search
Line 8: Line 8:
 
Documentation for example programs can be found on the web at [http://extras.humdrum.org/man extras.humdrum.org/man].  The source code for these programs is found in the [http://extras.humdrum.org/download download] file, within the <tt>src-programs</tt> directory, or they can be viewed [http://extras.humdrum.org/download/humextra online].
 
Documentation for example programs can be found on the web at [http://extras.humdrum.org/man extras.humdrum.org/man].  The source code for these programs is found in the [http://extras.humdrum.org/download download] file, within the <tt>src-programs</tt> directory, or they can be viewed [http://extras.humdrum.org/download/humextra online].
  
== Programming Examples ==
+
= Programming Examples =
  
 +
== humecho ==
 
<!-- Syntax Highlighter defaults -->
 
<!-- Syntax Highlighter defaults -->
 
<!-- http://alexgorbatchev.com/SyntaxHighlighter/manual/configuration/ -->
 
<!-- http://alexgorbatchev.com/SyntaxHighlighter/manual/configuration/ -->

Revision as of 03:35, 7 December 2012

Humdrum Extras is a set of command-line programs and C++ parser library for processing Humdrum files. The programs can be compiled for Linux, Apple OS X, or Windows (primarily within cygwin, but also in Visual C++). The Humdrum Extras library can be used to parse Humdrum files independent of the example programs provided with the package.


Example Programs

The primary intent of the Humdrum Extras package is to all for user-based processing of Humdrum files as an auxiliary to the Humdrum Toolkit. Since the programs are compiled from C++, they perform music faster than programs written in interpreted languages, such as AWK which is the main development language for the Humdrum Toolkit.

Documentation for example programs can be found on the web at extras.humdrum.org/man. The source code for these programs is found in the download file, within the src-programs directory, or they can be viewed online.

Programming Examples

humecho

Here is a very simple C++ program called humecho.cpp that uses the Humdrum file parser in the Humdrum Extras library:

#include "humdrum.h"
#include <iostream>

int main(int argc, char** argv) {
   HumdrumFile hfile;
   if (argc > 1) hfile.read(argv[1]);
   else hfile.read(std::cin);
   std::cout << hfile;
   return 0;
}