// // Programmer: Craig Stuart Sapp // Creation Date: Sun May 20 16:30:59 PDT 2001 // Last Modified: Sun May 20 16:31:02 PDT 2001 // Filename: ...sig/examples/all/markana.cpp // Web Address: http://sig.sapp.org/examples/museinfo/humdrum/markana.cpp // Syntax: C++; museinfo // // Description: Measure the root of a previously marked region of music. // #include "humdrum.h" #include #include // function declarations void checkOptions (Options& opts, int argc, char* argv[]); void example (void); void usage (const char* command); void printAnalysis (HumdrumFile& infile, Array& givenrootanalysis, Array& durations, Array& automaticrootanalysis, Array& rootscores); void generateAnalysis (HumdrumFile& infile, Array& givenrootanalysis, Array& durations, Array& automaticrootanalysis, Array& rootscores); void printErrors (Array& given, Array& automatic); // 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 errorQ = 0; // used with the -e option double delta = -4; // used with the --delta option double lambda = -3; // used with the --lambda option double alpha = 0.578; // used with the --alpha option int weightsQ = 0; // used with the -w option int octave = 3; // used with the --octave option int algorithm = 0; // used with the --algorithm option Array parameters; // used with --alpha, --delta, --lambda /////////////////////////////////////////////////////////////////////////// int main(int argc, char* argv[]) { HumdrumFile infile; // process the command-line options checkOptions(options, argc, argv); // figure out the number of input files to process int numinputs = options.getArgCount(); Array automaticrootanalysis; Array givenrootanalysis; Array rootscores; Array durations; for (int i=0; i& given, Array& automatic) { int i; char buffer[64] = {0}; for (i=0; i& given, Array& durations, Array& automatic, Array& rootscores) { char buffer[64] = {0}; int i; for (i=0; i& givenrootanalysis, Array& durations, Array& automaticrootanalysis, Array& rootscores) { infile.analyzeRhythm("4"); // force the beat to be quarter notes for now automaticrootanalysis.setSize(infile.getNumLines()); durations.setSize(infile.getNumLines()); givenrootanalysis.setSize(infile.getNumLines()); rootscores.setSize(infile.getNumLines()); automaticrootanalysis.allowGrowth(0); durations.allowGrowth(0); givenrootanalysis.allowGrowth(0); rootscores.allowGrowth(0); automaticrootanalysis.setAll(-1); givenrootanalysis.setAll(-1); durations.setAll(-1); rootscores.setAll(-1); Array scores(40); int i, j; int spines; for (i=0; i