// // Programmer: Craig Stuart Sapp // Creation Date: Mon Apr 9 14:01:16 PDT 2001 // Last Modified: Mon May 23 12:13:43 PDT 2005 // Filename: ...sig/examples/all/keyscape3.cpp // Web Address: http://sig.sapp.org/examples/museinfo/humdrum/keyscape3.cpp // Syntax: C++; museinfo // // Description: Generates keyscape pictures of musical input. // Output format is PPM. Use convert file.ppm file.gif // to conver to GIF images. // #include "humdrum.h" // vertical scaling of pictures (linear = triangular; log = curved top) #define SCALE_UNKNOWN (0) #define SCALE_LOG (1) #define SCALE_LINEAR (2) // function declarations void checkOptions (Options &opts, int argc, char* argv[]); void example (void); void usage (const char* command); // command-line options: Options options; // database for command-line arguments typedef struct { int imageWidth, imageHeight; int vscale; int debug; } GlobalValues; GlobalValues g; /////////////////////////////////////////////////////////////////////// // // Default colorings. Indexes into array are in base-40 notation // with C-natural being the first element in the array. // int red[40] = { 0, 9, 18, 0, 63, 63, 63, 73, 82, 0, 218, 237, 255, 255, 255, 255, 255, 255, 218, 182, 0, 45, 54, 63, 63, 63, 0, 109, 118, 127, 145, 164, 0, 255, 255, 255, 255, 255, 73, 36 }; int green[40] = { 255, 246, 237, 0, 123, 109, 95, 86, 77, 0, 9, 4, 0, 18, 36, 218, 237, 255, 255, 255, 0, 209, 200, 191, 177, 164, 0, 50, 41, 31, 27, 22, 0, 91, 109, 127, 145, 164, 255, 255 }; int blue[40] = { 0, 36, 73, 0, 255, 255, 255, 255, 255, 0, 73, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 182, 218, 255, 255, 255, 0, 255, 255, 255, 219, 182, 0, 0, 0, 0, 0, 0, 0, 0 }; // // /////////////////////////////////////////////////////////////////////// int main(int argc, char* argv[]) { g.imageWidth = 1000; // set with -d option g.imageHeight = 500; // set with -d option g.vscale = SCALE_LOG; // set with -l option g.debug = 0; // set with --debug option HumdrumFile infile; // input Humdrum Format file // process the command-line options checkOptions(options, argc, argv); // figure out the number of input files to process int numinputs = options.getArgCount(); Array > matrix; int i; for (i=0; i