// // Programmer: Craig Stuart Sapp // Creation Date: Fri Jul 6 00:19:53 PDT 2001 // Last Modified: Fri Jul 6 00:19:59 PDT 2001 // Filename: ...sig/doc/examples/sig/sigfile/pitch/pitch.cpp // Syntax: C++; sig // // Description: extract the pitch from a soundfile. // #include "sigAudio.h" #include #include #include void checkOptions(Options& opts); void example(void); void usage(const char* command); #define PITCH_HPS 0 #define PITCH_ML 1 // User interfaction variables: int palgorithm = PITCH_HPS; // pitch detection algorithm /////////////////////////////////////////////////////////////////////////// int main(int argc, char* argv[]) { Options options(argc, argv); checkOptions(options); // Elements: SoundFileIn insound(options.getArg(1)); Pitch pitch; // Connections: pitch.connect(insound); switch (palgorithm) { case PITCH_HPS: pitch.doHPS(); break; case PITCH_ML: pitch.doML(); break; default: pitch.doHPS(); } Action action; cout << "**sample\t**sec\t**pitch\t**amp\n"; for (int i=0; i 1) { cout << "Error: too many arguments. Given " << opts.getArgCount() << " but need only 1." << endl; usage(opts.getCommand()); exit(1); } if (opts.getBoolean("HPS")) { palgorithm = PITCH_HPS; } if (opts.getBoolean("ML")) { palgorithm = PITCH_ML; } } ////////////////////////////// // // example -- gives example calls to the osc program. // void example(void) { } ////////////////////////////// // // usage -- how to run the osc program on the command line. // void usage(const char* command) { } // md5sum: 59776da64d137902ea3fe379d36d0b4a pitch.cpp [20050403]