So, I need to obtain the current audio playback that is happening on my pc programatically in real time. This includes all the audio(you can check this in the playback devices tab of the Sound settings). I need it because I'm doing an analysis over the stream which I then put into use in another software. Until now, I've used the 'StereoMix' option, which actually relay's the current audio as an input(something like an internal microphone). However, I can't use this method when I connect external speakers to my pc(through HDMI, PC/AUX works though).
Is there some way to obtain the audio stream no matter if external speakers are connected or not.
The programming language does not matter in the current case, everything is fine with me. However, I prefer if there is a C# / Processing solution.
EDIT:
Here's the technique(and method) I currently use to obtain the audio in http://code.compartmental.net/minim/minim_method_getlinein.html. The library/code is related to Processing: https://processing.org/.
Basically, NAudio would be a good place to look for a prospective solution. Its not quite clear what you intend to do with the audio such as if you're recording/dumping data, or simply analyzing live-data so I'm thinking NAudio is going to have something such as you're looking for, as far as getting your hands on live-data.
NAudio has an FFT, but not quite robust in the area of analysis as the JS-libs you may be accustomed to ;)
http://naudio.codeplex.com/
https://github.com/naudio/NAudio
There are plenty of examples provided to get you started, and many in the wild.
Though its pretty outdated and the API may or not look slightly different (in regard to...), the following video may provide a nice relaxing quick-start to help familiarize you with this lib.
C# Audio Tutorial 6 - Audio Loopback using NAudio
Related
I am trying to recreate some features of Spotify in C# using the PostgreSQL database.
The reason is simple, I want to gain more knowledge, and I think this is a good challenge.
But I ran into an obstacle that I've been standing for days. Spotify he doesn't download the music, he does her streaming, plays the music while it's downloaded.
However, I can't do this in C#, I'm using the PostgreSQL database.
I'm well locked in this part, I tried several implementations, but I think I'm not on the right track, and on the internet I imagine I'm looking wrong, otherwise I would have found it.
Do you have any guidance for this streaming process in C#? I've tried to read the large_object bytes from PostgreSQL, but couldn't.
Any suggestions or guides about the process are welcome.
You start by getting the file into the database or its network location into the database, whichever gives you better performance; Then start with creating an implementation of a bytestream. You want to be transmitting raw data to c#.
you then build a real time interpreter that takes in using your file format, one byte at a time, and plays the value associated with that section. does that make sense? this is simple to do with many libraries and the brunt of it is just figuring those out.
You seem like you've PROBABLY got that first part down, and are instead having issues with the database. A lot of things we did at my last company involved saving file network locations and indexing files on disk. You might be able to instead point your streamer to a file locally using a server, and instead transmit data from one point to another in that manner instead.
You seem more than capable of doing this just judging by your speech. I hope this comment was helpful, and if it was not I apologize as well. I would be interested in seeing your finished result.
for clarification here would be that workflow:
request for a song listed in table dbo.Songs
matches that song onto dbo.songlocation
streams from dbo.songlocation.location from the filename dbo.songlocation.songname = dbo.song.name and verified directory returns true
enjoyment of that music
I am building a softwere that can decode and encode using Wpf and c#, and I want to do that using, FFmpeg libary. I saw the ffmpeg autogen warpper but I couldn't find any documantion for its function.
Can someone please find me one? Or better, give me better warrper.
I already tried FFMpegCore, its working but very slow. For Exaple it takes 20 seconds to decode a specific frame.(And i have monstruos computer)
If will be happy if ou could give me better warpper, or a guide for ffmpeg.autogen.
Thanks in advance.
FFmpeg framework is powerful, from the other hand is so large which makes it complex. If you want to mess with it, you will have to read a lot before start coding. I would recommend starting with the original documentation and examples that can be found here :-
FFmpeg Libraries Documentation
FFmpeg C Examples
And then move to some open source examples -based on what you want- coded in C# with FFmpeg.Autogen bindings.
You can check my recent FFmpeg.cs implementation that is for decoding (audio/video/subtitle frames).
FFmpeg.Autogen C# Example
I've been building my own media player to cater for my needs and I'm using
Flyleaf:https://github.com/SuRGeoNix/Flyleaf which is based on FFMPEG. There are samples in the code to get you started.
I've also seen this: FFME: https://github.com/unosquare/ffmediaelement
I'm wanting to create a fun little project to function as a Skype sound-board. That is to say, if you press a hotkey (say, NumPad 1), the sound-board plays a pre-determined WAV file over the call. Really only to be used for stupid in-jokes and other silliness with friends.
The way I envision handling this problem is writing to the microphone's output buffer. However, I cannot find any ideas on how to do this. I found this question regarding general audio handling, but the output examples for nAudio are rather generic and don't handle writing to a specific device.
Ideally, I want to get the default audio input device for the system (so the default microphone) and then write the WAV data to the buffer it's using for transmission.
The first problem appears to be tenable with the XNA framework and its Microphone object. It has a Default static method that should get me what I need. But the Microphone object itself doesn't have an obvious way to write to the buffer, which leaves me a little stuck.
Are there any ideas on how to do this? Am I running down the wrong path? Is the Microphone object even the correct thing to use here?
I have made programs for my windows phone that displays the camera feed on the screen. I have also sent/received data using the Sockets namespace. Is it possible to "combine" these to create a live video feed from the camera that can be connected to by a computer on my LAN?
Well, this is a very interesting question. In fact, it normally should be possible to create a live stream - but - and this is the "hard" point: You have to do it on your own, so you have to care about everything you need for a real live stream.
In detail, it's not very complicate to realise a kind of live-stream. Think about what you need:
1a) Image-Source (normally of course the cam)
1b) kind of Image-Copier
2) Streaming-Server
3) Streaming-Client
So if we talk about Windows Phone, you have many .NET classes available who are doing some work for you. For a good start you should consider the following reference:
http://msdn.microsoft.com/en-us/library/ff637518%28VS.92%29.aspx
If we go more into detail, you have to perform the following tasks:
1) Get your camera image ready
2) Copy the content of your video-brush/canvas ui-element into a stream
3) write the stream to a temp file
4) upload the temp-file over the server to the clients
5) go into a loop and start over by 3.
The big think in this case is, to get the video-brush copy done, so for this have a look at the connnected msdn reference for the video-brush
http://msdn.microsoft.com/en-us/library/cc189009%28VS.95%29.aspx
To have a good starting point for copying the content of the video-brush into a stream consider this document
http://msdn.microsoft.com/en-us/library/bb404773.aspx#anchor_videobrush_relationship
by using the media element as a host for the "live-pictures".
Another, better, but of course, more complicated way is to implement your own version of the video brush. Read this article to learn how to copy the preview-camera buffer
http://msdn.microsoft.com/en-us/library/microsoft.devices.photocamera.getpreviewbufferycbcr%28VS.92%29.aspx
So, i hope, i was able to give you an idea, how to implement your solution.
p.s.:
If you are able to speak german, I've kind of book recommendation for you:
http://amzn.to/wxfEzd
I'm the author of this book ;)
So, I have this desktop app built using WPF and C#. It's basically an offline course system that has videos, quizzes, and other assorted content. My dilemma is that I don't know how to protect the videos once they are downloaded and installed on the users machine? Are there any DRM systems out there that I can look into? I thought about storing them in a local encrypted database but I don't even know where to start with that (or if there is something else out there that I'm totally missing...)
Don't even know where to start looking on this one - any ideas?
this question might be helpful, but don't spend too much time on it as any DRM is likely to be broken (they spent millions trying to protect blu-rays and couldn't). At best you can deter the casual user, but you won't prevent the determined hacker, so don't waste time trying.
you could do something trivial to make sure that the files as is can't be copied and played as is (like swap a few bytes round in the header of the file to make it seem as if its garbage so won't be played, then unswap them in memory when you read the file - just an example, I'm no expert)
I've seen Bink video used in some games. I believe it has some sort of built-in "scrambling system", but I might be wrong.