Example #1
0
int main(int argc, char** argv) {
   if (argc != 2) {
      return 1;
   }
   HumdrumFile infile;
   if (!infile.read(argv[1])) {
      return 1;
   }
   // print line parameters:
   cout << "Global parameters in file:" << endl;
   for (int i=0; i<infile.getLineCount(); i++) {
      if (infile[i].hasParameters()) {
         cout << (HumHash)infile[i];
      }
   }

   cout << "Local parameters in file:" << endl;
   for (int i=0; i<infile.getLineCount(); i++) {
      for (int j=0; j<infile[i].getTokenCount(); j++) {
         if (infile[i].token(j).hasParameters()) {
            cout << (HumHash)infile[i].token(j);
         }
      }
   }

   return 0;
}
Example #2
0
int main(int argc, char** argv) {
   if (argc != 2) {
      return 1;
   }
   HumdrumFile infile;
   if (!infile.read(argv[1])) {
      return 1;
   }
   int tpq = infile.tpq();
   cout << "TPQ: " << tpq << endl;
   cout << "PITCH\tTRACK\tSTART\tDURATION" << endl;

   for (int i=0; i<infile.getLineCount(); i++) {
      if (!infile[i].isData()) {
         continue;
      }
      for (int j=0; j<infile[i].getTokenCount(); j++) {
         if (infile.token(i, j).isNull()) {
            continue;
         }
         if (infile.token(i, j).isDataType("kern")) {
            printNoteInformation(infile, i, j, tpq);
         }
      }
   }
   return 0;
}
Example #3
0
void GridMeasure::appendInitialBarline(HumdrumFile& infile) {
	if (infile.getLineCount() == 0) {
		// strange case which should never happen.
		return;
	}
	int fieldcount = infile.back()->getFieldCount();
	HumdrumLine* line = new HumdrumLine;
	HTp token;
	for (int i=0; i<fieldcount; i++) {
		token = new HumdrumToken("=1-");
		line->appendToken(token);
	}
	infile.push_back(line);
}
Example #4
0
int main(int argc, char** argv) {

    // handle command-line options:
    Options opts;
    opts.define("r|raw=b",        "print raw grid");
    opts.define("d|diatonic=b",   "print diatonic grid");
    opts.define("m|midi-pitch=b", "print midie-pitch grid");
    opts.define("b|base-40=b",    "print base-40 grid");
    opts.define("l|metric-levels=b", "use metric levels in analysis");
    opts.define("k|kern=b",       "print kern pitch grid");
    opts.define("debug=b",        "print grid cell information");
    opts.define("B=b",  		      "use second algorithm");
    opts.process(argc, argv);
    if (opts.getBoolean("B")) {
        Algorithm = 'B';
    }
    levelsQ = opts.getBoolean("metric-levels");

    // read an inputfile from the first filename argument, or standard input
    HumdrumFile infile;
    if (opts.getArgCount() > 0) {
        infile.read(opts.getArgument(1));
    } else {
        infile.read(cin);
    }

    NoteGrid grid(infile);

    if (opts.getBoolean("debug")) {
        grid.printGridInfo(cerr);
        // return 0;
    } else if (opts.getBoolean("raw")) {
        grid.printRawGrid(cout);
        return 0;
    } else if (opts.getBoolean("diatonic")) {
        grid.printDiatonicGrid(cout);
        return 0;
    } else if (opts.getBoolean("midi-pitch")) {
        grid.printMidiGrid(cout);
        return 0;
    } else if (opts.getBoolean("base-40")) {
        grid.printBase40Grid(cout);
        return 0;
    } else if (opts.getBoolean("kern")) {
        grid.printKernGrid(cout);
        return 0;
    }

    vector<vector<string> > results;

    results.resize(grid.getVoiceCount());
    for (int i=0; i<(int)results.size(); i++) {
        results[i].resize(infile.getLineCount());
    }
    doAnalysis(results, grid, opts.getBoolean("debug"));

    vector<HTp> kernspines = infile.getKernSpineStartList();
    infile.appendDataSpine(results.back());
    for (int i = (int)results.size()-1; i>0; i--) {
        int track = kernspines[i]->getTrack();
        infile.insertDataSpineBefore(track, results[i-1]);
    }
    cout << infile;

    return 0;
}