audio-filter
Advanced tools
@@ -9,5 +9,6 @@ /** | ||
| import { highpass as biquadHp } from 'digital-filter/iir/biquad.js' | ||
| import butterworth from 'digital-filter/iir/butterworth.js' | ||
| import filter from 'digital-filter/core/filter.js' | ||
| let butterworth | ||
| /** | ||
@@ -22,3 +23,7 @@ * @param {Float32Array|Float64Array} data - Input (modified in-place) | ||
| if (!params.coefs || params._fc !== fc || params._order !== order || params._Q !== Q || params._fs !== fs) { | ||
| params.coefs = order <= 2 ? [biquadHp(fc, Q, fs)] : butterworth(order, fc, fs, 'highpass') | ||
| if (order <= 2) params.coefs = [biquadHp(fc, Q, fs)] | ||
| else { | ||
| if (!butterworth) throw new Error('Import digital-filter/iir/butterworth.js for order > 2') | ||
| params.coefs = butterworth(order, fc, fs, 'highpass') | ||
| } | ||
| params._fc = fc; params._order = order; params._Q = Q; params._fs = fs | ||
@@ -29,1 +34,3 @@ } | ||
| } | ||
| highpass.useButterworth = (bw) => { butterworth = bw } |
@@ -9,5 +9,6 @@ /** | ||
| import { lowpass as biquadLp } from 'digital-filter/iir/biquad.js' | ||
| import butterworth from 'digital-filter/iir/butterworth.js' | ||
| import filter from 'digital-filter/core/filter.js' | ||
| let butterworth | ||
| /** | ||
@@ -22,3 +23,7 @@ * @param {Float32Array|Float64Array} data - Input (modified in-place) | ||
| if (!params.coefs || params._fc !== fc || params._order !== order || params._Q !== Q || params._fs !== fs) { | ||
| params.coefs = order <= 2 ? [biquadLp(fc, Q, fs)] : butterworth(order, fc, fs, 'lowpass') | ||
| if (order <= 2) params.coefs = [biquadLp(fc, Q, fs)] | ||
| else { | ||
| if (!butterworth) throw new Error('Import digital-filter/iir/butterworth.js for order > 2') | ||
| params.coefs = butterworth(order, fc, fs, 'lowpass') | ||
| } | ||
| params._fc = fc; params._order = order; params._Q = Q; params._fs = fs | ||
@@ -29,1 +34,3 @@ } | ||
| } | ||
| lowpass.useButterworth = (bw) => { butterworth = bw } |
+1
-1
| { | ||
| "name": "audio-filter", | ||
| "version": "2.2.1", | ||
| "version": "2.2.2", | ||
| "type": "module", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
104040
0.27%1566
0.64%