// // Programmer: Craig Stuart Sapp // Creation Date: Mon Nov 20 16:12:43 PST 2000 // Last Modified: Mon Nov 20 16:12:46 PST 2000 // Filename: ...sig/examples/all/maxent.cpp // Web Address: http://sig.sapp.org/examples/museinfo/humdrum/maxent.cpp // Syntax: C++; museinfo // // Description: determination of metrical accentuation through rules given // by John Maxwell in: // // Reference: "An Expert System for Harmonizing Analysis of Tonal // Music." pp 335-353 in: "Understanding Music with AI: // Perspectives on Music Cognition." Ed. by Mira Balaban, // Kemal Ebcioglu, and Otto Laske. MIT Press; 1992. // [ISBN 0-262-52170-9] // #include "humdrum.h" #include #include #include // function declarations void checkOptions (Options& opts, int argc, char* argv[]); void example (void); void generateAnalysis (HumdrumFile& infile, Array& maxent); int measureAccentuation (HumdrumFile& infile, int line); void printAnalysis (HumdrumFile& infile, Array& accentuation); void usage (const char* command); // global variables Options options; // database for command-line arguments int debugQ = 0; // used with the --debug option int appendQ = 0; // used with the -a option int compoundQ = 1; // used with the -c option // variables for keeping track of the change in meter during the score: int metercount = 4; int meterbase = 4; /////////////////////////////////////////////////////////////////////////// int main(int argc, char* argv[]) { HumdrumFile infile; Array accentuation; // process the command-line options checkOptions(options, argc, argv); // figure out the number of input files to process int numinputs = options.getArgCount(); for (int i=0; i& accentuation) { accentuation.setSize(infile.getNumLines()); infile.analyzeRhythm(); int i, j; for (i=0; i 0.999) { fraction = 0; beat++; } if (fraction == 0) { return ACCENT_YES; } else { return ACCENT_NO; } } ////////////////////////////// // // printAnalysis -- // void printAnalysis(HumdrumFile& infile, Array& accentuation) { int i; if (appendQ) { for (i=0; i