Click here to Skip to main content
15,921,990 members
Home / Discussions / C#
   

C#

 
GeneralRe: Combobox SelectedIndexchanged -ASP Pin
omlac16-Sep-08 3:46
omlac16-Sep-08 3:46 
QuestionDate time Sql and query Pin
Bongiwe16-Sep-08 3:10
Bongiwe16-Sep-08 3:10 
AnswerRe: Date time Sql and query Pin
omlac16-Sep-08 3:20
omlac16-Sep-08 3:20 
AnswerRe: Date time Sql and query Pin
Harvey Saayman16-Sep-08 3:46
Harvey Saayman16-Sep-08 3:46 
AnswerRe: Date time Sql and query Pin
nelsonpaixao16-Sep-08 14:00
nelsonpaixao16-Sep-08 14:00 
Questionhow to make control moveable from mouse in windows application. Pin
AtulRane16-Sep-08 3:10
AtulRane16-Sep-08 3:10 
AnswerRe: how to make control moveable from mouse in windows application. Pin
stancrm16-Sep-08 3:30
stancrm16-Sep-08 3:30 
QuestionProblem with recording voice from multiple microphones [modified] Pin
MeContra16-Sep-08 3:07
MeContra16-Sep-08 3:07 
Hello Everyone

I'm trying to write an application which gets input voice from 4 different microphones & saves them in four different files.
I've succeeded getting the voices simultaneously, but I can't save them in four different files. I used FileStream method to create files & to write into them; I could create them but all 4input audios go(mix) into the one file while 3 others are left empty. I've used 4seperate threads for 4 audio inputs, & winmm.dll to catch audio from inputs, as well as an M-Audio Delta1010-LT sound card.
I'm using visual studio 2005 & C# on windows platform.
How should I do that?
I appreciate any kind of help, As I need urgent help Confused | :confused:

I've used a mthod to start capturing called start()
& a class called WaveInRecorder that uses winmm.dll to capture voice, to get available devices & to choose the device to capture voice from.

Here is a sample for two microphones:

<br />
private void Start()<br />
{<br />
	    ThreadStart ts1 = new ThreadStart(doit1);<br />
            ThreadStart ts2 = new ThreadStart(doit2);<br />
            t1 = new Thread(ts1);<br />
            t2 = new Thread(ts2);<br />
            t1.Start();<br />
            t2.Start();<br />
}<br />
<br />
private void doit1()<br />
{<br />
            <br />
            String filename = FilenameBox.Text;<br />
            String ending = ".wav";<br />
	    RecorderOutputStream = new MemoryStream();<br />
	    WaveLib.WaveFormat fmt = new WaveLib.WaveFormat(44100, 16, 2); <br />
            m_Recorder = new WaveLib.WaveInRecorder(Int16.Parse(SoundDeviceBox.Text), fmt, 2048, 1, new WaveLib.BufferDoneEventHandler(DataArrived));<br />
<br />
            fs = new FileStream(filename + ending, System.IO.FileMode.Create);<br />
}<br />
<br />
private void doit2()<br />
{<br />
            <br />
            String filename1 = FilenameBox1.Text;<br />
            String ending = ".wav";<br />
	    RecorderOutputStream1 = new MemoryStream();<br />
	    WaveLib.WaveFormat fmt = new WaveLib.WaveFormat(44100, 16, 2); <br />
            m_Recorder1 = new WaveLib.WaveInRecorder(Int16.Parse(SoundDeviceBox1.Text), fmt, 2048, 1, new WaveLib.BufferDoneEventHandler(DataArrived1));<br />
<br />
            fs1 = new FileStream(filename1 + ending, System.IO.FileMode.Create);<br />
}<br />
   //& These are my DataArrived functions :<br />
<br />
private void DataArrived(IntPtr data, int size)<br />
{<br />
	    if (m_RecBuffer == null || m_RecBuffer.Length < size)<br />
	         m_RecBuffer = new byte[size];<br />
	    System.Runtime.InteropServices.Marshal.Copy(data, m_RecBuffer, 0, size);<br />
            RecorderOutputStream.Write(m_RecBuffer, 0, m_RecBuffer.Length);<br />
}<br />
<br />
private void DataArrived1(IntPtr data, int size)<br />
{<br />
            if (m_RecBuffer1 == null || m_RecBuffer1.Length < size)<br />
                 m_RecBuffer1 = new byte[size];<br />
            System.Runtime.InteropServices.Marshal.Copy(data, m_RecBuffer1, 0, size);<br />
            RecorderOutputStream.Write(m_RecBuffer1, 0, m_RecBuffer1.Length);<br />
}     <br />
<br />




Thanks in forward Smile | :)

modified on Tuesday, September 16, 2008 9:31 AM

AnswerRe: Problem with recording voice from multiple microphones Pin
leppie16-Sep-08 3:09
leppie16-Sep-08 3:09 
GeneralRe: Problem with recording voice from multiple microphones Pin
MeContra16-Sep-08 3:21
MeContra16-Sep-08 3:21 
AnswerRe: Problem with recording voice from multiple microphones Pin
DaveyM6916-Sep-08 3:22
professionalDaveyM6916-Sep-08 3:22 
GeneralRe: Problem with recording voice from multiple microphones Pin
MeContra16-Sep-08 3:47
MeContra16-Sep-08 3:47 
GeneralRe: Problem with recording voice from multiple microphones Pin
DaveyM6916-Sep-08 4:05
professionalDaveyM6916-Sep-08 4:05 
GeneralRe: Problem with recording voice from multiple microphones Pin
MeContra16-Sep-08 4:15
MeContra16-Sep-08 4:15 
GeneralRe: Problem with recording voice from multiple microphones Pin
DaveyM6916-Sep-08 9:50
professionalDaveyM6916-Sep-08 9:50 
GeneralRe: Problem with recording voice from multiple microphones Pin
MeContra16-Sep-08 20:34
MeContra16-Sep-08 20:34 
GeneralRe: Problem with recording voice from multiple microphones Pin
DaveyM6916-Sep-08 23:49
professionalDaveyM6916-Sep-08 23:49 
Questionwindows service Pin
arkiboys16-Sep-08 2:56
arkiboys16-Sep-08 2:56 
AnswerRe: windows service Pin
leppie16-Sep-08 3:08
leppie16-Sep-08 3:08 
GeneralRe: windows service Pin
arkiboys16-Sep-08 3:16
arkiboys16-Sep-08 3:16 
GeneralRe: windows service Pin
leppie16-Sep-08 3:32
leppie16-Sep-08 3:32 
GeneralRe: windows service Pin
arkiboys16-Sep-08 3:39
arkiboys16-Sep-08 3:39 
AnswerRe: windows service Pin
Kjetil Svendsen16-Sep-08 3:52
Kjetil Svendsen16-Sep-08 3:52 
GeneralRe: windows service Pin
#realJSOP16-Sep-08 4:27
professional#realJSOP16-Sep-08 4:27 
AnswerRe: windows service Pin
#realJSOP16-Sep-08 4:27
professional#realJSOP16-Sep-08 4:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.