RE: Simple filtering in realtime - again...

Carlos Alberto Hernández <[email protected]>
Newsgroups gmane.comp.lib.openal
Message-ID <[email protected]>
Thank you Dan, but I'm afraid that didn't work. I think there's something wrong with de casting, but I'm not very sure what is it, or how to fix it.



Subject: Re: [Openal] Simple filtering in realtime - again...
To: [email protected]; [email protected]
From: [email protected]
Date: Tue, 20 Apr 2010 09:38:40 +0100


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 <[email protected]>











Fruskus <[email protected]> 

Sent by: [email protected]
19/04/2010 10:41








To

[email protected]



cc





Subject

[Openal] Simple filtering in realtime - again...











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    
 		 	   		  
_________________________________________________________________
¡Citas! ¡Ligues! ¿Salimos? ¿Cómo es tu pareja ideal? Búscala en el sitio nº1… ¡Regístrate ya!
http://contactos.es.msn.com/?mtcmk=015352

_______________________________________________
Openal mailing list
[email protected]
http://opensource.creative.com/mailman/listinfo/openal
graycol.gif (image/gif, 105 B) - not displayed
pic09514.gif (image/gif, 1.2 KB) - not displayed
ecblank.gif (image/gif, 45 B) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.