Ability to set audio position before playback - c#

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.

Related

Is it possible to view the audio waveform of mp4

I have been searching all over for a way to display the audio intensity of an mp4 file. I have found many guides on how to do it with wav files and even audio being actively recorded, but I can't find anything about mp4s.
I have a C# windows form that plays a video and allows you to caption it. What I am trying to do next is add a visual representation of the audio intensity so the user can see where the next chunk of speech is. To play the video I am using Windows Media Player
You can refer to this other stackoverflow question:
Howplay mp4 songs using NAudio
Instead of playing the file you can show the current level with some widget. Just pay attention to the fact that you should probably display the level in dB:
dB = 20 * log10(amplitude/maxAmplitude)

Volume Control while Playing Muliple File Using nAudio

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.

Does anyone have any suggestions beyond the Windows MediaPlayer class for embedding video or audio?

I'm writing an application that is intended to embed audio or preferably video in a windows form.
Right now I am using the standard MediaPlayer class (xWMPLib.AxWindowsMediaPlayer MediaPlayer) and am finding that it may not have some of the functionality that I am hoping for.
One of the features I would like to have in this application is 'unadulterated scrubbing' of said audio or video... Which in this context I would define as 'the ability to scrub the video without stopping playback' - or otherwise, continuing to play audio or video While scrubbing...
Examples of this can be seen in programs such as Adobe Premier; in which you can scrub the position of your video on the timeline, and at whatever rate you are scrubbing, it will play back some 'garbled' audio.
The intention in this feature is to grant someone the ability to ( using a foot pedal, in one instance ) roll back in the media and know exactly where they are, based on audio feedback...
This particular feature is very specific and debatable in its ability to be achieved, but the core of the question here is this; What would be your suggestions for a 'more fully featured' media player that can be utilized in a C# windows form?
Thanks in advance.

Playing a ding in Windows 8?

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.

WPF MediaElement: SpeedRatio not working for .m4a files?

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

Categories

Resources