// // Programmer: Craig Stuart Sapp // Creation Date: Tue May 22 12:20:05 PDT 2001 // Last Modified: Tue May 22 12:20:08 PDT 2001 // Filename: ...sig/doc/examples/sig/sigfile/henonsnd/henonsnd.cpp // Syntax: C++; sig // // Description: Generates Henon sequence for hearing by applying // a filter to held values of the sequence. // #include "sigAudio.h" void checkOptions (Options& opts, int argc, char* argv[]); void example (void); void usage (const char* command); double henonseq (double a, double b); // Option values Options options; double amp; // used with the -amp option double k; // used with the -k option double a; // used with the -a option double b; // used with the -b option double xstart; // used with the -x option double ystart; // used with the -y option int hrate; // used with the -r option /////////////////////////////////////////////////////////////////////////// int main(int argc, char* argv[]) { checkOptions(options, argc, argv); // determine how many samples in the output based on the duration int numSamples; if (options.getInt("samples") > 0) { numSamples = options.getInt("samples"); } else { numSamples = (int)(options.getDouble("duration") * 44100 + 0.5); } // prepare for a monophonic output file SoundHeader header; header.setHighMono(); // Elements: Constant henoninput; Smoother smoother(k); DCBlock nodc; Scale scale(amp); SoundFileOut outsound(options.getArg(1), header); // Connections: smoother.connect(henoninput, 0); nodc.connect(smoother); scale.connect(nodc); outsound.connect(scale); for (int i=0; i 1) { cout << "Error: too many arguments. Given " << opts.getArgCount() << " but need only 1." << endl; usage(opts.getCommand()); exit(1); } hrate = opts.getInteger("rate"); k = opts.getDouble("k"); amp = opts.getDouble("amp"); a = opts.getDouble("alpha"); b = opts.getDouble("beta"); xstart = opts.getDouble("x"); ystart = opts.getDouble("y"); } ////////////////////////////// // // example -- gives example calls to the osc program. // void example(void) { cout << "# henonsnd examples: \n" << endl; } ////////////////////////////// // // usage -- how to run the osc program on the command line. // void usage(const char* command) { cout << " \n" "Creates an audio rate version of the henon sequence. \n" " \n" "Usage: " << command << " [-d duration] outsound \n" " \n" "Options: \n" " -d = duration of the oscillator in seconds (default 1.0). \n" " -s = duration in samples. Overrides the -d option (default null) \n" " --options = list of all options, aliases and default values. \n" " \n" " \n" << endl; } // md5sum: 8631f350f793e91aafa180b3be41ff76 henonsnd.cpp [20050403]