On Mon, 03 Dec 2007 19:45:12 -0800, Slickuser <sl*********@gm ail.com>
wrote:
I got beeping now. Is it possible to output a note like that?
Thanks.
I don't believe that .NET has any built-in API to do anything like that.
The closest you could come is the SoundPlayer, and all that will do is
play a fixed WAV file. You can create the WAV format file in memory as a
MemoryStream, but you have to have the complete data ahead of time so that
the header of the WAV data is properly initialized.
I suppose if that's sufficient, then you could in fact do it that way.
Obviously if you know in advance which notes you want to play, you could
do that. But then, if you knew the notes far enough in advance, you could
just create the necessary WAV file and include it as a resource in your
application. :)
As for alternatives, even in Win32 I'm not aware of a tone-generator type
API that would take a frequency and play a note. However, it's not
difficult to generate the necessary wave forms and play them through a
streaming API. You can use either DirectSound or the WinMM API for that.
Pete