Downsampling and applying a lowpass filter to digi

2019-03-12 20:34发布

I've got a 44Khz audio stream from a CD, represented as an array of 16 bit PCM samples. I'd like to cut it down to an 11KHz stream. How do I do that? From my days of engineering class many years ago, I know that the stream won't be able to describe anything over 5500Hz accurately anymore, so I assume I want to cut everything above that out too. Any ideas? Thanks.

Update: There is some code on this page that converts from 48KHz to 8KHz using a simple algorithm and a coefficient array that looks like { 1, 4, 12, 12, 4, 1 }. I think that is what I need, but I need it for a factor of 4x rather than 6x. Any idea how those constants are calculated? Also, I end up converting the 16 byte samples to floats anyway, so I can do the downsampling with floats rather than shorts, if that helps the quality at all.

10条回答
Viruses.
2楼-- · 2019-03-12 21:08

I recently came across BruteFIR which may already do some of what you're interested in?

查看更多
地球回转人心会变
3楼-- · 2019-03-12 21:11

Read on FIR and IIR filters. These are the filters that use a coefficent array.

If you do a google search on "FIR or IIR filter designer" you will find lots of software and online-applets that does the hard job (getting the coefficients) for you.

EDIT:

This page here ( http://www-users.cs.york.ac.uk/~fisher/mkfilter/ ) lets you enter the parameters of your filter and will spit out ready to use C-Code...

查看更多
走好不送
4楼-- · 2019-03-12 21:12

The process you're after called "Decimation". There are 2 steps:

  1. Applying Low Pass Filter on the data (In your case LPF with Cut Off at Pi / 4).
  2. Downsampling (In you case taking 1 out of 4 samples).

There are many methods to design and apply the Low Pass Filter.

You may start here:

http://en.wikipedia.org/wiki/Filter_design

查看更多
家丑人穷心不美
5楼-- · 2019-03-12 21:15

I would try applying DFT, chopping 3/4 of the result and applying inverse DFT. I can't tell if it will sound good without actually trying tough.

查看更多
登录 后发表回答