[music-dsp] Tone Generation in C

Ralph Baertschi bar at crow-ten.ch
Wed Nov 6 08:09:40 EST 2002


The most difficult part for a beginner is the system part. You must decide
whether
to put the tone in real-time on what kind of driver or to put it into a
sound-file.
Maybe try to use for these the portaudio-library.

To actually generate a tone is much more easy. For example a sin-tone of feq
f
at a sample rate sr you have the inner loop.

inc=2*Pi*f/sr;
for(int j=0;j<size;j++){
    out[j]=amplitude * sin(ph);
    ph+=inc;
    }

********Ralph Bärtschi***********


dupswapdrop -- the music-dsp mailing list and website: subscription info,
FAQ, source code archive, list archive, book reviews, dsp links
http://shoko.calarts.edu/musicdsp/




More information about the music-dsp mailing list