Hi @ all,
i´m a newbie on programming audio.
I try to capture speech from Microphone and streaming fragments of a capture buffer to network.
I send the fragments by catching the Notification Event.
My Capture Buffer is 2560b big and is seperated in 4 segments.
Every segment gets 20ms of speech. The Samplerate is 16kHz with 16 bits per sample.
Here my Code of the Notification Thread.
DWORD capturePos, readPos;
readPos >= m_NextOffset ?
diff = readPos - m_NextOffset :
diff = readPos + m_BufferSize - m_NextOffset;
if(diff < m_NotifySize) return;
//Lock the capture Buffer
VOID* lockedBufferPointer = NULL;
m_captureBuffer->Lock(m_NextOffset, m_NotifySize, &lockedBufferPointer, &lockedBufferSize, NULL, NULL, 0L);
//Put data to Output Sink
const int SIZE = lockedBufferSize/2;
//write to wave file
//edit the sample
//Unlock the capture Buffer
m_captureBuffer->Unlock(lockedBufferPointer, lockedBufferSize, NULL, 0);
//Move the capture offset along
m_NextOffset += lockedBufferSize;
m_NextOffset %= m_BufferSize;
My Problem is that the speech I´m sending is very noisy after capturing.
What could I do wrong by Capturing?
I don´t know on and it´s hard to find some good information about capturing by directsound.