Example tutorial of Frequency/tone generator in csharp tia sal22

  • Thread starter ratullloch_delthis
  • Start date
R

ratullloch_delthis

Greetings all
I'm trying to find a tutorial that shows me how to make a Frequency/tone generator in Csharp (C#)
Example I would like to have a slider that changes the value of x for the formula y=sin(x) so if the slider is moved
to 440 it would play a 440hz sin wave out the speaker does such a tutorial exist if so can someone post a link to it
tia sal22
 
J

Jeff Johnson

Unlike Java (i.e. the previous language for which you asked this exact
same question), there is no sample-level audio API support in .NET. The
closest you can come is to play pre-generated media files (e.g. .wav).
See, for example, System.Media.SoundPlayer.

I added some audio capability to an app of mine using Bass
(http://www.un4seen.com/).

"BASS is an audio library for use in Windows and Mac OSX software. Its
purpose is to provide developers with powerful and efficient sample, stream
(MP3, MP2, MP1, OGG, WAV, AIFF, custom generated, and more via add-ons), MOD
music (XM, IT, S3M, MOD, MTM, UMX), MO3 music (MP3/OGG compressed MODs), and
recording functions."
 
W

Willem van Rumpt

Greetings all
I'm trying to find a tutorial that shows me how to make a Frequency/tone generator in Csharp (C#)
Example I would like to have a slider that changes the value of x for the formula y=sin(x) so if the slider is moved
to 440 it would play a 440hz sin wave out the speaker does such a tutorial exist if so can someone post a link to it
tia sal22

Take a look at NAudio (http://naudio.codeplex.com/), it might offer what
you need. If you're developing for Silverlight, then, starting from v3 I
think, MediaElement allows a MediaStreamSource descendant as its source.
The descendant class is responsible for streaming the data in a format
known to MediaElement to a stream, in chuncks of generated samples.

There may be lag and buffer issues when building a
"on-the-fly-immediate-response" kind of application, but in general, it
works very, very well. I don't have links handy, but google
MediaStreamSource, and you're bound to find some useful examples.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top