// sineosc.cpp STK tutorial program #include "FileWvOut.h" #include "SineWave.h" using namespace stk; int main() { // Set the global sample rate before creating class instances. Stk::setSampleRate( 44100.0 ); int nFrames = 100000; SineWave input; input.setFrequency( 440.0 ); FileWvOut output; try { // Open a 16-bit, one-channel WAV formatted output file output.openFile( "hellosine.wav", 1, FileWrite::FILE_WAV, Stk::STK_SINT16 ); } catch ( StkError & ) { exit(0); } // Single-sample computations for ( int i=0; i<nFrames; i++ ) { try { output.tick( input.tick() ); } catch ( StkError & ) { exit( 1 ); } } return 0; }
![]() | ©2004-2024 McGill University. All Rights Reserved. Maintained by Gary P. Scavone. |