#include "soundfile.h" int main(int argc, char** argv) { Options options; options.define("a|amplitude=d:0.1", "amplitude of output sound"); options.define("d|duration=d:1.0", "duration of output sound (seconds)"); options.define("c|channels=i:1", "number of channels in output sound"); options.define("r|sample-rate=i:44100","set the sample rate of the output"); options.process(argc, argv); if (options.getArgCount() != 1) { cout << "Usage: " << options.getCommand() << " [-a amp][-d dur][-c chan][-r srate] file.wav" << endl; exit(1); } int sampleCount = (int)(44100 * options.getDouble("duration") + 0.5); int channels = 1; int srate = options.getInteger("sample-rate"); double amplitude = options.getDouble("amplitude"); const char* filename = options.getArg(1); SoundHeader header; header.setChannels(channels); header.setSrate(srate); SoundFileWrite soundfile(filename, header); int i; double sample = 0.0; for (i=0; i