Simple filtering in realtime - again...
Fruskus <[email protected]>
| Newsgroups | gmane.comp.lib.openal |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I keep working on my realtime app.
I've been trying to find the cause of the troubles I had, but I'm still
stuck.
I'm testing now a simple DC blocking filter (just a high pass filter); it
seems to work in terms of frequency, but it adds a very loud constant noise.
Here's a piece of the code - the rest of the main code is the
capture-playback routine with queue- :
...
alcCaptureSamples(pCaptureDevice, Buffer,BUFFERSIZE / lBlockAlignment);
// This part is for separating left-right channels
int i;
for(i=0;i<BUFFERSIZE/2;i++){
entport[i]=float((Buffer[2*i])/32768); // entport: input signal - left
channel
//right channel not needed right now
}
DCfilter(entport,portnodc,BUFFERSIZE/2); // portnodc: input signal no dc
for(i=0;i<BUFFERSIZE/2;i++){
BufferSalida[i]=ALshort(32767*portnodc.y[i]); // BufferSalida: Output
buffer
}
// Attaching data to buffer
alBufferData(BufferID[ulQueueCount], PlayFormat, BufferSalida, BUFFERSIZE/2,
lFrequency);
...
----------------------------------------
void DCfilter(samplesvector &x, nodctype &y, int size){
int i;
float a=0.995;
for (i=0;i<size;i++){
y.y[i]=x[i]-(y.xdcant)+(a*y.ydcant); //xdcant, ydcant: previous signal
values.
y.xdcant=x[i];
y.ydcant=y.y[i];
}
}
----------------------------------------
where:
typedef float samplesvector[BUFFERSIZE/2];
typedef struct {
samplesvector y;
float xdcant;
float ydcant;
}nodctype;
----------------------------------------
I'm a little bit overwhelmed about not being able to make this work, so, any
help will be appreciated.
Any ideas?
Thanks in advance.
--
View this message in context: http://old.nabble.com/Simple-filtering-in-realtime---again...-tp28287632p28287632.html
Sent from the OpenAL - User mailing list archive at Nabble.com.
_______________________________________________
Openal mailing list
[email protected]
http://opensource.creative.com/mailman/listinfo/openal