Beispiel #1
0
int main(int argc, char* argv[]) {
   HumdrumFile    infile;
   Array<double>  timings;
   Array<double>  tempo;

   // 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<numinputs || i==0; i++) {
      infile.clear();

      // if no command-line arguments read data file from standard input
      if (numinputs < 1) {
         infile.read(cin);
      } else {
         infile.read(options.getArg(i+1));
      }

      analyzeTiming(infile, timings, tempo);
      generateSwing(infile, timings, percentage);
      printAnalysis(infile, timings, tempo);
   }

   return 0;
}
Beispiel #2
0
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<double> values;
   values.setSize(0);

   Array<double> midibins;
   midibins.setSize(128);
   midibins.setAll(0);
   midibins.allowGrowth(0);

   for (int i=0; i<numinputs || i==0; i++) {
      infile.clear();

      // if no command-line arguments read data file from standard input
      if (numinputs < 1) {
         infile.read(cin);
      } else {
         infile.read(options.getArg(i+1));
      }

      generateAnalysis(infile, midibins);
   }

   printAnalysis(midibins);

   return 0;
}
  bool ProgramAnalysis :: runOnModule(Module &M)
    {
        PI = &getAnalysis<ProfileInfo>();
      //Code to set the Hot trace pointer for the Function ; MergeBlocks ; Function
        HOTTRACEBLOCKCOUNT = -1;
        MERGEBLOCKCOUNT = -1;
      for (Module::iterator i = M.begin(), e = M.end(); i!=e; ++i )
        {
         if(i->isDeclaration())
          continue;
         AnalyseFunction(*i);
         FUNCTIONCOUNT++;

         HOTTRACEBLOCKCOUNT += HotTraceCounter;
         HotTraceLink.push_back(HOTTRACEBLOCKCOUNT);
         MERGEBLOCKCOUNT += MergeCounter;
         MergeBlockLink.push_back(MERGEBLOCKCOUNT);

        }
      // Save things to a File ; Things to be saved: vectors: MergeBlocks && HotTrace
      // Vectors: BasicBlock Link; MergeBlock Link
      //Two files created: arrays stores HotTrace and MergeBlocks, seperated by Commas
      // Each is separated by \n
      // HotTrace and MergeBlocks are Seperated by --
      FILE *fhottrace,*fmerge,*fhotlink,*fmergelink;
      if((fhottrace=fopen("hottrace", "w"))==NULL)
        printf("Cannot open file hottrace for reading.\n");
      if((fmerge=fopen("merge", "w"))==NULL)
        printf("Cannot open file merge for reading.\n");
      if((fhotlink=fopen("hotlinks", "w"))==NULL)
        printf("Cannot open file hotlink for reading.\n");
      if((fmergelink=fopen("mergelinks", "w"))==NULL)
        printf("Cannot open file mergelink for reading.\n");

      for(int i=0; i<(int)HotTrace.size();i++)
         fprintf(fhottrace, "%s\n", (HotTrace.at(i)->getName()));
      for(int i=0; i<(int)MergeBlocks.size();i++)
         fprintf(fmerge, "%s\n", (MergeBlocks.at(i)->getName()));
      for(int i=0; i<(int)HotTraceLink.size();i++)
         fprintf(fhotlink, "%d\n", HotTraceLink.at(i));
      for(int i=0; i<(int)MergeBlockLink.size();i++)
         fprintf(fmergelink, "%d\n", MergeBlockLink.at(i));


        printAnalysis();
      //Code to set the Hot trace pointer for the Function ; MergeBlocks ; Function End Pointers
      return false;
    }
Beispiel #4
0
int main(int argc, char* argv[]) {
   HumdrumFile    infile;
   Array<double>  timings;
   Array<double>  tempo;

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

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

   double totaldur = 0.0;

   for (int i=0; i<numinputs || i==0; i++) {
      infile.clear();

      // if no command-line arguments read data file from standard input
      if (numinputs < 1) {
         infile.read(cin);
      } else {
         infile.read(options.getArg(i+1));
      }

      if (interpQ) {
         doLinearInterpolation(infile);
      } else {
         analyzeTiming(infile, timings, tempo);
         if (totalQ) {
            totaldur += timings[timings.getSize()-1];
            if (numinputs > 1) {
               printtime(options.getArg(i+1), timings[timings.getSize()-1]);
            }
         } else {
            printAnalysis(infile, timings, tempo);
         }
      }
   }
   if (totalQ) {
      printtime("", totaldur);
   }

   return 0;
}
Beispiel #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;
}
Beispiel #6
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;
}