I need to process frame subbands before synthesis occurs. Libmad conveniently makes them available through its filtering feature. However the information around filtering is rather limited. I have studied the source code in filter.c and (think that I) have read all the relevant articles in this list, so I understand the basics, however I do have a few more questions:
1. What are the units and range of values for each subband? Must these values be scaled before they can be used?
[I saw in a list article that subband values range from -MAD_F_ONE to MAD_F_ONE. Have these values been scaled?]
2. What are the frequency ranges that each subband covers?
Many thanks.
Bill
On Sunday, June 29, 2003, at 10:02 PM, Bill Zissimopoulos wrote:
I need to process frame subbands before synthesis occurs. Libmad conveniently makes them available through its filtering feature. However the information around filtering is rather limited. I have studied the source code in filter.c and (think that I) have read all the relevant articles in this list, so I understand the basics, however I do have a few more questions:
- What are the units and range of values for each subband? Must these
values be scaled before they can be used?
[I saw in a list article that subband values range from -MAD_F_ONE to MAD_F_ONE. Have these values been scaled?]
The range of subband values follows the same scale in the frequency domain as the resulting PCM samples do in the time domain, namely [-1.0, +1.0). In MAD's fixed-point integer representation, that is -MAD_F_ONE to MAD_F_ONE - 1. However, while these are the limits of full scale, it is not impossible for some values to fall slightly outside this range. (Detecting this is one way to avoid clipping, by attenuating or limiting samples to compensate.)
See the header file fixed.h in the libmad distribution for details of the fixed-point representation. Basically each integer unit represents 2^-28 or 1/MAD_F_ONE.
- What are the frequency ranges that each subband covers?
That depends on the sampling frequency. Generally the entire frequency spectrum (up to the Nyquist frequency) has been divided into 32 equal-sized frequency bands. However, due to the nature of the synthesis filter there is some overlap between bands, and this makes applying anything other than a uniform filter on the subbands tricky at best. For example, trying to implement a general EQ against the subband samples will have disappointing results.
On Wed, Jul 02, 2003 at 05:17:34PM -0700, Rob Leslie wrote:
On Sunday, June 29, 2003, at 10:02 PM, Bill Zissimopoulos wrote:
- What are the frequency ranges that each subband covers?
That depends on the sampling frequency. Generally the entire frequency spectrum (up to the Nyquist frequency) has been divided into 32 equal-sized frequency bands. However, due to the nature of the synthesis filter there is some overlap between bands, and this makes applying anything other than a uniform filter on the subbands tricky at best. For example, trying to implement a general EQ against the subband samples will have disappointing results.
I had a question similar to Bill's query but before going to the mailing list I did a little experiment. I synthesized specialy crafted frame where all subbands are except one:
for(j=0;j<32;j++) SubBandsTemplate[j]=0; SubBandsTemplate[i]=MAD_F_ONE-1;
These frame were synthesized and the PCM analyzed through fftw: I got strange results.
The fake frame were as if comming from a 192000 kb/s audio mpeg layer III stream with crc, normal LR stereo with no emphasis at 48000 Hz sample rate. The measured center frequency is the same for two consecutive bands except for DC and the Nyquist frequency. Here is the output of the test program:
subband #0: peak power at 0 Hz subband #1: peak power at 1500 Hz subband #2: peak power at 1500 Hz subband #3: peak power at 3000 Hz subband #4: peak power at 3000 Hz subband #5: peak power at 4500 Hz subband #6: peak power at 4500 Hz subband #7: peak power at 6000 Hz subband #8: peak power at 6000 Hz subband #9: peak power at 7500 Hz subband #10: peak power at 7500 Hz subband #11: peak power at 9000 Hz subband #12: peak power at 9000 Hz subband #13: peak power at 10500 Hz subband #14: peak power at 10500 Hz subband #15: peak power at 12000 Hz subband #16: peak power at 12000 Hz subband #17: peak power at 13500 Hz subband #18: peak power at 13500 Hz subband #19: peak power at 15000 Hz subband #20: peak power at 15000 Hz subband #21: peak power at 16500 Hz subband #22: peak power at 16500 Hz subband #23: peak power at 18000 Hz subband #24: peak power at 18000 Hz subband #25: peak power at 19500 Hz subband #26: peak power at 19500 Hz subband #27: peak power at 21000 Hz subband #28: peak power at 21000 Hz subband #29: peak power at 22500 Hz subband #30: peak power at 22500 Hz subband #31: peak power at 24000 Hz
I can't explain this behaviour. It is expected or is it a bug in my test program (note that I'm familiar with the fftw library, I may had used it improperly).