how can i record audio in C# - c#

I was wondering if there was a simple way to record audio, and have it saved as an object of any sort.
My personal goal is to eventually record audio, save it to a "channel", allow for multiple channels, and play them back simultaneously.

This project on CodeProject provides some classes for capturing audio. It uses Managed DirectX, which has been deprecated, so you might want to look into using SlimDx as a wrapper around DirectSound instead.

You could take a look into the OpenAL wrapper in OpenTK.
It should have what you need in it. The AudioCapture and AudioContext classes will collect your data, and then AL.SourcePlay() can be used to play multiple contexts together.

Related

C# RTSP & VLC dotnet

I'm working with C# and VLC library, and I wonder if there is way to get hands to VLC buffer (netwoking-cache or so).
What I could use, is to save that to my own circular buffer and save it IF needed.
Is this possible, or should I just do it with "manualy" on other stream?
There are audio and video callbacks that allow you to access the raw data using libvlc. It does slow down the perf though, understandably.
This sample https://code.videolan.org/mfkl/libvlcsharp-samples/-/blob/master/PreviewThumbnailExtractor/Program.cs shows you how to use the video callbacks to extract frames.
This should be a good starting point for achieving whatever you need to do.

Using Core Audio API to change volume of rear channels

I'm trying to create a background application that allows me to easily change volumes of the rear channels
I've looked into the Core Audio API, and although I managed to change the balance/volume of the front speakers, the API seemingly had no access to the rear channels or any other surround channel. It only counted 2 channels for my audio device.
Is it in any way possible, using any API, to control the rear channel's volume?
Thanks in advance!
EDIT
Thanks, FMOD looks like what I need, although it's a bit overwhelming. :P What would I need to do, to change the volume of a specified channel. I believe I need this function:
FMOD.RESULT result = channel.setVolume(1.0f);
But then I need to find a way to specify the channel...
Also, to be clear: I need to change the volume of any running application, say Winamp.
Best chose for working with audio file is "Fmod.dll".this have a lot of Privilege to work with audio file.
This is an audio content creation tool for games, with a focus on a
‘Pro Audio’ approach. It has an entirely new interface that will be
more familiar to those using professional Digital Audio Workstations
than existing game audio tools and is loaded with new features.
I already use this,this is very powerful component and easy to use.

Send sound to different audio devices

Is it possible to play a sound on a playback device that is not set as default playback device?
I need to play multiple files simultaniously trough multiple output devices.
Does anyone knows a solution for .net? (C#)
Thanks!
you will have to go to lower level API. You can try find C# wrapper for Wasapi, ASIO, DirectSound or MediaFoundation. Maybe XNA framework could do the job, which is managed framework over directX
well I was playing around with similar issue.
XNA could not do send output to specific device.
I have ended out with http://naudio.codeplex.com/, which is exactly what you need. It's C# wrapper for Wasapi, ASIO, DirectSound libraries. It also includes many very helpful classes for converting, decoding, visualizing etc. For simple player, check out NAudioDemo sample project.
find out CreateWaveOut() method. This is where you should select your playbackdevice.
for example:
MMDevice device = new MMDeviceEnumerator()
.EnumerateAudioEndPoints(DataFlow.Render, DeviceState.All)
.FirstOrDefault(d => d.ID == "yourplaybackdeviceid");
IWavePlayer waveOut = new WasapiOut(device, AudioClientShareMode.Shared, false, latency);
Download the naudio library from sourcecode tab not from Download->Release, it's not very actual and it's little buggy.
another good tool is bass.net
http://www.un4seen.com/

2 videos with DirectShow in c#

I would like to have 2 video windows playing a (same file for now) video. As I'm still new to c# and DirectShow I'm having problems with this and haven't found any working examples for multi-video solutions. I can get it to work for 1 window from samples, and would like to know what else is required to get the 2nd window working. Do I need to create a separate filter for the 2nd one aswell, or just fiddling around with the handles is enough?
What problems are you facing for multi-video rendering ?
As far as I know, you need to create one graph per video stream you want to have rendered, i.e. one Source/(Transform)/Render chain per stream. I don't think using a single render filter and playing with the windows handles is going to work (but I may be mistaken).
If you need to play the same video file in two different windows, just connect a Smart Tee filter after your source filter (or after your decompression filters), and connect a render filter to each of the Smart Tee's output pins.
If you want an easy method to test Directshow graphs, use GraphEdit (available in the DirectX SDK and in many other places on the Internet).

How to play dynamic sounds in XNA?

Is it possible to dynanmically generate sounds with XNA C# code?
I looked into this some time ago when XNA was first released. At that time it was only possible to playback sound resources included in the compiled code.
Have there been any changes or new features added since XNA 1.0 that would allow an XNA application to generate and playback audio on the fly?
Yes.
XNA 4.0 added support for dynamic audio that allows you to:
Create a regular immutable sound
effect from a raw buffer using the SoundEffect.FromStream method.
Create a
DynamicSoundEffectInstance object then modify the audio data of this new
streaming sound effect object
dynamically.
Read more in the blog entry What’s “Dynamic” about this SoundEffectInstance? and in the AppHub article Dynamic Audio.
I think you can do this in XNA with DirectSound. Here's a link with code that seems to do what you want:
http://forums.create.msdn.com/forums/t/40361.aspx
Depends how dynamic you want to get. I know that XACT will let you change pitch and such, which, when combined with using cues in a programmatic fashion, can give some nice results.
If you want to generate your own waveform, you're out of luck. There's always the option of dropping below the framework and doing it yourself.

Categories

Resources