Downsampling and applying a lowpass filter to digital audio

后端 未结 10 806
北恋
北恋 2021-02-02 17:41

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 engine

10条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-02 18:14

    You're right in that you need apply lowpass filtering on your signal. Any signal over 5500 Hz will be present in your downsampled signal but 'aliased' as another frequency so you'll have to remove those before downsampling.

    It's a good idea to do the filtering with floats. There are fixed point filter algorithms too but those generally have quality tradeoffs to work. If you've got floats then use them!

    Using DFT's for filtering is generally overkill and it makes things more complicated because dft's are not a contiuous process but work on buffers.

    Digital filters generally come in two tastes. FIR and IIR. The're generally the same idea but IIF filters use feedback loops to achieve a steeper response with far less coefficients. This might be a good idea for downsampling because you need a very steep filter slope there.

    Downsampling is sort of a special case. Because you're going to throw away 3 out of 4 samples there's no need to calculate them. There is a special class of filters for this called polyphase filters.

    Try googling for polyphase IIR or polyphase FIR for more information.

提交回复
热议问题