Build your own noise shaping filters!, Freeware inside 
Build your own noise shaping filters!, Freeware inside 
Sep 4 2006, 09:55
Post
#1


Group: Developer Posts: 1318 Joined: 20March 04 From: Göttingen (DE) Member No.: 12875 
Hi!
Inspired by this thread  but also because I like messing around with DSP stuff from time to time .... I wrote two programs that let you design and apply noise shaping filters. Check out my little homepage (screenshot and ZIP to downlad). I'm kind of proud of the way poles and zeros are controlled. Havn't seen this approach before. Also, you get to hear the result instantly. Try altering the response while audio is on Cheers! Sebastian PS: I should probably mention that the noise you hear (program "iiirdsgn") is TPDF dithered silence. PPS: It's likely that you can design better noise shaping filters than those that are supplied. I didn't have accurate equal loudness data available. Filter design tips:  Try to keep the number of red and blue strings minimal  Keep the response below ... say +30 dB  Don't try to approximate equal loudness curves below, say, 1 kHz. If you do, the filters only get more complicated. There's hardly a gain due to the small bandwidth of that region. I intentionally use a linear frequency axis, so don't bother approximation the curves for a very small region. You may link to *.sos files you created if you think you've designed a really good one. This post has been edited by SebastianG: Sep 4 2006, 12:57 


Sep 29 2006, 16:12
Post
#2


LAME developer Group: Developer Posts: 2950 Joined: 1October 01 From: Nanterre, France Member No.: 138 
For the beginners, here is an intro to the zeros/poles stuff in zplane:
http://www.eumus.edu.uy/docentes/jure/docs...eBraindead.html 


Mar 5 2008, 11:03
Post
#3


Group: Developer Posts: 1318 Joined: 20March 04 From: Göttingen (DE) Member No.: 12875 
I just thought you might be interested in a filter that I computed some time ago for 44kHz. This is what I did:
CODE SOS FILE VERSION 1 size = 2x6 1.0 0.43661 0.43995 1.0 1.21968 0.67167 1.0 1.58404 0.78993 1.0 0.16099 0.40768 # newly designed filter according to LAME's ATH curve # for a sampling frequency of 44100 Hz # max gain (limited) : +20 dB at 1822 kHz # min gain : 23 dB at 3400 Hz Save the above text to "lameath44.sos" and the filter is ready to be used by REQUANT. Note: This filter is NOT compatible to IIIRDSGN. It has a pair of distinct real poles and IIIRDSGN only supports complex conjugate roots. IIIRDSGN will simply ignore 2nd order polynomials with distinct real roots, print out a warning and show you a different magnitude response. This given 2x6 matrix is in fact a MATLAB compatible secondordersection matrix. The corresponding numerator and denominator coefficients are [b,a]=sos2tf(sos_matrix): b = [1.0000 1.1474 0.5383 0.3520 0.3475]; % the numerator a = [1.0000 1.0587 0.0676 0.6054 0.2738]; % the denominator edit: In case your noise shaping implementation follows this popular signal flow graph and you require the coefficients b_h & a_h for H(z) then you need to derive these from the noise shaper's transfer function G(z) (given by b & a) like this: b_h = remove_leading_zero(ab); a_h = a; due to the relationship G(z) = 1  z^1 H(z). So, for the above example b_h would be b_h = [2.20610 0.47070 0.25340 0.62130]; For FIR filters this boils down to removing the leading one and negating the remaining coefficients. Cheers, SG This post has been edited by SebastianG: Mar 10 2008, 17:37 


Mar 7 2008, 18:31
Post
#4


Group: Developer Posts: 1318 Joined: 20March 04 From: Göttingen (DE) Member No.: 12875 
For those who are interested in using these filters on their own I'm sharing some demo code written for Matlab/Octave. The main file nsqdemo.m is a script that also contains some documentation and should be selfexplanatory.
The algorithm is the same as the one used in IIIRDSGN and REQUANT internally: It uses chained 2ndorder sections in direct form II. The parameters needed to initialize the filter's state is a SOSmatrix that describes the noise shaper's transfer function G(z) directly  not H(z) for G(z)=1  z^1 H(z). This is the SOSmatrix that's stored in the *.sos files (sometimes without 1st and 4th column which always contain ones). edit: Here's a 48 kHz version derived simply by frequency warping the 44kHzfilter from above: CODE SOS FILE VERSION 1 size = 2x6 1.0 0.29992 0.42952 1.0 1.12211 0.65184 1.0 1.63432 0.80619 1.0 0.21908 0.39436 # newly designed filter according to LAME's ATH curve # for a sampling frequency of 48000 Hz # (frequencywarped version of the 44kHz filter) Save this to lameath48.sos and it's ready to be used by REQUANT. Enjoy! SG This post has been edited by SebastianG: Mar 11 2008, 08:54 


LoFi Version  Time is now: 28th January 2015  00:39 