Click here to Skip to main content
13,150,622 members (42,458 online)
Rate this:
Please Sign up or sign in to vote.
See more:

I want to write a program to record the calls made by the communicator.

I tried many places and find this NAudio Assembly. But even that is not helping since I can't initialize audioclient using loopback in Naudio.

If any one knows any alternative please help,

Posted 15-Feb-11 22:17pm
Abdul Quader Mamun 16-Feb-11 5:08am
Where is your code?
johannesnestler 16-Feb-11 10:09am
What was the question?
SAKryukov 16-Feb-11 11:09am
Do you mean Lync (formerly Microsoft Office Communicator)?
Any effort on your side?
KingsKnight 16-Feb-11 21:32pm
For both communicator and Lync.
Marcus Kramer 17-Feb-11 19:26pm
As the others have asked, show us what you have and where it went wrong for you. We can't really help a whole lot without some information.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NAudio.Mixer;
using NAudio.Wave;
using NAudio.CoreAudioApi;
using NAudio.Midi;
using System.Threading;
using System.Management;
using System.Diagnostics;
namespace ConsoleApplication1
    class RecordSound
        public void TestSoundCapture()
            MMDeviceEnumerator mEn = new MMDeviceEnumerator();
            MMDeviceCollection deviceCol = mEn.EnumerateAudioEndPoints(DataFlow.Capture, DeviceState.Active);
            Console.WriteLine("All listed Devices are");
            foreach (MMDevice m in mEn.EnumerateAudioEndPoints(DataFlow.All, DeviceState.All))
            Console.WriteLine("\nAll active Devices are");
            foreach (MMDevice m in deviceCol)
            MMDevice mmDevice = mEn.GetDefaultAudioEndpoint(DataFlow.Capture, Role.Communications);
            Console.WriteLine("\nDefault device is " + mmDevice.FriendlyName.ToString());
            AudioClient ac = mmDevice.AudioClient;
            if (mmDevice.State == DeviceState.Active)
                int x = mmDevice.AudioEndpointVolume.Channels.Count;
            WaveFormat wf = ac.MixFormat;

           ac.Initialize(AudioClientShareMode.Shared, AudioClientStreamFlags.Loopback, 10000000, 0, wf, Guid.Empty)
            DirectSoundOut dso = new DirectSoundOut();
            WaveIn wavIn = new WaveIn();
            WaveOut wout = new WaveOut();
            WaveMixerStream32 wm = new WaveMixerStream32();
            WaveFileWriter WFR = new WaveFileWriter("C://NVIDIA//TEST.WAV", wm.WaveFormat);

Above is the code I tried using Nvideo assembly. I marked it as bold(sorry ,don't know how to change color ,tried but color comes in other location than intented :))

I want to record as Loopback then it will save both mic and speaker sound together. There in ac.Initialize method AudioClientStreamFlags.Loopback throws exception. No other values cause any issues...


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170924.2 | Last Updated 14 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100