Quantcast
Channel: NAudio
Viewing all articles
Browse latest Browse all 5831

New Post: How to create a virtual audio source with NAudio?

$
0
0

So I looked at http://channel9.msdn.com/coding4fun/articles/Skype-Voice-Changer. I started reading at Intercepting Skype Audio.

What I understand is that the most important part is

void OnMicServerExecute(object sender, DataReceivedEventArgs args)
        {
            toolStripStatusLabel1.Text = "Got "+ args.Buffer.Length + " bytes";
            if (outStream != null)
            {
                // give the input audio to the beginning of our audio graph
                bufferStream.SetLatestInBuffer(args.Buffer);
                // process it out through the effects
                outputStream.Read(args.Buffer, 0, args.Buffer.Length);
                // play it back
                outStream.Write(args.Buffer, 0, args.Buffer.Length);
            }
        }

So you set up a TCPServer you stream the mic-data from skype to. Then you replace the stream with your modified data and give it to outStream, which again is delivered to the other side. So outputStream has to contain my contentsomehow. This is where the problem comes in. I have my microphone connected with LINE-IN. I want the LINE-IN stream to be mixed with a sound file I am currently playing using

void abspielen(string Dateiname, float ZielAmplitude)
{
	Klangwiedergabegeraet = new WaveOutEvent();
	Klangwiedergabegeraet.DeviceNumber = cbAusgabegeraete.SelectedIndex;
	timer1.Enabled = true;
	ISampleProvider StueckchenHalter = null;
	try
	{
		StueckchenHalter = CreateInputStreamS(Dateiname,ZielAmplitude);
	}
	catch (Exception createException)
	{
		MessageBox.Show(String.Format("{0}", createException.Message), "Error Loading File");
			return;
	}
	try
	{
		Klangwiedergabegeraet.Init(new SampleToWaveProvider(StueckchenHalter));
	}
	catch (Exception initException)
	{
		MessageBox.Show(String.Format("{0}", initException.Message), "Error Initializing Output");
			return;
	}
	Klangwiedergabegeraet.Play();
}

and forwarded to Skype.

Please give me a route to accomplish this.


Viewing all articles
Browse latest Browse all 5831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>