How to display audio signal on Universal Window Platfom (UWP) C#? - c#

I want to display signal from audio file (ex: .mp3, .wav, .wma,..) to view on Universal Windows App. It may be look like this:
How to do it, which Control should I use and are there any libraries can help I do it on UWP? Thanks!

There are a couple of options out there readily available. Here's just 2 of them:
clarkezone/audiovisualizer (VU Meters, spectrum & waveform plotting)
NAudio.WaveFormRenderer (Plots waveforms i.e. PCM data); Maybe this video will be useful as well
Otherwise once (a while ago now) I used the old windows forms chart embedded into a WPF application (have a look here if its useful).

Related

How can I draw waveform in UWP application?

I have a UWP app that want to display the whole waveform from mp3 or mp4 etc. I tried to use NAudio.WaveFormRenderer(https://github.com/naudio/NAudio.WaveFormRenderer), but it doesn’t use in UWP app due to .Net.Core is strict about reading files.
I want to know how to draw whole waveform from read mp3, mp4.
Are there any solutions?

How to make MediaElement work as good as AxWindowsMediaPlayer?

I need a very simple video player in my C# app. It only has to loop a video from file and nothing more. Since I'm developing a WPF application, I've tried to use System.Windows.Controls.MediaElement. It has all the functions I need, but works quite poor: I've played some full HD videos on it, and it's always lagging and spiking.
To make sure, it's not my app problem, I've created 2 test applications. The first in a WinForms borderless 1920x1080 window with only AxWMPLib.AxWindowsMediaPlayer control. And the second in a borderless WPF window of the same size with System.Windows.Controls.MediaElement.
Then I run 2 videos on both of players. Here are their specs:
1: 1920x1080, 12000kb/s, 25 FPS, wmv
2: 1920x1080, 5730kb/s, 25 FPS, mp4
On AxWindowsMediaPlayer everything looks fine. But MediaElement seems to drop some frames and ignore vertical sync (it's possible to see parts of one frame on another during fast scene changes). So, it's completely unsuitable and shouldn't be like that, but I've found nothing about the problem in Microsoft official docs (they only suggest to use MediaElement instead of AxWindowsMediaPlayer in WPF apps). Is it possible to make it work more smoothly or using an additional WinForms Form with AxWindowsMediaPlayer is the only solution?
It was written over five years ago (look up James Dailey messages in the thread), there were possibly some improvements but overall I suppose the statements are still in good standing. I will pick up some relevant quotes:
As you know the WPF environment is constructed from the ground up to offer developers a very rich “graphics first” environment. The MediaElement in particular was designed to allow you to mix video with various other UI components seamlessly. This solution will give you the flicker free, “draw over video” solution that you are looking for. The best part is you can do all of this in C#. The bad part of this solution is that the MediaElement is not designed for displaying time sensitive media content. In other words, the MediaElement is notorious for dropping and delaying the display of video frames. There are ways to minimize this such as using SD rather than HD content, use a video accelerated codec, etc.
also:
Unfortunately you can’t really tell the WPF MediaElement to never drop frames. The term we use for this class of issues is “disparate clocks”. In this case WPF is updating the screen at a certain rate (clock 1). The MediaElement (based on WMP) is cranking out video frames at a slightly different rate (clock 2). Given the underlying technologies there is currently no way to synchronize the two clocks and force them to “tick” at the same rate. Since the display will only be updated according to the WPF clock, multiple frames of video may be sent from the MediaElement to WPF between clock ticks. Because of this the MediaElement may appear to drop frames. This is a very common problem in multimedia development and there is no simple solution.
Windows Media Player uses Media Foundation and DirectShow APIs which power media playback with high quality video experience.

How to access camera frames in Universal Windows Platform

I am developing an application for Windows 10 phone on Universal Windows Platform. I need to get a frame from the devices camera and do some processing; this is supposed to happen in the background, the user is not supposed to see the camera feed anywhere in the UI.
There are two classes that handle the most common use cases, namely CameraCaptureUI and MediaCapture. The MediaCapture class allows to grab the so called preview frame but the whole workflow revolves around binding a MediaCapture instance to a UI control (ie CaptureElement) and if I do not do it then I am unable to get the preview frames. This makes the MediaCapture class unsuitable for my case unless there is another way to use it that I am not aware of.
An answer to a related question How to get preview buffer of MediaCapture - Universal app suggests usage of Lumia Imaging SDK but it is targeted at Windows 8 family and the classes and methods used there are now deprecated in the current Lumia Imaging SDK for Windows 10.
Additionaly, the aforementioned answer brings up custom media sinks but I am unsure if that can help me in my scenario and if yes, then where should I start.
To sum up, how do I acquire frames from a camera device that can be used for further processing in a Windows 10 universal app?
There are multiple options available to you for this. CameraCaptureUI is not one of them.
Hide the CaptureElement
Opacity = 0
Visibility.Collapsed
Create it in code and don't add it to your layout
etc.
StartPreviewToCustomSink (https://msdn.microsoft.com/en-us/library/windows/apps/hh700850.aspx) although I've never done this. This link might also help.
Once you've done that, you can take photos or just get preview frames. The CameraStarterKit will teach you the former, CameraGetPreviewFrame will teach you the latter.
How about you put a CaptureElement in UI, but hide it with overlay or set width / height to 1 ? Its kind of a hack but it will provide you the frame.

Windows phone: Combine images and make a video file

I have a set of Images and i want to make a video with them.
I made a R&D over that and i found a lots of way like, FFmpeg. but there is nothing worked with windows phone 7.
My concept is just combine the set of images and prepare a video with any video format that you tube supports. and then i have to share this video on you tube.
I completed the share Functionality. but, i have a confusion in this generating video functionality.
Please suggest me any possible solution with windows phone 7. Waiting for your valuable feedback.
Thanks in advance.

VGA/Skeletal Viewer in Windows Form?

I'm developing a C# application with the Kinect, and I'd like to relay back to the user their reflection (with the RGB camera) or the skeletal view while they're using the application. Is that possible? Or is there a better way to show the user what the camera sees while running?
Thanks!
The Kinect for Windows Developer Toolkit has examples that do exactly this. There are multiple examples Demonstrating how to display the depth and color streams, as well as how to show the skeleton by it'll or overlayed on the video stream.
The "Kinect Explorer" example is the more advanced of those examples, showing how to put it all together.

Categories

Resources