Example #1
0
int main(int argc, char** argv) {
   if (argc > 2) {
      cout << "Usage: " << argv[0] << " input-file" << endl;
      exit(1);
   }

   HumdrumFile hfile;
   if (argc == 2) {
      hfile.read(argv[1]);
   } else if (argc == 1) {
      hfile.read(cin);
   }
   
   hfile.analyzeRhythm("4", DEBUG);

   int measure = 0;

   cout << "absbeat\tdur\tbeat\tmeasure\t::\tdata\n";
   cout << ":::::::::::::::::::::::::::::::::::::::::::::::::::::\n";
   for (int i=0; i<hfile.getNumLines(); i++) {
      if (hfile[i].isMeasure()) {
         sscanf(hfile[i][0], "=%d", &measure);
      }
      cout << hfile.getAbsBeat(i) << '\t'
           << hfile.getDuration(i) << '\t'
           << measure << '\t'
           << hfile.getBeat(i) << "\t::\t"
           << hfile.getLine(i) << endl;
   }

   return 0;
}
Example #2
0
int doAnalysis(HumdrumFile& infile, int line) {
   int value = 0.0;

   if (nograceQ && (infile[line].getDuration() == 0.0)) {
      return -1;
   }
   if (uniqueQ || noteQ || twelveQ || fortyQ || sevenQ) {
      value = getNoteCount(infile, line); 
   } else {
      value = getVoiceCount(infile, line);
   }
   if (summaryQ) {
      Summary[value] += infile.getDuration(line);
   }
   return value;
}