Re: Simple filtering in realtime - again...
Daniel PEACOCK <[email protected]>
| Newsgroups | gmane.comp.lib.openal |
|---|---|
| Message-ID | <OFFA068A4D.5B4359C2-ON8825770B.002F22BD-8025770B.002F7C3D@cli.creaf.com> |
I think this line is wrong ...
entport[i]=float((Buffer[2*i])/32768);
because you are doing an integer division and then casting the result to a
float. It should be something like ...
entport[i]=Buffer[2*i]/32768.0f;
Dan
Creative Labs (UK) Ltd.
Notice
The information in this message is confidential and may be legally
privileged. It is intended solely for the addressee. Access to this
message by anyone else is unauthorized. If you are not the intended
recipient, any disclosure, copying or distribution of the message, or
any action taken by you in reliance on it, is prohibited and may be
unlawful. If you have received this message in error, please delete it
and contact the sender immediately. Thank you.
Creative Labs UK Ltd company number 2658256 registered in England and Wales
at 79 Knightsbridge, London SW1X 7RB
Fruskus
<karlonchiz@hotma
il.com> To
Sent by: [email protected]
openal-bounces@op cc
ensource.creative
.com Subject
[Openal] Simple filtering in
realtime - again...
19/04/2010 10:41
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
ForwardSourceID:NT0007A2DE
_______________________________________________
Openal mailing list
[email protected]
http://opensource.creative.com/mailman/listinfo/openal