Problem with recording from multiple microphones!
Home > Home Recording Forum > Computers & Software > Problem with recording from multiple microphones!
Posted on Sep 18, 2008 01:30 pm
serima
Member Since: Sep 18, 2008
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
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:
private void Start()
{
ThreadStart ts1 = new ThreadStart(doit1);
ThreadStart ts2 = new ThreadStart(doit2);
t1 = new Thread(ts1);
t2 = new Thread(ts2);
t1.Start();
t2.Start();
}
private void doit1()
{
String filename = FilenameBox.Text;
String ending = ".wav";
RecorderOutputStream = new MemoryStream();
WaveLib.WaveFormat fmt = new WaveLib.WaveFormat(44100, 16, 2);
m_Recorder = new WaveLib.WaveInRecorder(Int16.Parse(SoundDeviceBox.Text), fmt, 2048, 1, new WaveLib.BufferDoneEventHandler(DataArrived));
fs = new FileStream(filename + ending, System.IO.FileMode.Create);
}
private void doit2()
{
String filename1 = FilenameBox1.Text;
String ending = ".wav";
RecorderOutputStream1 = new MemoryStream();
WaveLib.WaveFormat fmt = new WaveLib.WaveFormat(44100, 16, 2);
m_Recorder1 = new WaveLib.WaveInRecorder(Int16.Parse(SoundDeviceBox1.Text), fmt, 2048, 1, new WaveLib.BufferDoneEventHandler(DataArrived1));
fs1 = new FileStream(filename1 + ending, System.IO.FileMode.Create);
}
//& These are my DataArrived functions :
private void DataArrived(IntPtr data, int size)
{
if (m_RecBuffer == null || m_RecBuffer.Length < size)
m_RecBuffer = new byte[size];
System.Runtime.InteropServices.Marshal.Copy(data, m_RecBuffer, 0, size);
RecorderOutputStream.Write(m_RecBuffer, 0, m_RecBuffer.Length);
}
private void DataArrived1(IntPtr data, int size)
{
if (m_RecBuffer1 == null || m_RecBuffer1.Length < size)
m_RecBuffer1 = new byte[size];
System.Runtime.InteropServices.Marshal.Copy(data, m_RecBuffer1, 0, size);
RecorderOutputStream.Write(m_RecBuffer1, 0, m_RecBuffer1.Length);
}
Thanks in forward Smile
[ Back to Top ]
pjkPrince CZAR-mingMember
Since: Apr 08, 2004
Sep 18, 2008 01:39 pm I too, am anxiously awaiting an answer.
=)
NightcapVeni, MIDI, ViciMember
Since: Jul 02, 2008
Sep 18, 2008 02:57 pm Are you sure that winmm.dll can handle writing multiple tracks to multiple files? It's a long time ago, but in my recollection all the recording buffers are written in one combined, single, stereo file.
Sep 18, 2008 03:48 pm That sound you just heard was my head assploding.
NightcapVeni, MIDI, ViciMember
Since: Jul 02, 2008
Sep 18, 2008 09:07 pm Quote: That sound you just heard was my head assploding.
Thought I heard a sonic boom this afternoon...
Noize2uCzar of MidiAdministrator
Since: Apr 04, 2002
Sep 18, 2008 10:23 pm Funny enough I heard it too.
I believe Nightcap is correct on the single file output. But don't quote me on that either.
One thing is that in order to do multiple input streams to multiple outputs streams there needs to be a code for a stream mixer that would define each input stream and direct it to a separate output stream to create separate audio files in the end.
Are you doing this as a project or a different purpose.
You could always head over to someplace like KVR and grab one of the apps that does what you want to do and have a peak at the code they used.
Not sure if any would be written like that but its worth a look.
Dematrixhttp://www.reverbnation.com/2ndgMember
Since: Nov 27, 2007
Sep 19, 2008 10:12 am that sonic boom was me,
sorry i had chilli last night(blush)
NightcapVeni, MIDI, ViciMember
Since: Jul 02, 2008
Sep 19, 2008 01:37 pm Quote: that sonic boom was me,
sorry i had chilli last night(blush)
Maybe a good starting point for one of those bass drops???
Sep 19, 2008 01:40 pm I did a spectrum analysis on one of mine and it peaked at 35 Hz. Might be worth a try.
Noize2uCzar of MidiAdministrator
Since: Apr 04, 2002
Sep 19, 2008 06:19 pm Nice Friday afternoon humor.
Dematrixhttp://www.reverbnation.com/2ndgMember
Since: Nov 27, 2007
Sep 19, 2008 07:44 pm my spectrum analysis said, hey! thats "rectum", not spectrum!
Dematrixhttp://www.reverbnation.com/2ndgMember
Since: Nov 27, 2007
Sep 19, 2008 07:46 pm sorry, a bit of leakage into Sat morning.
Noize2uCzar of MidiAdministrator
Since: Apr 04, 2002
Sep 19, 2008 08:08 pm Its still Friday night here so all is good.
At least we are having some fun while waiting for serima to get back to the thread.
Dematrixhttp://www.reverbnation.com/2ndgMember
Since: Nov 27, 2007
Sep 19, 2008 08:25 pm so what does all that stuff mean???
Noize2uCzar of MidiAdministrator
Since: Apr 04, 2002
Sep 19, 2008 08:29 pm Its coding for making a multitrack recording application of sorts. Kind of the hard way to do it and one bit of the code he is trying to use is probably not going to allow mulitple streams of audio to be broken out into multiple files to the end source.
Thats why I asked if it was a project of sorts. If it isn't then he would be well served to simply go download one of the freeware multi track apps out there.
Noize2uCzar of MidiAdministrator
Since: Apr 04, 2002
Sep 19, 2008 09:25 pm -.-- --- ..- .-- . .-.. -.-. --- -- . --..-- .. - .... --- ..- --. .... - -.-- --- ..- -- .. --. .... - .... . .-. -... .-.-.-
Nice decoder by the way, except for it needing the extra spaces to read the morse code properly.
Sep 19, 2008 10:54 pm -.-- --- ..- --. ..- -.-- ... .- .-. . .-- .- -.-- - --- --- -.-. --- --- .-.. ..-. --- .-. -- . .-.-.-
Dematrixhttp://www.reverbnation.com/2ndgMember
Since: Nov 27, 2007
Sep 19, 2008 10:59 pm *^#!!? (*!@t? ^>!!#" <*&#!!>
NightcapVeni, MIDI, ViciMember
Since: Jul 02, 2008
Sep 19, 2008 11:12 pm Interesting where this thread is going.
This is how "thanksnoize.ifeelbetternow." would look like the way I was taught:
-/..../.-/-./-.-/.../-./---/../--.././.-.-.-/../..-./././.-../-..././-/-/./.-./-./---/.--/.-.-.-/
It's much easier to read. I programmed a morse2text/text2morse converter a couple of years ago based on this notation. I made it even possible to listen how the morse results sound.
Noize2uCzar of MidiAdministrator
Since: Apr 04, 2002
Sep 20, 2008 12:13 am .-- . .-.. .-.. --..-- .- - .-.. . .- ... - - .... .. ... - .... .-. . .- -.. .. ... ... - .- -.-- .. -. --. --- -. - .... . ... ..- -... .--- . -.-. - --- ..-. -.-. --- -.. . - --- .- -.-. . .-. - .- .. -. -.. . --. .-. . . .-.-.-
Or so it would seem anyway.
serimaMember
Since: Sep 18, 2008
Sep 20, 2008 12:43 am Hi everyone, thanks for your cooperation, sorry for my absence, I was tryin' to find some answer to my question. This is some part of a project, means that I can't download any apps, I have to write the codes myself. I don't know what the morse code was about to do in this project, neither what most of the others were talkin' about. As a reply to nightcap, I should say that, no, I'm not sure of it being able to multiple tracks, but as I didn't succeed using DirectX, I managed using the winmm.dll. But I'll be happy to hear any other solution.
serimaMember
Since: Sep 18, 2008
Sep 20, 2008 12:46 am & just to inform u, I'm a she, not a he.
serimaMember
Since: Sep 18, 2008
Sep 20, 2008 12:53 am & what is a spectrum analysis?
NightcapVeni, MIDI, ViciMember
Since: Jul 02, 2008
Sep 20, 2008 01:40 am Hi serima, I figured that you would be a she. :-)
I really think that the winmm.dll road will lead to nowhere. It's an old dll designed to only work with 2 output channels in stereo or mono.
Although I never worked on anything that had to record sound, my educated guess is that you are best off using DirectX. For that you'll need the DirectX SDK for Visual Studio 2005.
There is a version for VS 2008, but please read the release notes because there is something in it concerning VS 2005.
msdn.microsoft.com/en-us/directx/aa937789.aspx
Hope this helps a little.
NightcapVeni, MIDI, ViciMember
Since: Jul 02, 2008
Sep 20, 2008 01:47 am Quote:
& what is a spectrum analysis?
A short definition:
A hardware device or software program used to examine the frequency and power components of a sound signal.
NightcapVeni, MIDI, ViciMember
Since: Jul 02, 2008
Sep 20, 2008 01:50 am Quote:
Or so it would seem anyway.
LOL That's why I posted what I posted!
Sep 20, 2008 02:22 am Quote:
-/..../.-/-./-.-/.../-./---/../--.././.-.-.-/../..-./././.-../-..././-/-/./.-./-./---/.--/.-.-.-/
01001101 01101111 01110010 01110011 01100101 00100000 01000011 01101111 01100100 01100101 00111111 00100000 00100000 01001000 01101111 01110111 00100000 01110001 01110101 01100001 01101001 01101110 01110100 00101110 00100000 00100000
NightcapVeni, MIDI, ViciMember
Since: Jul 02, 2008
Sep 20, 2008 03:23 am Quote:
01001101 01101111 01110010 01110011 01100101 00100000 01000011 01101111 01100100 01100101 00111111 00100000 00100000 01001000 01101111 01110111 00100000 01110001 01110101 01100001 01101001 01101110 01110100 00101110 00100000 00100000
54 68 69 6E 6B 20 73 6F 3F
Sep 20, 2008 10:01 am Orrysay athay isthay readthay asway otnay oremay elpfulhay, Erimasay.
Noize2uCzar of MidiAdministrator
Since: Apr 04, 2002
Sep 20, 2008 12:34 pm I did a little research as well and as Nightcap stated the dll will only do a single stereo file. There does not appear to be a way to force a multiple channel stream from it. DX might be the best route with the updated file set. That is how many of the panels were made for use in software such as Cakewalk.
Nightcap, I figured that was why.