Sign in

username:

password:



Not a member?

Search audiodsp



Search tips

Subscribe to audiodsp



audiodsp by Keywords

AAC | ADPCM | Convolution | DAFx | FFT | IIR | Mixer | MP3 | MPEG | MPEG-4

Discussion Groups

Discussion Groups | Audio Signal Processing | Data types in Audio Signal Processing

Technical discussions related to Audio Signal Processing (digital effects, acoustics, noise reduction, musical signal processing, etc).

  

Post a new Thread

Data types in Audio Signal Processing - akin...@hotmail.com - Apr 20 8:22:57 2008



Hello
 
I want to implement my own audio equalizer. 
 
First of all I create FIR& IIR bandpass filters but they process"doubl" or
"float" samples. But I get sound samples as shorts ( 16bit) from both Directshow and
Waveout API. How can I handle data type conversion between floaats and shorts ?
 
They say that i must divide shorts by 32768 to get floats. But  how should I put my processed
floats back ?
 
Best Regards,
Akın Öcal

------------------------------------



(You need to be a member of audiodsp -- send a blank email to audiodsp-subscribe@yahoogroups.com )

Re: Data types in Audio Signal Processing - Grzegorz Kraszewski - Apr 21 8:20:41 2008

On Sat, 19 Apr 2008, a...@hotmail.com wrote:

> They say that i must divide shorts by 32768 to get floats.

That's true. Just remember to convert to floats before division. In C it 
looks like:

float_sample = (float)short_sample * 3.05175781e-05;

I've used multiplying by (1/32768) instead of division, as most processors 
are faster at multiplication than division.

> But how should I put my processed floats back ?

Just multiply them by 32768 and then cast to shorts. Assuming your filter
never produces samples out of <-1.0; +32767/32768> range. It is easily 
achieved with normalized FIR.

-- 
Grzegorz Kraszewski <k...@teleinfo.pb.edu.pl>
http://teleinfo.pb.edu.pl/~krashan

------------------------------------



(You need to be a member of audiodsp -- send a blank email to audiodsp-subscribe@yahoogroups.com )