Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!valid!caber!lou From: lou@caber.valid.com (Louis K. Scheffer) Newsgroups: comp.dsp Subject: Re: 48k to 44.1k sample rate conversion Message-ID: <502@valid.valid.com> Date: 28 May 91 02:47:43 GMT References: <5826@media-lab.media.mit.edu.MEDIA.MIT.EDU> <457@valid.valid.com> <42200@ucbvax.BERKELEY.EDU> <498@valid.valid.com> <42250@ucbvax.BERKELEY.EDU> Sender: news@valid.com Lines: 60 parks@bennett.berkeley.edu (Tom Parks) writes: >In article <498@valid.valid.com>, lou@caber.valid.com (Louis K. Scheffer) writes: [...Lots of discussion deleted, with Lou advocating direct convolution and Tom advocating cascaded filters...] >|> 14000 coefficients gets +- 0.05 db passband, 104 db rejection stopband. >Ok, I went ahead and did a design for converting from 48 kHz to 44.1 kHz. >I cascaded 3 FIR filters to do this. Their sample rate conversion ratios were >3:2, 7:5, and 7:16 and they required 147, 75, and 53 taps respectively. >Each filter had a pass band ripple of less than 0.05 dB and stop band >rejection of over 100 dB. This is not quite as good a filter, since at some point all the ripples will add up to .15 db of ripple. If you have N cascaded filters then the sum of their errors should be the same as the single filter. You probably do best by making the small filters really flat and putting most of the error in the big one. >|> plus the book-keeping is *much* more complex. The direct approach is a one >|> or two instruction loop on most DSP chips, for 100 or 200 cycles per output >|> point. I doubt you can do the bookkeeping alone in less than 100 cycles >|> per output point for the method above. >Since the three filters are cascaded, there isn't really any addtional > overhead. Each filter is a one or two instruction loop, >and there's one of these loops for each filter. You're right - the book-keeping overhead per output point can be made negligible with either method. However, the cascaded method will require considerably more code. It takes the same amount per filter, plus figuring out when to run each filter. This does not look like a code size problem, though (perhaps 60? instructions vs 10 for direct) However, the direct method has the advantage of taking a uniform time per output point. Although the average of the cascaded filter is not much worse, it will be quite a bit more variable. In a real time environment such as digital audio, this means either planning for the peak computational needs of the cascaded filter, or using considerable RAM for buffering. [... 275 coefficients required for cascaded filter ... ] If you need to go both from 48->44.1 and 44.1->48, you can use the same coefficients in the direct case, but you will need another completely different filter in the cascaded case. However, if you needed one of the intermediate rates (perhaps using the 100.8 KHz for oversampled analog output, for example) you can get this for free with the cascaded filter. Thus the direct approach has the advantages: Fewer multiply accumulates for equivalent specs, 95 vs 112 Simpler code (10 instructions vs 60? ) Lower peak compute requirement per point. The cascaded approach offers: Fewer coefficients to store. 275 (550 for both ways) vs 14000 Some intermediate rates available for free Easier to design (1 min cpu vs 10 hours) -Lou Scheffer