I have an application which needs to play multiple audio files using nAudio but I want to mute any one when I want to. I set the Volume property of the instance of the WaveOut i want to Zero.
myWaveOut.Volume=0;
The problem is when I do that all the audio out of that application mutes. Even thou all the audio uses its own instance of WaveOut.
Why is this happening, and how can I resolve it?
The WaveOut.Volume property sets the device volume. To set the stream volume, insert a VolumeSampleProvider into your signal chain, or more simply just use the AudioFileReader class which has a Volume property.
Separate audio channels volume is adjusted in other way than the main volume. There is quite related discussion on NAudio codeplex page.
Related
Hi I Want to Decrease the Compression rate/Playing Speed of My Audio Tracks in C# Using NAudio class, i.e. I want tracks to play at a slower speed than their original speed.
Previously I was using Windows Media Player object for just this thing and NAudio for everything else, but I want to shift completely to NAudio.
NAudio does not have a built-in feature to do this. When I need to change playback rate, I create a managed wrapper around the SoundTouch dll. I keep meaning to blog about how to do this, but for now, check out the PracticeSharp project which also uses SoundTouch and NAudio.
While beginnning audio playback, I need the ability to set the position in the audio file from where to begin the playback.
Please guide me with the API's to be used for this functionality.
Until now I have been using SoundEffectInstance for audio playback, but I do not see an option to set the audio playback position in that.
There are many different ways to play audio, see Media for Windows Phone. Without knowing which one you're using, it's a bit difficult to answer the question.
The MediaElement class has a settable property for Position that could serve your purpose.
I need to be able to play a "ding" sound in Windows 8 (a kind of beep that fades out gently), similar to what is seen here: http://tonematrix.audiotool.com/
Is it possible to somehow play this given a frequency? Or can I download sound files for this anywhere?
I noticed how the SoundPlayer no longer works, so the old code I used in my desktop program won't work anymore.
If you have a sound file of it, such as an mp3 or wav, use the MediaElement control. There are a few ways of doing this. For example, set the Source property to a URL (Uri class) or call SetSource() then the Play method.
Windows 8 does not include an easy way to generate a tone or pitch (assuming you mean metro/Windows Store apps). If you can generate the bytes needed to play the sound, place them in a buffer, create an IRandomAccessStream for it then pass it to SetSource. You can emulate the fade out by setting the Volume with a Timer.
It would be nice if there was a "fade out" audio effect that could be used with SetAudioEffect but Microsoft does not provide any audio effects at this time.
How to mute a WaveOut? I know I can save current volume to variable, then set Volume to 0f. To unmute I just read that saved variable. However in Windows Volume Control panel it not shows "mute icon". Is any way to mute output just telling it to that system which is using WaveOut? Subquestion: DirectSoundOut uses DirectX, AsioOut uses Asio driver, and what is using WaveOut?
You won't see the mute icon because it is not muting your soundcard for all applications, just for the instance of WaveOut you are using. This is because NAudio is passing the handle to waveOutSetVolume, not the device identifier. You could call WaveInterop.waveOutSetVolume directly with the device identifier.
I'm working with a simple mediaplayer based on this msdn example where the user can control volume, playback speed (SpeedRatio) and seek (Position) using 3 sliders.
Everything works correctly when I play .mp3 files, but as soon as I play an .m4a file the song playback speed, controlled by the MediaElement.SpeedRatio, is ignored. Volume and seek still works and the audio is working.
Questions:
Are there any logical explanations for this?
Any known solutions/workarounds to this problem? The speedratio is essential in my application.
Thanks,
Avada
check this out:
MediaElement Speedratio not linear