Click here to Skip to main content
15,887,376 members
Home / Discussions / C#
   

C#

 
GeneralRe: Eventargs click event runtime created labels Pin
Mbah Dhaim30-Sep-08 10:15
Mbah Dhaim30-Sep-08 10:15 
GeneralRe: Eventargs click event runtime created labels Pin
RobScripta30-Sep-08 10:38
professionalRobScripta30-Sep-08 10:38 
GeneralRe: Eventargs click event runtime created labels Pin
Dan Neely30-Sep-08 10:52
Dan Neely30-Sep-08 10:52 
GeneralRe: Eventargs click event runtime created labels Pin
Mycroft Holmes30-Sep-08 22:58
professionalMycroft Holmes30-Sep-08 22:58 
GeneralRe: Eventargs click event runtime created labels Pin
DaveyM691-Oct-08 2:05
professionalDaveyM691-Oct-08 2:05 
QuestionHow store formatted text [modified] Pin
sepel30-Sep-08 9:05
sepel30-Sep-08 9:05 
AnswerRe: How store formatted text Pin
User 665830-Sep-08 10:07
User 665830-Sep-08 10:07 
QuestionRecording Voice from microphone Pin
Ha ha ha ha ha ha ha ha30-Sep-08 8:12
Ha ha ha ha ha ha ha ha30-Sep-08 8:12 
Hi Everyone.
I'm developing an application which needs to record voice from microphone and save it in a wav file.
But the voice being recorded, isn't clear, it's lost some part something like 1-0-1-0-1-0-1...
which the 1s indicate the voice is present and the 0s indicate that there's no voice present, each ones duration is about 500ms.
Here is my code. Where is the problem?

mem2Write[uu] = new MemoryStream();
captureDeviceCollection = new CaptureDevicesCollection();

DeviceInformation deviceInfo = captureDeviceCollection[sh];

CaptureBufferDescription captureBufferDescription = new CaptureBufferDescription();
captureBufferDescription.BufferBytes = waveFormat.AverageBytesPerSecond / 5;
captureBufferDescription.Format = waveFormat;

BufferDescription playbackBufferDescription = new BufferDescription();
playbackBufferDescription.BufferBytes = waveFormat.AverageBytesPerSecond / 5;
playbackBufferDescription.Format = waveFormat;
SecondaryBuffer playbackBuffer = new SecondaryBuffer(playbackBufferDescription, device);

int bufferSize = captureBufferDescription.BufferBytes;


Capture capture = new Capture(deviceInfo.DriverGuid);

CaptureBuffer captureBuffer = new CaptureBuffer(captureBufferDescription, capture);
CreateNotifyPositions(captureBuffer, bufferSize);
//int halfBuffer = bufferSize / 2;
int tenBuffer = bufferSize / 10;

//int halfBuffer = bufferSize;
captureBuffer.Start(true);

//bool readFirstBufferPart = true;
int readFirstBufferPart = 0;
int offset = 0;
mem2Write[uu].Position = 0;
MemoryStream memStream = new MemoryStream(tenBuffer);

bStop = false;

while (!bStop)
{
autoResetEvent.WaitOne();
memStream.Seek(0, SeekOrigin.Begin);
captureBuffer.Read(offset, memStream, tenBuffer, LockFlag.None);
//readFirstBufferPart = !readFirstBufferPart;
readFirstBufferPart= (readFirstBufferPart+1)% 10;
//offset = readFirstBufferPart ? 0 : thirdBuffer;
offset = tenBuffer * readFirstBufferPart;
//TODO: Fix this ugly way of initializing differently.
//Choose the vocoder. And then send the data to other party at port 1550.
//dataToWrite
mem2Write[uu].Write(memStream.GetBuffer(), 0, (Int32)memStream.Length);

mem2Write[uu].Position += (Int32)memStream.Length;

}
AnswerRe: Recording Voice from microphone Pin
Mbah Dhaim30-Sep-08 10:29
Mbah Dhaim30-Sep-08 10:29 
GeneralRe: Recording Voice from microphone Pin
Ha ha ha ha ha ha ha ha30-Sep-08 22:25
Ha ha ha ha ha ha ha ha30-Sep-08 22:25 
GeneralRe: Recording Voice from microphone Pin
fiko851-Oct-08 7:05
fiko851-Oct-08 7:05 
GeneralRe: Recording Voice from microphone Pin
Ha ha ha ha ha ha ha ha2-Oct-08 22:15
Ha ha ha ha ha ha ha ha2-Oct-08 22:15 
QuestionMultiple Threads Pin
Ha ha ha ha ha ha ha ha30-Sep-08 8:10
Ha ha ha ha ha ha ha ha30-Sep-08 8:10 
AnswerRe: Multiple Threads Pin
Ashfield30-Sep-08 21:20
Ashfield30-Sep-08 21:20 
GeneralRe: Multiple Threads Pin
Ha ha ha ha ha ha ha ha30-Sep-08 22:35
Ha ha ha ha ha ha ha ha30-Sep-08 22:35 
QuestionReg:Data Grid Display index and Scrool bar problem Pin
Member 400849230-Sep-08 7:28
Member 400849230-Sep-08 7:28 
AnswerRe: Reg:Data Grid Display index and Scrool bar problem Pin
Mycroft Holmes30-Sep-08 23:06
professionalMycroft Holmes30-Sep-08 23:06 
QuestionGet FileInfo of an Audio [modified] Pin
schiebel-t30-Sep-08 7:09
schiebel-t30-Sep-08 7:09 
AnswerRe: Get FileInfo of an Audio Pin
Giorgi Dalakishvili30-Sep-08 7:55
mentorGiorgi Dalakishvili30-Sep-08 7:55 
GeneralRe: Get FileInfo of an Audio Pin
schiebel-t1-Oct-08 6:20
schiebel-t1-Oct-08 6:20 
GeneralRe: Get FileInfo of an Audio Pin
Giorgi Dalakishvili1-Oct-08 7:41
mentorGiorgi Dalakishvili1-Oct-08 7:41 
Questionarray[key][value] Pin
nuttynibbles30-Sep-08 6:47
nuttynibbles30-Sep-08 6:47 
AnswerRe: array[key][value] Pin
Dan Neely30-Sep-08 6:58
Dan Neely30-Sep-08 6:58 
GeneralRe: array[key][value] Pin
nuttynibbles30-Sep-08 7:07
nuttynibbles30-Sep-08 7:07 
AnswerRe: array[key][value] Pin
User 665830-Sep-08 7:32
User 665830-Sep-08 7:32 

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.