src/java.desktop/share/classes/com/sun/media/sound/SoftFilter.java

Print this page




  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package com.sun.media.sound;
  26 
  27 /**
  28  * Infinite impulse response (IIR) filter class.
  29  *
  30  * The filters where implemented and adapted using algorithms from musicdsp.org
  31  * archive: 1-RC and C filter, Simple 2-pole LP LP and HP filter, biquad,
  32  * tweaked butterworth RBJ Audio-EQ-Cookbook, EQ filter kookbook
  33  *
  34  * @author Karl Helgason
  35  */
  36 public final class SoftFilter {
  37 
  38     public final static int FILTERTYPE_LP6 = 0x00;
  39     public final static int FILTERTYPE_LP12 = 0x01;
  40     public final static int FILTERTYPE_HP12 = 0x11;
  41     public final static int FILTERTYPE_BP12 = 0x21;
  42     public final static int FILTERTYPE_NP12 = 0x31;
  43     public final static int FILTERTYPE_LP24 = 0x03;
  44     public final static int FILTERTYPE_HP24 = 0x13;
  45 
  46     //
  47     // 0x0 = 1st-order, 6 dB/oct
  48     // 0x1 = 2nd-order, 12 dB/oct
  49     // 0x2 = 3rd-order, 18 dB/oct
  50     // 0x3 = 4th-order, 24 db/oct
  51     //
  52     // 0x00 = LP, Low Pass Filter
  53     // 0x10 = HP, High Pass Filter
  54     // 0x20 = BP, Band Pass Filter
  55     // 0x30 = NP, Notch or Band Elimination Filter
  56     //
  57     private int filtertype = FILTERTYPE_LP6;
  58     private final float samplerate;
  59     private float x1;
  60     private float x2;
  61     private float y1;
  62     private float y2;
  63     private float xx1;
  64     private float xx2;




  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package com.sun.media.sound;
  26 
  27 /**
  28  * Infinite impulse response (IIR) filter class.
  29  *
  30  * The filters where implemented and adapted using algorithms from musicdsp.org
  31  * archive: 1-RC and C filter, Simple 2-pole LP LP and HP filter, biquad,
  32  * tweaked butterworth RBJ Audio-EQ-Cookbook, EQ filter kookbook
  33  *
  34  * @author Karl Helgason
  35  */
  36 public final class SoftFilter {
  37 
  38     public static final int FILTERTYPE_LP6 = 0x00;
  39     public static final int FILTERTYPE_LP12 = 0x01;
  40     public static final int FILTERTYPE_HP12 = 0x11;
  41     public static final int FILTERTYPE_BP12 = 0x21;
  42     public static final int FILTERTYPE_NP12 = 0x31;
  43     public static final int FILTERTYPE_LP24 = 0x03;
  44     public static final int FILTERTYPE_HP24 = 0x13;
  45 
  46     //
  47     // 0x0 = 1st-order, 6 dB/oct
  48     // 0x1 = 2nd-order, 12 dB/oct
  49     // 0x2 = 3rd-order, 18 dB/oct
  50     // 0x3 = 4th-order, 24 db/oct
  51     //
  52     // 0x00 = LP, Low Pass Filter
  53     // 0x10 = HP, High Pass Filter
  54     // 0x20 = BP, Band Pass Filter
  55     // 0x30 = NP, Notch or Band Elimination Filter
  56     //
  57     private int filtertype = FILTERTYPE_LP6;
  58     private final float samplerate;
  59     private float x1;
  60     private float x2;
  61     private float y1;
  62     private float y2;
  63     private float xx1;
  64     private float xx2;