Example #1
0
int main(int argc, char* argv[]) {
	HumdrumFileSet infiles;

	// process the command-line options
	checkOptions(options, argc, argv);

	// figure out the number of input files to process
	int numinputs = options.getArgCount();

	if (numinputs < 1) {
		infiles.read(cin);
	} else {
		for (int i=0; i<numinputs; i++) {
			infiles.readAppend(options.getArg(i+1));
		}
	}

	for (int i=0; i<infiles.getCount(); i++) {
		if (rhythmQ) {
			printKernOutput(infiles[i]);
		} else {
			printOutput(infiles[i]);
		}
	}

	return 0;
}
Example #2
0
int main(int argc, char* argv[]) {
   HumdrumFileSet infiles;
   checkOptions(options, argc, argv);
   infiles.read(options);
   string filename;

   // for now only deal with a single segment:
   processFile(infiles[0]);
   return 0;
}
Example #3
0
int main(int argc, char* argv[]) {
   checkOptions(options, argc, argv);
   HumdrumFileSet infiles;
   infiles.read(options);

   Array<RationalNumber> Bfeatures; // used to extract beat data from input
   Array<RationalNumber> Dfeatures; // used to extract duration data from input
   Array<int>    Blines;            // used to extract beat data from input
   Array<int>    Dlines;            // used to extract duration data from input

   for (int i=0; i<infiles.getCount(); i++) {

      // analyze the input file according to command-line options
      infiles[i].analyzeRhythm(beatbase.data());

      Array<int> tickanalysis;
      tickanalysis.setSize(infiles[i].getNumLines());
      tickanalysis.setAll(0);
      int tickfactor = 1;

      if (tickQ) {
         tickfactor = doTickAnalysis(tickanalysis, infiles[i]);
      }

      if (tpwQ) {
         cout << infiles[i].getMinTimeBase() * tickfactor << endl;
         exit(0);
      } else if (tpqQ) {
         cout << infiles[i].getMinTimeBase() * tickfactor /4.0 << endl;
         exit(0);
      }

      fillAttackArray(infiles[i], Attacks);
      extractBeatFeatures(infiles[i], Blines, Bfeatures);
      if (debugQ) {
         cout << "BEAT FEATURES ====================" << endl;
         for (int ii=0; ii<Bfeatures.getSize(); ii++) {
            cout << Bfeatures[ii].getFloat() << endl;
         }
         cout << "==================================" << endl;
      }
      extractDurFeatures(infiles[i], Dlines, Dfeatures);

      if (Bsearch.getSize() > 0 || Dsearch.getSize() > 0) {
         printSearchResults(infiles[i], Bfeatures, Blines, Dfeatures, Dlines);
      } else {
         printOutput(infiles[i], Bfeatures, Blines, Dfeatures, Dlines, 
               tickanalysis);
      }
   }

   return 0;
}
Example #4
0
int main(int argc, char* argv[]) {
   // process the command-line options
   checkOptions(options, argc, argv);

   HumdrumFileSet infiles;
   infiles.read(options);

   for (int i=0; i<infiles.getCount(); i++) {
      if (autoQ) {
         processFileAuto(infiles[i]);
      } else if (convertQ) {
         processFileConvert(infiles[i]);
      }
   }

   return 0;
}
Example #5
0
int main(int argc, char* argv[]) {
   HumdrumFileSet infiles;

   // process the command-line options
   checkOptions(options, argc, argv);

   string filename = "";
   int i;

   Array<int> pc12;  // twelve-tone pitch-class note histogram
   Array<int> pc40;  // base-40 enharmonic pitch-class note histogram

   pc12.setSize(12);
   pc12.allowGrowth(0);
   pc12.setAll(0);

   pc40.setSize(40);
   pc40.allowGrowth(0);
   pc40.setAll(0);

   int numinputs = options.getArgCount();

   if (numinputs < 1) {
      infiles.read(cin);
   } else {
      for (i=0; i<numinputs; i++) {
         infiles.readAppend(options.getArg(i+1));
      }
   }

   for (i=0; i<infiles.getCount(); i++) {
      if (suppressQ) {
         filename = "";
      } else {
         filename = infiles[i].getFilename();
      }
      analyzeFile(infiles[i], pc12, pc40);
      printAnalysis(infiles[i], pc12, pc40, filename);
   }

   return 0;
}
Example #6
0
int main(int argc, char* argv[]) {
   checkOptions(options, argc, argv);
   HumdrumFileSet infiles;
   infiles.read(options);

   for (int i=0; i<infiles.getCount(); i++) {
      infiles[i].analyzeRhythm("4");
      if (originalQ) {
         getOriginalFactor(infiles[i], factor);
      } else if (alternateQ) {
         getAlternateFactor(infiles[i], factor);
      }

      printOutput(infiles[i], factor);
      if ((!originalQ) && (!FoundRef) && (factor != 1)) {
         cout << "!!!rscale: " << factor << endl;
      }
   }

   return 0;
}
Example #7
0
int main(int argc, char** argv) {
   // process the command-line options
   checkOptions(options, argc, argv);
   HumdrumFileSet infiles;
   // infile.setAllocation(1123123);   // allow for very large inputs up to 
   //                                  // million lines.
   int numinputs = options.getArgumentCount();

   int i;
   if (numinputs < 1) {
      infiles.read(cin);
   } else {
      for (i=0; i<numinputs; i++) {
         infiles.readAppend(options.getArg(i+1));
      }
   }

   for (i=0; i<infiles.getCount(); i++) {
      processFile(infiles[i], infiles.getCount());
   }

   return 0;
}
Example #8
0
int main(int argc, char** argv) {
   checkOptions(options, argc, argv);

   HumdrumFileSet infiles;

   int i, j;
   // figure out the number of input files to process

   infiles.read(options);

   Array<RationalNumber> timebase;
   RationalNumber zeroR(0, 1);
   timebase.setSize(infiles.getCount());
   timebase.setAll(zeroR);
   timebase.allowGrowth(0);
   Array<RationalNumber> rhythms;
   Array<RationalNumber> allrhythms;
   allrhythms.setSize(100);
   allrhythms.setSize(0);
   allrhythms.setGrowth(1000);

   // can't handle standard input yet
   for (i=0; i<infiles.getCount(); i++) {
      infiles[i].analyzeRhythm();
      if (infiles.getCount() > 1) {
         if (pathQ) {
            cout << infiles[i].getFilename() << ":\t";
         } else {
            const char* filename = infiles[i].getFilename().c_str();
            const char* ptr = NULL;
            ptr = strrchr(filename, '/');
            if (ptr != NULL) {
               cout << ++ptr << ":\t";
            } else {
               cout << infiles[i].getFilename() << ":\t";
            }
         }
      }
      if (listQ) {
         infiles[i].getRhythms(rhythms);
         sortArray(rhythms);
         uniqArray(rhythms);
         for (j=0; j<rhythms.getSize(); j++) {
            cout << rhythms[j];
            if (j<rhythms.getSize()-1) {
               cout << " ";
            }
            insertRhythm(allrhythms, rhythms[j]);
         }
	 cout << "\n";
      } else {
         cout << infiles[i].getMinTimeBaseR() << "\n";
      }
      timebase[i] = infiles[i].getMinTimeBaseR();
   }

   if (infiles.getCount() > 1) {
      if (listQ) {
         cout << "all:\t";
         for (j=0; j<allrhythms.getSize(); j++) {
            cout << allrhythms[j];
            if (j < allrhythms.getSize()-1) {
               cout << " ";
            }
         }
	 cout << "\n";
      } else {
         if (infiles.getCount() > 1) {
            cout << "all:\t" << findlcmR(timebase) << endl;
         }
      }
   }
}
Example #9
0
int main(int argc, char* argv[]) {
   HumdrumFileSet infiles;

   majorKey = majorKeyBellman;
   minorKey = minorKeyBellman;

   // process the command-line options
   checkOptions(options, argc, argv);

   // figure out the number of input files to process
   int numinputs = options.getArgCount();

   Array<double> absbeat;
   Array<int>    pitch;
   Array<double> duration;
   Array<double> level;
   Array<double> distribution(12);
   Array<double> scores(24);
   string filename;

   Array<int> b40hist;

   int bestkey = 0;
   int i, j;

   if (numinputs < 1) {
      infiles.read(cin);
   } else {
      for (i=0; i<numinputs; i++) {
         infiles.readAppend(options.getArg(i+1));
      }
   }
  
   for (i=0; i<infiles.getCount(); i++) {
      filename = infiles[i].getFilename();

      if (continuousQ) {
         analyzeContinuously(infiles[i], windowsize, stepsize, majorKey, 
               minorKey);
         continue;
      }

      infiles[i].getNoteArray(absbeat, pitch, duration, level);
      for (j=0; j<pitch.getSize(); j++) {
         pitch[j] = Convert::base40ToMidiNoteNumber(pitch[j]);
      }

      if (rawQ) {
	 if (normalizeQ) { 
            normalizeData(majorKey, 12);
            normalizeData(minorKey, 12);
         }
         bestkey = analyzeKeyRawCorrelation(scores.getBase(), 
               distribution.getBase(), pitch.getBase(), duration.getBase(),
               pitch.getSize(), rhythmQ, majorKey, minorKey);
      } else if (euclideanQ) {
         equalizeData(majorKey, 12, 1.0);
         equalizeData(minorKey, 12, 1.0);
         bestkey = analyzeKeyEuclidean(scores.getBase(), 
               distribution.getBase(), pitch.getBase(), duration.getBase(),
               pitch.getSize(), rhythmQ, majorKey, minorKey);
      } else {
         bestkey = analyzeKeyKS2(scores.getBase(), distribution.getBase(),
               pitch.getBase(), duration.getBase(), pitch.getSize(), rhythmQ,
                     majorKey, minorKey);
      }
      getBase40Histogram(b40hist, infiles[i]);
      printAnalysis(bestkey, scores, distribution, filename, b40hist, 
            infiles[i]);
   }

   return 0;
}