tag:blogger.com,1999:blog-6822536077160579260.comments2023-06-05T14:25:52.227+01:00Sound CodeAnonymoushttp://www.blogger.com/profile/17900587357903273800noreply@blogger.comBlogger887125tag:blogger.com,1999:blog-6822536077160579260.post-52107778402966131752014-04-11T23:34:20.857+01:002014-04-11T23:34:20.857+01:00I know this is not what the audio library is for, ...I know this is not what the audio library is for, but any chance you know of a CoreAudio set that is based on SharpDx? It didn't look like it was part of the main set of functionality.Jonhttps://www.blogger.com/profile/09721536267629821809noreply@blogger.comtag:blogger.com,1999:blog-6822536077160579260.post-37645747242869551092014-04-09T15:36:31.554+01:002014-04-09T15:36:31.554+01:00no that I know of. You can in fact use my alternat...no that I know of. You can in fact use my alternative implementation alongside NAudio, so I may go with that solution. <br /><br />I'm hoping to look at getting a version of NAudio for windows phone, maybe when 8.1 comes out as that opens the door to more shared codeAnonymoushttps://www.blogger.com/profile/17900587357903273800noreply@blogger.comtag:blogger.com,1999:blog-6822536077160579260.post-89811221238582382712014-04-09T15:29:37.527+01:002014-04-09T15:29:37.527+01:00How did this work out?
I'm curious, does shar...How did this work out?<br /><br />I'm curious, does sharpdx have any additional dependencies that naudio doesn't? Eg. would this move prevent naudio working on PhoneSilverlight or some other platforms?Lucian Wischikhttp://blogs.msdn.com/luciannoreply@blogger.comtag:blogger.com,1999:blog-6822536077160579260.post-80115306575051600852014-04-05T15:35:36.061+01:002014-04-05T15:35:36.061+01:00Thank you for the post. I have a TFS project that...Thank you for the post. I have a TFS project that was an MVC EF site converted to Azure. I couldn't actually get it to run on my Visual Studio 2013 development environment. I can tell by your examples that the previous developer did what you did. My problem however is that we are moving the website and database off Azure and quite frankly it isn't going well and I believe it's due to blob storage and local development emulators. Anyhow your post is helping me greatly in reverse engineering the solution to non-Azure. Why get off azure you may ask. We are on free trial's for everything except a backup database. The bill for that was 256 for one month. Once the bills for everything else starts kicking in Microsoft will own our business. Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6822536077160579260.post-72506126733112498912014-03-27T11:03:47.614+00:002014-03-27T11:03:47.614+00:00Trying to play sound on both speakers and headset....Trying to play sound on both speakers and headset. I think i am a step away. Here is the sample code :<br /><br /> public void detectDevices()<br /> {<br /> int waveOutDevices = WaveOut.DeviceCount;<br /> switch (waveOutDevices)<br /> {<br /> case 1:<br /> var wave1 = new WaveOut();<br /> wave1.DeviceNumber = 0;<br /> playSound(0); <br /><br /> break;<br /> case 2:<br /> var wave2 = new WaveOut();<br /> wave2.DeviceNumber = 0;<br /> playSound(0);<br /><br /> var wave3 = new WaveOut();<br /> wave3.DeviceNumber = 1;<br /> playSound(1); <br /><br /> break;<br /><br /> }<br /> }<br /><br /> public void playSound(int deviceNumber)<br /> {<br /> disposeWave();// stop previous sounds before starting<br /> waveReader = new NAudio.Wave.WaveFileReader(fileName);<br /> var waveOut = new NAudio.Wave.WaveOut();<br /> waveOut.DeviceNumber = deviceNumber;<br /> output = waveOut;<br /> output.Init(waveReader);<br /> output.Play();<br /> }<br /><br /> public void disposeWave()<br /> {<br /> if (output != null)<br /> {<br /> if (output.PlaybackState == NAudio.Wave.PlaybackState.Playing)<br /> {<br /> output.Stop();<br /> output.Dispose();<br /> output = null;<br /> }<br /> }<br /> if (wave != null)<br /> {<br /> wave.Dispose();<br /> wave = null;<br /> }<br /> }<br /><br />case eSelector.startIncomingRinging:<br /><br /> fileName = ("Ring.wav");<br /> detectDevices();Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6822536077160579260.post-63042610192223274112014-03-25T13:57:24.007+00:002014-03-25T13:57:24.007+00:00I've used NAudio on several projects and it...I've used NAudio on several projects and it's awesome. I'm currently struggling with a requirement that I use the default WPF mediaelement control to play a video, but allow the user to choose the playback device from any active device. Most of the examples I see assume NAudio will be handling both device selection and playback. <br /><br />It seems from most of my research that mediaelement only wants to play on the default device, and that setting the default device programmatically is kept intentionally difficult (understandably so). <br /><br />Is it possible to use NAudio to select the device and have the mediaelement do the playback?<br /><br /><br />JasonBnoreply@blogger.comtag:blogger.com,1999:blog-6822536077160579260.post-31218592312270982882014-03-21T10:12:09.383+00:002014-03-21T10:12:09.383+00:00Once again because in first comment code disappear...Once again because in first comment code disappear. I have to cut"<" <br /><br />Hi,<br />I think that You can also use triggers changing EventName.<br /><br />In Silverlight I use in ListBox.ItemTemplate.DataTemplate:<br /><br />i:Interaction.Triggers><br />i:EventTrigger EventName="MouseLeftButtonDown"> i:InvokeCommandAction Command="{Binding ElementName=Page,Path=DataContext.GoToDetails}" CommandParameter="{Binding}"/><br /><br />/i:EventTrigger><br />/i:Interaction.Triggers><br /><br /><br />where <br />xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"<br /><br />I think that caliburn micro is also usful in doing this in easy way.<br /><br />Regards,<br />MWAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-6822536077160579260.post-72706677018844220052014-03-21T10:04:50.254+00:002014-03-21T10:04:50.254+00:00Hi,
I think that You can also use triggers changin...Hi,<br />I think that You can also use triggers changing EventName.<br /><br />In Silverlight I use in ListBox.ItemTemplate.DataTemplate:<br /><br /> <br /> <br /> <br /> <br /> <br /><br />where <br />xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"<br /><br />I think that caliburn micro is also usful in doing this in easy way.<br /><br />Regards,<br />MWAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-6822536077160579260.post-547718910075604772014-03-09T22:54:15.568+00:002014-03-09T22:54:15.568+00:00instead of a buffer size of 1024, make sure it is ...instead of a buffer size of 1024, make sure it is sized to a multiple of your WaveFormat.BlockAlign.Anonymoushttps://www.blogger.com/profile/17900587357903273800noreply@blogger.comtag:blogger.com,1999:blog-6822536077160579260.post-45479508093192628782014-03-09T22:54:10.311+00:002014-03-09T22:54:10.311+00:00instead of a buffer size of 1024, make sure it is ...instead of a buffer size of 1024, make sure it is sized to a multiple of your WaveFormat.BlockAlign.Anonymoushttps://www.blogger.com/profile/17900587357903273800noreply@blogger.comtag:blogger.com,1999:blog-6822536077160579260.post-40493444007518757032014-03-09T10:50:28.941+00:002014-03-09T10:50:28.941+00:00Getting the "Must read complete blocks" ...Getting the "Must read complete blocks" error. Is this due to selecting a bad TimeSpan; or an oddly formed WAV file. My is 13kbps bitrate. I have 63 bytes left.RelevantAdshttps://www.blogger.com/profile/14649839883617352018noreply@blogger.comtag:blogger.com,1999:blog-6822536077160579260.post-12363881241994547672014-03-09T10:48:56.338+00:002014-03-09T10:48:56.338+00:00Getting the "Must read complete blocks" ...Getting the "Must read complete blocks" error. Is this due to selecting a bad TimeSpan; or an oddly formed WAV file. My is 13kbps bitrate. I have 63 bytes left.RelevantAdshttps://www.blogger.com/profile/14649839883617352018noreply@blogger.comtag:blogger.com,1999:blog-6822536077160579260.post-37601272916728529852014-03-06T18:09:06.983+00:002014-03-06T18:09:06.983+00:00@Dan, cool, I haven't used that before. I'...@Dan, cool, I haven't used that before. I'll have a play with itAnonymoushttps://www.blogger.com/profile/17900587357903273800noreply@blogger.comtag:blogger.com,1999:blog-6822536077160579260.post-55890087670657044962014-03-06T17:30:57.778+00:002014-03-06T17:30:57.778+00:00One thing missing from .Net that Python has is a g...One thing missing from .Net that Python has is a generator's <a href="http://docs.python.org/2/reference/expressions.html#generator.send" rel="nofollow">send</a> method. It allows you to write values back into the method at the point you yielded. It's a bit less useful in statically typed languages since you have to decide between being able to send in one type or losing out on some compile time checking.Dannoreply@blogger.comtag:blogger.com,1999:blog-6822536077160579260.post-1584802059847356582014-03-04T14:37:09.636+00:002014-03-04T14:37:09.636+00:00yes, but create a separate file reader for each de...yes, but create a separate file reader for each device, otherwise the sound will end up being sliced up and played partly out of each deviceAnonymoushttps://www.blogger.com/profile/17900587357903273800noreply@blogger.comtag:blogger.com,1999:blog-6822536077160579260.post-49851191035750445042014-03-04T14:03:44.125+00:002014-03-04T14:03:44.125+00:00Hi Mark ! Kudos on the great post !
I am trying to...Hi Mark ! Kudos on the great post !<br />I am trying to use Naudio to play sound on both speakers and headset (when plugged). Do you think that will work ? Appreciate your comment.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6822536077160579260.post-65053168201044971452014-03-04T14:01:54.834+00:002014-03-04T14:01:54.834+00:00Hi mark !
Kudos on the great post !! I am trying t...Hi mark !<br />Kudos on the great post !! I am trying to use Naudio to play sound in both speakers and headsets (when plugged in) at the same time, by giving the same wave file to different output devices. Do you think that will work ? Appreciate your help !Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6822536077160579260.post-36247476102509581192014-02-24T08:18:47.223+00:002014-02-24T08:18:47.223+00:00thanks Jonathan, good spotthanks Jonathan, good spotAnonymoushttps://www.blogger.com/profile/17900587357903273800noreply@blogger.comtag:blogger.com,1999:blog-6822536077160579260.post-25536330854625950622014-02-20T22:06:37.958+00:002014-02-20T22:06:37.958+00:00Presumably you meant 'AudioPlaybackEngine.*...Presumably you meant 'AudioPlaybackEngine.*' not 'AudioFileEngine.*' in the usage snippets?<br /><br />Thanks ever so much for the guide!Jonathannoreply@blogger.comtag:blogger.com,1999:blog-6822536077160579260.post-79804896648750275052014-02-20T21:03:54.052+00:002014-02-20T21:03:54.052+00:00Presumably in the usage snippets you meant 'Au...Presumably in the usage snippets you meant 'AudioPlaybackEngine...' not 'AudioFileEngine...'? <br /><br />Cheers and thanks for this guide on event triggered audio!Jonathannoreply@blogger.comtag:blogger.com,1999:blog-6822536077160579260.post-2467570161428996782014-02-20T13:44:07.700+00:002014-02-20T13:44:07.700+00:00Hi, I juste want to resample but only CreateWaveFi...Hi, I juste want to resample but only CreateWaveFile work and i dont want a wave file<br /><br />bye [] data = From64String("----- string encoded ---");<br />MemoryStream fs = new MemoryStream(data);<br /> var baseDir = AppDomain.CurrentDomain.BaseDirectory;<br /><br /> using (var wfr = new WaveFileReader(fs))<br /> {<br /> var outputFormat = new WaveFormat(8000, 16, 1);<br /> using (var pcmStream = new WaveFormatConversionStream(outputFormat, wfr))<br /> {<br /> using (var ms = new MemoryStream())<br /> {<br /> var bytesRead = -1;<br /> while (bytesRead != 0)<br /> {<br /> var buffer = new byte[pcmStream.WaveFormat.AverageBytesPerSecond];<br /> bytesRead = pcmStream.Read(buffer, 0, pcmStream.WaveFormat.AverageBytesPerSecond);<br /><br /><br /> ms.Write(buffer, 0, bytesRead);<br /> }<br /><br /> program.WaveHeaderIN(ms.GetBuffer());<br /> ms.Position = 0;<br /> RawSourceWaveStream RawStram = new RawSourceWaveStream(ms, outputFormat);<br /><br /> System.IO.File.WriteAllBytes(@"Desktop\waveConvertBy.wav", ms.GetBuffer());<br /> // to make a real wav file...<br /><br /> ms.Position = 0;<br /> WaveFileWriter.CreateWaveFile(Path.Combine(\Desktop\output.wav"), RawStram);<br /> Console.WriteLine("wavefile length: " + RawStram.Length);<br /><br /> }<br /> }<br /> }<br />ms.getBUffer is not a wav file when i play it. there is another way to put RawSourcewave stream into byte? or memory Stream?<br />thanksAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-6822536077160579260.post-81785560653941132312014-02-12T15:11:51.291+00:002014-02-12T15:11:51.291+00:00thanks Dave. With Git or Mercurial I'd definit...thanks Dave. With Git or Mercurial I'd definitely do a commit before cleaning, just wouldn't push it. Also, in an ideal world, your unit tests should be protecting you from breaking things while cleaningAnonymoushttps://www.blogger.com/profile/17900587357903273800noreply@blogger.comtag:blogger.com,1999:blog-6822536077160579260.post-10687384701634086832014-02-12T13:31:08.363+00:002014-02-12T13:31:08.363+00:00Good post.
I find the best opportunity for cleani...Good post.<br /><br />I find the best opportunity for cleaning code is at the point of checking into source control, since at that point you can run a diff to see your changes in isolation. <br /><br />In fact I tend to diff to see the changes, check this in, and then tidy and checkin again, in case my tidying breaks anything.<br /><br /><br />DAvehttps://www.blogger.com/profile/07524890697045473232noreply@blogger.comtag:blogger.com,1999:blog-6822536077160579260.post-26763661975025844662014-01-29T11:10:57.416+00:002014-01-29T11:10:57.416+00:00Hi. I am new in NAudio. i am using wave stream in ...Hi. I am new in NAudio. i am using wave stream in my program. where i produce two wavestream from two different/similar audio. How can i compare the percentage of similarity between the two wavestream? Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6822536077160579260.post-42329308725160762952014-01-24T19:59:42.148+00:002014-01-24T19:59:42.148+00:00If you want to remove large file from Git reposito...If you want to remove large file from Git repository history, there is specialized third party <a href="http://rtyley.github.io/bfg-repo-cleaner/" rel="nofollow">BFG Repo Cleaner</a> tool. Or you can use <i>git filter-branch</i> command.Jakub Narebskihttps://www.blogger.com/profile/11847202568800326989noreply@blogger.com