Article View: alt.pl.comp.lang.csharp
Article #21855Re: Example tutorial of Frequency/tone generator in csharp tia sal22
From: Peter Duniho
Date: Fri, 03 Dec 2010 18:32
Date: Fri, 03 Dec 2010 18:32
30 lines
3180 bytes
3180 bytes
On 12/3/10 9:54 AM, 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 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. While not really directly relevant to this newsgroup, I will mention that alternative solutions would involve using the unmanaged Windows API to accomplish what you want. You can use the WinMM, DirectSound, or DirectShow APIs to do this. DirectSound is the most directly applicable and modern API of those three, but I'm not sure whether there's already a good managed library that supports that API. I know there's the DirectShow.NET library that's been around for awhile, so in spite of it not being specifically for audio support, it might be an easier thing to get working. The DirectSound API is more like the Java API you've already been told about (and WinMM isn't much different either), whereas with the DirectShow API you would likely wind up writing an audio source filter that pushes samples through the filter graph to be rendered by an audio renderer. Pete
Technical Details
Message-ID:
<lOadnXF-W7heqmTRnZ2dnUVZ_uudnZ2d@posted.palinacquisition>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.glorb.com!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.posted.palinacquisition!news.posted.palinacquisition.POSTED!not-for-mailReferences:
<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!news.glorb.com!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.posted.palinacquisition!news.posted.palinacquisition.POSTED!not-for-mail NNTP-Posting-Date: Fri, 03 Dec 2010 12:32:35 -0600 Date: Fri, 03 Dec 2010 10:32:34 -0800 From: Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; 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> Message-ID: <lOadnXF-W7heqmTRnZ2dnUVZ_uudnZ2d@posted.palinacquisition> Lines: 30 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 71.164.23.111 X-Trace: sv3-7VVKdo+rb9VlJpxpRzh9t66g0cy7crGCQ5qxFfZPR7HdZoEBNSg4aP30vmjz1uUN8vhVjcG9tKL0T5d!ECRjRrQEHJ4acBLCda1I6HmnjO2owPPZM79GDjeDCogYvvAbdQBeYXp2qDa+PbH9GxnHrgKHGCZJ!CD5bUrUYPZRAQx/3OuC1EpY13N9GdXLYY9lp0kettR4= X-Complaints-To: abuse@iinet.com X-DMCA-Complaints-To: abuse@iinet.com X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2992 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit