Recording with AudioQueue and Monotouch static sound demonstrates how to get audio via an iPhone's microphone into an AudioQueue using Xamarin.iOS. My question is: how do I keep the microphone continuously recording? I basically want to keep the microphone on for as long as the app is open, and continuously capture the audio stream (note that I do not want to save the stream to file). Inside a long-running while-loop?
This should work: https://github.com/sami1971/SimplyMobile/blob/master/iOS/SimplyMobile.Media/Audio/AudioStream.cs
Initialize and use Start() on application start and then call Stop() when application closes (or goes background). Captured buffers are delivered through event handler OnBroadcast.
EDIT: Here is a quick WaveRecorder class. I have not had time to test it so if you find bugs in it, please push back changes or let me know what needs to be changed. https://github.com/sami1971/SimplyMobile/blob/master/Core/SimplyMobile.Media/Audio/WaveRecorder.cs
Related
Is there any way in c#/.net of recording the current audio being played? I've searched a lot on the internet but the only result I could find is recording using a microphone.
I dont want to record using microphone input, I want to record what is being played on the computer when I click a record button.
Thanks
You have two options here:
Hardware loopback device - virtual "Stereo Mix" audio device, which acts as a regular audio capture device and in the same time produces a copy of mixed audio feed played through default audio output device of the system. Since such device shows up as real audio input device, you can use standard APIs, libraries and even exitsing applications to record from such device.
Programmatic access to a virtual loopback device as if it was microphone-like device. API on the background will duplicate played audio content and make it available for reading back as it plays. The good news is that you can access the mixed audio feed for device of your interest.
Both options are described in detail in Loopback Recording article on MSDN and available via standard audio APIs, specifically WASAPI.
For C# development you are likely to use a wrapper like NAudio.
For option 1 you will find quite a few questions on StackOverflow, and for the other option the keyword is AUDCLNT_STREAMFLAGS_LOOPBACK.
The only way to be able to receive data from another application is if the developer provides an access point, normally through some SDK, API, or other means. Without this, there is no way for your application code to receive the bytes from the other application.
The reason a microphone works is because it is receiving the sound output bytes from the application and sending those soundwave bytes back into your PC to render and output the sound. Since you have access to these bytes from the microphone you are able to capture the sound.
See if there is an API or an SDK from the developer of the application you are trying to get sound from.
Our app is using C#/WinForms/VMR9/DirectShowLib-2005 to either play back a local video file or to receive (and render) the live video stream via udp using a third party DirectShow filter. The video stream uses H.265 coding and sends 1080p files.
I also have that DirectShow filter recording the live video feed to a local file for me.
When I resize the form during video playback or live video feed playback, I'm getting a device lost and need to reset it. I'm freeing all the resources, but device reset still fails unless I also destroy the graph as well. But it's used to receive my live video feed and record it.
So, problem is I would like to keep the video feed recorded without interruption by resize, move to another monitor, device lost or reset. What are my options to achieve this? We can consider converting the code to WPF/WF, purchasing a commercially available or using a free plugin to do the job, etc. Need an advice here.
Second question on the same subject, if I may. While live feed is recorded to a local file and we're playing back that live feed in the video window, we also display a time line (slider control), representing the time from the beginning of the live video feed till a present moment (which moves forward while the live feed is active). I need to give user the ability to select any previous moment in time and immediately play that part of the recorded video back, while live feed is still recorded to the same file. After reviewing a part of the recorded video, I need to know how to let user to continue watching the live feed.
I am not sure which technology we should be using to achieve that as well. I would appreciate any help.
Thank you very much.
Recording filter graphs are sensitive to unexpected state transitions and it is the assumption that recording takes place "at once" without pausing and continuations, including such as caused by necessity to reset video hardware or change format.
The typical method is to separate recording from other activity into separate graph. A dedicated recording graph would receive data produced outside and record it into file (or stream to network). Playback and presentation activity running in another graph can be flexibly reset or reconfigured as needed.
See also:
Directshow Preview Only and Capture & Preview with a single Graph
What i want to do is capture audio coming from some.exe all the time, check if the program outputs sound that i have already stored, say 5 second audio.
For example I capture some.exe saying "You win" , save it in .wav or whatever. then start monitoring some.exe and if it says "You win" again, do something.
There is no API to intercept audio output of a specific process. You can either capture back a mix of audio generated by ALL applications on specific endpoint, or you have to get your hands dirty with complicated API hooking.
See also:
Is it possible to caputre the rendering audio session from another process?
Is it possible to record sound played on the sound card?
Reading audio stream to output device
Capture any sound that is played by soundboard without "What you hear" or similar device
I have a project where I need to record a video using DirectShow from a webcam, but I need to be able to stop recording while the preview continues to run.
I am using WPFMediaKit
http://wpfmediakit.codeplex.com/
The problem is that when I record a video the pause function also pauses the preview pane in the application
I am new to DirectShow, any suggestions how is can address this issue or a solution
Thank you very much.
P.S I use C# & WPF
I don't know about the WPFMediaKit, but basically when you want to start/stop recording while keeping the preview, you will need two graphs, and something to connect between those graphs. Take a look at the pdf document at the GMFBridge page.
If you can accept a momentary pause in preview when you start/stop recording and don't want to use something like a 2 graph GMFBridge approach, you can disconnect either the capture pin on the video capture source filter (assuming you are using separate preview and a capture pins from your source filter) or disconnect the File Writer chain portion of your capture sub-graph.
The issue here is the filtergraph must be paused before changes can be made to its topology, so you'd need to:
Pause Graph
Disconnect or Reconnect File Writer chain
Resume Graph
In my experience the temporary pause is not very noticeable.
Please use StreamControl method of ICaptureGraphBuilder2, it provides you to control any filter in your Graph individually.
In my C# application i need to trigger some events when a VLC player (preferably) starts playback (a play button is pressed in VLC for example).Tried Windows Media Player classic with Microsoft Spy++ and observed messages that are sent when playback starts\repeats but i don't know how i could "catch" those messages in my C# code.So my question: is there any way to hook up to event in VLC (or WMP) and get notified about playback status (play, stop, start of repeat).
My goal is to create a C# function that waits for start of playback event in player and then triggers some actions in my application (this should also happen when playback ends and starts repeating). What approach should i take here?
Just to clearify: I don't want to embedded a new instance of VLC in my app, but instead control/read the "real" full version of VLC, started seperatly by the user
The below linked article looks like it is old, but maybe you can glean some good info from it if not use the component outright.
.NET Interface to VLC
if you want to control the full one you'll probably have to use the telnet interface or the web interface