🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.pl.comp.lang.csharp
Article #21857

Re: Example tutorial of Frequency/tone generator in csharp tia sal22

#21857
From: Willem van Rumpt
Date: Fri, 03 Dec 2010 20:08
21 lines
2086 bytes
On 03-Dec-10 18:54, ratullloch_delthis wrote:
> 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.

-- 
Willem van Rumpt
Technical Details
Message-ID: <4cf94e3f$0$8914$703f8584@textnews.kpn.nl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!goblin1!goblin.stu.neva.ru!eweka.nl!hq-usenetpeers.eweka.nl!193.201.147.68.MISMATCH!feeder.news-service.com!pfeed08.wxs.nl!newsfeed.kpn.net!pfeed14.wxs.nl!pfeed15.wxs.nl!not-for-mail
References: <f9aKo.438890$pX3.23680@en-nntp-11.dc1.easynews.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!goblin1!goblin.stu.neva.ru!eweka.nl!hq-usenetpeers.eweka.nl!193.201.147.68.MISMATCH!feeder.news-service.com!pfeed08.wxs.nl!newsfeed.kpn.net!pfeed14.wxs.nl!pfeed15.wxs.nl!not-for-mail
Date: Fri, 03 Dec 2010 21:08:33 +0100
From: Willem van Rumpt <w@v.r>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.12) Gecko/20101027 Thunderbird/3.1.6
MIME-Version: 1.0
Newsgroups: microsoft.public.dotnet.languages.csharp,alt.pl.comp.lang.csharp
Subject: Re: Example tutorial of Frequency/tone generator in csharp tia sal22
References: <f9aKo.438890$pX3.23680@en-nntp-11.dc1.easynews.com>
In-Reply-To: <f9aKo.438890$pX3.23680@en-nntp-11.dc1.easynews.com>
Lines: 21
Message-ID: <4cf94e3f$0$8914$703f8584@textnews.kpn.nl>
NNTP-Posting-Host: 80.61.202.141
X-Trace: 1291406911 textnews.kpn.nl 8914 80.61.202.141:56197
X-Complaints-To: abuse@planet.nl
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit