How can I validate an A-Weighted filter with data other than a sine wave? I have an A-Weighted filter, that I obtained from the the Internet. I have tested it against sine wave frequencies starting from 20Hz to 20kHz in 1/3 octaves. The filter matches the expected decibel values. Should rely I solely upon testing the filter against sine waves? I dont know if using more complex waveforms may show the filter is not working as expected. Unfortunately, sine waves are the only thing I can validate. I tried running complex waveforms through different programs and comparing the results with my own, however none of the programs agreed on what the weighted decibel value of the data file was. How else can I validate the filter? If it makes a difference, I am not a MATLAB user. I simply using C. Thank you, Waverly
Validating an A-Weighted filter
Started by ●September 21, 2010
Reply by ●September 21, 20102010-09-21
WaverlyE wrote:> How can I validate an A-Weighted filter with data other than a sine wave? > I have an A-Weighted filter, that I obtained from the the Internet.Obtained from the Internet is a synonym of junk.> I have > tested it against sine wave frequencies starting from 20Hz to 20kHz in 1/3 > octaves. The filter matches the expected decibel values. Should rely I > solely upon testing the filter against sine waves? I dont know if using > more complex waveforms may show the filter is not working as expected. > Unfortunately, sine waves are the only thing I can validate. I tried > running complex waveforms through different programs and comparing the > results with my own, however none of the programs agreed on what the > weighted decibel value of the data file was. How else can I validate the > filter?You got to match the phase response of the filter to the IEC specified S-domain function as well as the amplitude response.> If it makes a difference, I am not a MATLAB user. I simply using > C.Good man. Matlab is for students and their toy problems. VLV
Reply by ●September 21, 20102010-09-21
On 09/21/2010 09:39 AM, WaverlyE wrote:> How can I validate an A-Weighted filter with data other than a sine wave? > I have an A-Weighted filter, that I obtained from the the Internet. I have > tested it against sine wave frequencies starting from 20Hz to 20kHz in 1/3 > octaves. The filter matches the expected decibel values. Should rely I > solely upon testing the filter against sine waves?If the filter is linear, then you should be able to completely characterize it with the amplitude (and as Vladimir pointed out) the phase response to a sine wave.> I dont know if using > more complex waveforms may show the filter is not working as expected.It would certainly show phase errors, and would show nonlinearities under the right circumstances (which vary depending on the nonlinearities).> Unfortunately, sine waves are the only thing I can validate. I tried > running complex waveforms through different programs and comparing the > results with my own, however none of the programs agreed on what the > weighted decibel value of the data file was.Welcome to engineering.> How else can I validate the > filter? If it makes a difference, I am not a MATLAB user. I simply using > C.Using Matlab (obnoxious comments aside) would be quicker than C. But you can still do the whole thing in C if you don't mind spending the time. Comparing your filter with a _known good_ filter is the ticket -- it sounds like perhaps what's lacking is that known good filter! Comparing the performance of the filter with specifications is probably the best you could do at that point. Keep in mind that any filtering you do in the digital domain will be colored by whatever anti-alias filtering is done to the signal to get it to your algorithm, and whatever reconstruction filtering is done when your algorithm is done with it. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html
Reply by ●September 21, 20102010-09-21
"Vladimir Vassilevsky" <nospam@nowhere.com> wrote in message news:tf6dnXzEmpx5eQXRnZ2dnUVZ_gudnZ2d@giganews.com...> Matlab is for students and their toy problems.What do you recommend instead? I'm new to Matlab (previously used C and Mathematica mainly for FIR filter design and PLL simulation). I'm working on IIR stuff now, and feel like going back to C for some of the design (some of the Matlab stuff feels cumbersome, and not very transparent). I don't know how to deal with large fixed-point numbers though. Did you write your own, use one of the bignum libraries, or something else? I've also been toying with Python for its support of large integer arithmetic. What do you think of the relative merits of C and Python for this purpose? Thanks Pete
Reply by ●September 21, 20102010-09-21
On 09/21/2010 01:52 PM, Pete Fraser wrote:> "Vladimir Vassilevsky"<nospam@nowhere.com> wrote in message > news:tf6dnXzEmpx5eQXRnZ2dnUVZ_gudnZ2d@giganews.com... > >> Matlab is for students and their toy problems. > > What do you recommend instead?Vladimir likes to sound tough, and gets tired of students mistaking a familiarity with Matlab function call names for expertise in DSP.> I'm new to Matlab (previously used C and Mathematica > mainly for FIR filter design and PLL simulation). > > I'm working on IIR stuff now, and feel like going back > to C for some of the design (some of the Matlab stuff feels > cumbersome, and not very transparent). I don't know how to > deal with large fixed-point numbers though. > > Did you write your own, use one of the bignum libraries, > or something else? I've also been toying with Python > for its support of large integer arithmetic. What do you > think of the relative merits of C and Python for this > purpose?I use Scilab (a free Matlab-like environment) for analysis and prototyping, then (if the client needs it) I write real stuff in C or C++. There is absolutely nothing wrong with Matlab/Scilab/Octave for doing DSP work, as long as you understand that it is a tool, not a replacement brain. I can't comment on Python -- I haven't tried it. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html
Reply by ●September 21, 20102010-09-21
Vladimir Vassilevsky <nospam@nowhere.com> wrote in news:tf6dnXzEmpx5eQXRnZ2dnUVZ_gudnZ2d@giganews.com:> > > WaverlyE wrote: > >> How can I validate an A-Weighted filter with data other than a sinewave?>> I have an A-Weighted filter, that I obtained from the the Internet. > > Obtained from the Internet is a synonym of junk.> >> I have >> tested it against sine wave frequencies starting from 20Hz to 20kHz in1/3>> octaves. The filter matches the expected decibel values. Should rely I >> solely upon testing the filter against sine waves? I dont know if using >> more complex waveforms may show the filter is not working as expected. >> Unfortunately, sine waves are the only thing I can validate. I tried >> running complex waveforms through different programs and comparing the >> results with my own, however none of the programs agreed on what the >> weighted decibel value of the data file was. How else can I validatethe>> filter? > > You got to match the phase response of the filter to the IEC specified > S-domain function as well as the amplitude response.Yes, The A Curve is specified in as a s domain function, however I don't think that there is a specific requirement for phase response matching in any of the standards that I have seen. Usually the standards just specify levels with tolerance limits at specific frequencies. Errors are most likely at the band edges. There are low frequency corners at about 20Hz. You may see big errors as you approach the high frequency corners. This may be a function of your antialiasing filters or possibly the method of transforming the filter from s plane to z plane. I gave a paper that addressed A weighting at the 2010 comp.dsp conference. Al Clark www.danvillesignal.com
Reply by ●September 21, 20102010-09-21
>> WaverlyE wrote: >>> How can I validate an A-Weighted filter with data other than a sine >>> wave? I have an A-Weighted filter, that I obtained from the >>> the Internet.Then Vladimir Vassilevsky <nospam@nowhere.com> wrote in> news:tf6dnXzEmpx5eQXRnZ2dnUVZ_gudnZ2d@giganews.com:>> You got to match the phase response of the filter to the IEC specified >> S-domain function as well as the amplitude response.and finally, Al Clark <aclark@danvillesignal.com> wrote:> Yes, The A Curve is specified in as a s domain function, however I don't > think that there is a specific requirement for phase response matching in > any of the standards that I have seen.Maybe I misunderstand, but I would have to agree. As far as I know, such filters are used for sources that don't have a definite phase relationship. (Such as noise and, much of the time, music.) At least in the usual usage, the filter output goes to a square law detector, such as a power meter, and, hopefully, has some time averaging done. Even more, according to the wikipedia "Weighting_filter" page, "A-weighting is only really valid for relatively quite sounds and for pure tones..."> Usually the standards just specify levels with tolerance limits at specific > frequencies.> Errors are most likely at the band edges. There are low frequency corners > at about 20Hz. You may see big errors as you approach the high frequency > corners. This may be a function of your antialiasing filters or possibly > the method of transforming the filter from s plane to z plane.For wideband noise source, that shouldn't matter much. The only case that I can see where it might is with two pure tones near enough that the beat is slower than the time averaging. -- glen
Reply by ●September 22, 20102010-09-22
Pete Fraser <pfraser@covad.net> wrote:>I'm working on IIR stuff now, and feel like going back >to C for some of the design (some of the Matlab stuff feels >cumbersome, and not very transparent). I don't know how to >deal with large fixed-point numbers though.How large is large?>Did you write your own, use one of the bignum libraries, >or something else? I've also been toying with Python >for its support of large integer arithmetic. What do you >think of the relative merits of C and Python for this >purpose?A C or C++ double can hold (just about) any fixed point value up to 52 bits. If that is not adequate, then you can import a System C library, but if 52 bits is sufficient then writing the fixed point quantizers is a one-afternoon job. (Just working with System C is also adequate, but requires some familiarization, because some types end up being extremely slow when you use them. So I usually roll my own routines, but make them look as much as possible like System C.) Steve
Reply by ●September 22, 20102010-09-22
Tim Wescott <tim@seemywebsite.com> wrote:>I can't comment on Python -- I haven't tried it.The moment I saw that it uses indentation as a token I wrote it off as non-serious. Maybe someday I will revisit it. Steve
Reply by ●September 22, 20102010-09-22
>Keep in mind that any filtering you do in the digital domain will be >colored by whatever anti-alias filtering is done to the signal to get it >to your algorithm, and whatever reconstruction filtering is done when >your algorithm is done with it.I am not using any other filter. The recorded data is always sampled at 44100Hz.>Comparing your filter with a _known good_ filter is the ticket -- it >sounds like perhaps what's lacking is that known good filter! Comparing >the performance of the filter with specifications is probably the best >you could do at that point. >Ultimately, I goal is to know the weighted decibel value of an audio stream. When the data is passed through the filter and I compute the RMS, I need ensure the results are as accurate as a sound level meter and even more. The data is being tested for use in psychology experiments, so the measurements need to be extremely accurate. Are there any known files are protocols used to test filters. You are correct, I do not have a known good filter. I feel the only way I have left to ensure this filter works properly is to purchase a sound level meter and setup experiments comparing the meter with the filter. Are there files that are used to test an A-Weighted filter for accuracy. Other than using sine wave, I am at a loss for how to test the filter. I am about to show my lack of knowledge so please be patient with me. I am a novice. Could I analyze a sound file using FFT, extract the frequencies then use the accumulative values in the frequency domain to validate the results? http://www.diracdelta.co.uk/science/source/a/w/aweighting/source.html Thank you for your time, Waverly






