I have a MAYA 44 USB sound card and would like to interface it with C#. I want to record from the provided microphones and produce a data array.
I have found examples when using the internal sound card from my laptop but when it comes to external it does not quite work.
Has anyone every connected the above sound card with C# please?
Have you had a look at the DirectSound API (Windows only though, I think). Might provide what you're after.
On how to record audio with C# in general there are already multiple threads on SO, so I won't talk about that.
I see two possible causes for your program which have different solutions:
You need to change which audio sources are muted in the windows volume control ("sndvol32.exe /R")
When opening the audio device there are multiple devices. And you're simply opening device 0 instead of enumerating them and perhaps choosing another one. The external sound-card might appear as a second device.
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.
I need to be able to record video from an external camera in a C# application.
Unfortunately a webcam is pretty much out of the question as the application will record outside and during the evening/night. That is why I was thinking of a camcorder since it also has manual control over exposure and focus, lower noise and better sensor.
So far I would use the AV/S-Video output from the camcorder and send the signal to a USB capture card (the computer is a laptop so no PCI-E cards).
How would I be able to access the video stream from the C# application, now that it comes from the capture card ?
Does my proposed system seem feasible (achievable, good video quality, good fps)? Does anybody have another working solution?
Thanks
This Code Project Article could be of a good starting point.
The Author mentions :
The main goal of the application was to make it flexible and
extensible. The application itself can communicate with any video
source – it may be an IP video camera or a server, it may be a local
camera attached to USB, it may be an MMS stream from a remote server,
or it may be any other video source. And more of it, the application
can work with all these video sources simultaneously, displaying them
all on a single screen.
The solution I used in the end was Microsoft Expression Encoder.
How do I play 3 different music tracks at the same time on my computer, such that song1 is played in speaker1, song2 in speaker2...
Is this possible programatically? What additional hardware will I need? Do I need 3 seperate sound cards? Given that the hardware is in place, how would I "route" the sound output for a particular song to a particular speaker.
Alternatively, is there a special hardware that can handle multiple inputs and outputs?
Appreciate your expert opinions.
http://www.esi-audio.com/products/maya44usb+/ Try this with the NAudio c# Libary look at AsioOut and the MultiplexingWaveProvider
Provided that you have as many outputs (total) as you have songs you are all set (I'm assuming you'll just be playing each song in mono). The simplest way to tackle this problem is to open one "stream" for each song and play the song through that stream. You'll have to do some work to open each stream with the right number of channels and ensure that the song is played in the correct channel.
There are two potential problems with that technique: 1. some audio API/hardware combinations don't allow multiple streams to access the same device. This is most commonly an issue on windows/ASIO, but it may be an issue in other cases -- I am not a windows expert. 2. it is a bit tricky to ensure that all streams are exactly synchronized. If you require tight synchronization you should use a single stream and a single hardware device.
If the above issues are a concern, then you should get some audio hardware with at lest three outputs, and open one stream with access to three channels.
You can use PortAudio for audio I/O, and libsoundfile for reading the sound files (of course, there are other options for both these tasks).
I am looking for a Bluetooth stack for C# that will allow me to route audio from my phone to my computer, as well as use my microphone on my computer(Windows 7) as an input device for phone calls on my phone. I've looked at 32Feet.NET, but it does not seem to support audio channels. If I am wrong on this, someone please correct me. Otherwise, if there an alternate library for C# that I can use for Bluetooth support?
I'm afraid this probably doesn't really answer your question, but maybe adds some alternative perspective: The issues you're trying to solve seem to be supported by standard Bluetooth audio profiles. As such, there are chances they're provided by the OS's (or other vendor's) Bluetooth stack in a transparent manner, i.e. as audio device like the system's sound card.
If there is no urgent reason for a custom implementation of these Bluetooth profiles, you might be better off looking for .NET methods that configure the audio devices your code uses for audio input/output. You would then use Bluetooth audio in the same way you access other audio devices, basically reducing your code to proxy audio from one audio device (sound card) to another (Bluetooth audio).
I'm messing with the idea of writing a small program to mirror output of a video capture device. If you buy a video capture device you can only use it with one program at a time because the device gets locked. Instead of buying a second capture card id like to write a program to accept input from my capture device and expose the output to other applications.
Capture Device----->Program---->Flash Media Encoder
I've never done this type of thing before. Is it device driver related? Can I make my program look like a capture device to other programs without digging in device driver dev?
If someone could point me in the right direction that would be great.
Can I make my program look like a capture device to other programs without digging in device driver dev?
-No, I'm afraid not. You'd need to do exactly that, write a driver or capture source of your own. You could make some interface to serve up image to multiple apps (what a great idea!) but then it would need to be standardised, and you'd need other companies or developers to use that interface. Again a great idea but you'd need to agree on the feature set - and each developer would likely want something new or different.
(If you are talking about particular/specific other programs, they might have a particular interface you can work with already..)
(I was also assuming you were talking about realtime video capture: if you're talking about photo capture etc, you could write an image file to disk, and then import into the other apps ... not as joined up or integrated as ideal though)
Hope that helps - not an ideal situation though!
I will not say it is impossible, but I will say it is impossible in C# because this will require you to write a device driver software which can emulate virtual capture devices which your other program can use and your program can capture actual capture device and mirror or split the data to virtual capture devices that your device driver will create.
Very much same to Virtual CD Rom Drives that we can create with some software, you will need windows device driver kit for that.
You can write combination of application, one device driver and you can have some sort of C# api or program to control the operation.