// // Programmer: Craig Stuart Sapp // Creation Date: Tue Jul 7 22:29:32 PDT 1998 // Last Modified: Tue Jul 7 22:29:36 PDT 1998 // Filename: ...sig/examples/all/ana.cpp // Web Address: http://sig.sapp.org/examples/museinfo/humdrum/ana.cpp // Syntax: C++; museinfo // // Description: Generates and ESAC-like analysis summary of melodic lines. // #include "humdrum.h" #include #include #include #include #include #include #include #include using namespace std; // function declarations void checkOptions (Options& opts, int argc, char* argv[]); void example (void); void processRecords (HumdrumFile& infile); void usage (const string& command); int getSum (vector& values, int minn, int maxx); int getSum (vector& values); // global variables Options options; // database for command-line arguments /////////////////////////////////////////////////////////////////////////// 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(); for (int i=0; i pitches(300, 0); vector intervals(300, 0); vector breakIntervals(300, 0); vector phraseEndings; for (int i=0; i=0; j--) { if (intervals[j] != 0) { cout << Convert::intervalNames.getName(-(j-80)) << ":" << intervals[j] << " "; } } cout << "\n pi-unisons: " << intervals[80]; cout << "\n pi-up: " << getSum(intervals, 81, 200) << " "; for (int j=81; j<80+80; j++) { if (intervals[j] != 0) { cout << Convert::intervalNames.getName(j-80) << ":" << intervals[j] << " "; } } cout << endl; cout << "phrase boundary intervals : " << getSum(breakIntervals) << endl; cout << " pbi-down: " << getSum(breakIntervals, 1, 79) << " "; for (int j=79; j>=0; j--) { if (breakIntervals[j] != 0) { cout << Convert::intervalNames.getName(-(j-80)) << ":" << breakIntervals[j] << " "; } } cout << "\n pbi-unisons: " << breakIntervals[80]; cout << "\n pbi-up: " << getSum(breakIntervals, 81, 200) << " "; for (int j=81; j<80+80; j++) { if (breakIntervals[j] != 0) { cout << Convert::intervalNames.getName(j-80) << ":" << breakIntervals[j] << " "; } } cout << endl; /// phrase information cout << "Bar count: " << barCount << endl; cout << "Phrase count: " << phraseCount << endl; cout << "Phrase endings: "; for (int j=0; j<(int)phraseEndings.size(); j++) { cout << Convert::base40ToKern(aString, phraseEndings[j]); if (j != (int)phraseEndings.size()-1) { cout << ", "; } } cout << endl; } ////////////////////////////// // // getSum -- // int getSum(vector& values) { int sum = 0; for (int i=0; i<(int)values.size(); i++) { sum += values[i]; } return sum; } int getSum(vector& values, int minn, int maxx) { int sum = 0; for (int i=minn; i