// // Programmer: Craig Stuart Sapp // Creation Date: Thu Jun 12 21:08:27 GMT-0800 1997 // Last Modified: Thu Jun 12 21:08:30 GMT-0800 1997 // Filename: ...sig/doc/examples/sig/sigfile/additive/additive.cpp // Syntax: C++; sig // // Description: makes a soundfile with the specified moveable // frequency/cycles sinewave // #include "sigAudio.h" #ifndef OLDCPP #include using namespace std; #else #include #endif void exitUsage(const char* command); int main(int argc, char* argv[]) { if (argc < 4) exitUsage(argv[0]); float duration; cout << "How many seconds does the sound last: "; cin >> duration; int numSamples; numSamples = (int)(duration * 44100 + 0.5); SoundHeader header; header.setHighMono(); int numOsc = (argc - 2)/2; // Elements: Osc oscillator[numOsc]; SoundFileOut outsound(argv[argc-1], header); Envelope freqEnv[numOsc]; Envelope ampEnv[numOsc]; Add add; // Connections: for (int i=0; i