Added clipping filter
This commit is contained in:
@@ -0,0 +1,12 @@
|
|||||||
|
<effect name="Radio">
|
||||||
|
<biquad type="notch" fc="140" q="20" gain="-50" />
|
||||||
|
<amplifier gain="0.1" />
|
||||||
|
<biquad type="peak" fc="1000" q="10" gain="45" />
|
||||||
|
<lfo frequency="5000" depth="0.3" />
|
||||||
|
<clipping clip="0.3" />
|
||||||
|
<biquad type="highshelf" fc="8000" q="1" gain="-20" />
|
||||||
|
<delayline>
|
||||||
|
<delay samples="100" gain="0.7" />
|
||||||
|
<delay samples="200" gain="0.5" />
|
||||||
|
</delayline>
|
||||||
|
</effect>
|
||||||
@@ -14,6 +14,7 @@ public class AGC implements Effect {
|
|||||||
attack = a;
|
attack = a;
|
||||||
decay = d;
|
decay = d;
|
||||||
limit = l;
|
limit = l;
|
||||||
|
gain = 1d;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
|||||||
@@ -2654,6 +2654,11 @@ System.err.println(format);
|
|||||||
if (eff != null) {
|
if (eff != null) {
|
||||||
group.addEffect(eff);
|
group.addEffect(eff);
|
||||||
}
|
}
|
||||||
|
} else if (e.getTagName().equals("clipping")) {
|
||||||
|
Effect eff = (Effect)loadClipping(e);
|
||||||
|
if (eff != null) {
|
||||||
|
group.addEffect(eff);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2739,6 +2744,11 @@ System.err.println(format);
|
|||||||
if (eff != null) {
|
if (eff != null) {
|
||||||
store.addEffect(eff);
|
store.addEffect(eff);
|
||||||
}
|
}
|
||||||
|
} else if (ie.getTagName().equals("clipping")) {
|
||||||
|
Effect eff = (Effect)loadClipping(ie);
|
||||||
|
if (eff != null) {
|
||||||
|
store.addEffect(eff);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2754,6 +2764,11 @@ System.err.println(format);
|
|||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Clipping loadClipping(Element root) {
|
||||||
|
Clipping c = new Clipping(Utils.s2d(root.getAttribute("clip")));
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
public LFO loadLFO(Element root) {
|
public LFO loadLFO(Element root) {
|
||||||
double f = Utils.s2d(root.getAttribute("frequency"));
|
double f = Utils.s2d(root.getAttribute("frequency"));
|
||||||
double d = Utils.s2d(root.getAttribute("depth"));
|
double d = Utils.s2d(root.getAttribute("depth"));
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package uk.co.majenko.audiobookrecorder;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class Clipping implements Effect {
|
||||||
|
double clip;
|
||||||
|
public Clipping() {
|
||||||
|
clip = 1.0d;
|
||||||
|
}
|
||||||
|
public Clipping(double g) {
|
||||||
|
clip = g;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return "Clipping (" + clip + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Effect> getChildEffects() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double process(double sample) {
|
||||||
|
if (sample > clip) return clip;
|
||||||
|
if (sample < -clip) return -clip;
|
||||||
|
return sample;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getClip() {
|
||||||
|
return clip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClip(double g) {
|
||||||
|
clip = g;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dump() {
|
||||||
|
System.out.println(toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init(double sf) {
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user