biquad 0.3__tar.gz → 0.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2023 Juergen Hock
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Juergen Hock
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,86 +1,103 @@
1
- Metadata-Version: 2.1
2
- Name: biquad
3
- Version: 0.3
4
- Summary: Collection of alterable digital biquad filters for dynamic audio effect creation
5
- Home-page: https://github.com/jurihock/biquad
6
- Author: Juergen Hock
7
- Author-email: juergen.hock@jurihock.de
8
- License: MIT
9
- Keywords: digital,audio,signal,processing,dasp,dafx,effects,filter,equalizer,eq,biquad,frequency,phase,spectrum,algorithms,analysis,synthesis,c,cpp,python
10
- Classifier: Intended Audience :: Developers
11
- Classifier: Intended Audience :: Education
12
- Classifier: Intended Audience :: Other Audience
13
- Classifier: Intended Audience :: Science/Research
14
- Classifier: License :: OSI Approved :: MIT License
15
- Classifier: Programming Language :: C
16
- Classifier: Programming Language :: C++
17
- Classifier: Programming Language :: Python :: 3
18
- Classifier: Topic :: Artistic Software
19
- Classifier: Topic :: Education
20
- Classifier: Topic :: Multimedia :: Sound/Audio
21
- Classifier: Topic :: Multimedia :: Sound/Audio :: Analysis
22
- Classifier: Topic :: Multimedia :: Sound/Audio :: Sound Synthesis
23
- Classifier: Topic :: Scientific/Engineering
24
- Classifier: Topic :: Software Development :: Libraries
25
- Requires-Python: >=3
26
- Description-Content-Type: text/markdown
27
- License-File: LICENSE
28
-
29
- # Alterable biquad filters
30
-
31
- ![language](https://img.shields.io/badge/languages-C%2B%2B%20Python-blue)
32
- ![license](https://img.shields.io/github/license/jurihock/biquad?color=green)
33
- ![pypi](https://img.shields.io/pypi/v/biquad?color=gold)
34
-
35
- This is a collection of digital biquad filters whose parameters `frequency` and `quality` can be varied at runtime. Following filter implementations are available:
36
-
37
- - Allpass
38
- - Bandpass
39
- - Highpass
40
- - Lowpass
41
- - Highshelf
42
- - Lowshelf
43
- - Notch
44
- - Peak
45
-
46
- ## Basic usage
47
-
48
- Filter with persistent configuration:
49
-
50
- ```python
51
- import biquad
52
- import numpy as np
53
-
54
- # load audio samples somehow
55
- x, sr = np.zeros(...), 44100
56
-
57
- # create a filter of your choice
58
- f = biquad.bandpass(sr, f=sr/4, q=1)
59
-
60
- # process all audio samples
61
- y = f(x)
62
- ```
63
-
64
- Filter with dynamic configuration:
65
-
66
- ```python
67
- import biquad
68
- import numpy as np
69
-
70
- # load audio samples somehow
71
- x, sr = np.zeros(...), 44100
72
-
73
- # create a filter of your choice
74
- f = biquad.bandpass(sr)
75
-
76
- # create parameter modifications as you like
77
- myf = np.linspace(1, sr/4, len(x))
78
- myq = np.linspace(2, 1/2, len(x))
79
-
80
- # process all audio samples
81
- y = f(x, f=myf, q=myq)
82
- ```
83
-
84
- ## See also
85
-
86
- [Cookbook formulae for audio equalizer biquad filter coefficients](https://webaudio.github.io/Audio-EQ-Cookbook/audio-eq-cookbook.html)
1
+ Metadata-Version: 2.4
2
+ Name: biquad
3
+ Version: 0.5
4
+ Summary: Collection of alterable digital biquad filters for dynamic audio effect creation
5
+ Home-page: https://github.com/jurihock/biquad
6
+ Author: Juergen Hock
7
+ Author-email: juergen.hock@jurihock.de
8
+ License: MIT
9
+ Keywords: digital,audio,signal,processing,dasp,dafx,effects,filter,equalizer,eq,biquad,frequency,phase,spectrum,algorithms,analysis,synthesis,c,cpp,python
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Intended Audience :: Education
12
+ Classifier: Intended Audience :: Other Audience
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: C
16
+ Classifier: Programming Language :: C++
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Topic :: Artistic Software
19
+ Classifier: Topic :: Education
20
+ Classifier: Topic :: Multimedia :: Sound/Audio
21
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Analysis
22
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Sound Synthesis
23
+ Classifier: Topic :: Scientific/Engineering
24
+ Classifier: Topic :: Software Development :: Libraries
25
+ Requires-Python: >=3
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: numba
29
+ Requires-Dist: numpy
30
+ Provides-Extra: plot
31
+ Requires-Dist: matplotlib; extra == "plot"
32
+ Dynamic: license-file
33
+
34
+ # Alterable biquad filters
35
+
36
+ ![language](https://img.shields.io/badge/languages-C%2B%2B%20Python-blue)
37
+ ![license](https://img.shields.io/github/license/jurihock/biquad?color=green)
38
+ ![pypi](https://img.shields.io/pypi/v/biquad?color=gold)
39
+
40
+ This is a collection of [digital biquad filters](https://webaudio.github.io/Audio-EQ-Cookbook/audio-eq-cookbook.html) whose parameters `f` (frequency in *Hz*), `g` (gain in *dB*) and `q` (quality) can be varied at runtime. Following [DF1](https://ccrma.stanford.edu/~jos/fp/Direct_Form_I.html) filter implementations are available:
41
+
42
+ - Allpass
43
+ - Bandpass
44
+ - Highpass
45
+ - Lowpass
46
+ - Highshelf
47
+ - Lowshelf
48
+ - Notch
49
+ - Peak
50
+
51
+ ## Basic usage
52
+
53
+ Filter with static configuration:
54
+
55
+ ```python
56
+ import biquad
57
+ import numpy as np
58
+
59
+ # load audio samples somehow
60
+ x, sr = np.zeros(...), 44100
61
+
62
+ # create a filter of your choice
63
+ f = biquad.bandpass(sr, f=sr/4, q=1)
64
+
65
+ # process all audio samples
66
+ y = f(x)
67
+ ```
68
+
69
+ Filter with dynamic configuration:
70
+
71
+ ```python
72
+ import biquad
73
+ import numpy as np
74
+
75
+ # load audio samples somehow
76
+ x, sr = np.zeros(...), 44100
77
+
78
+ # create a filter of your choice
79
+ f = biquad.bandpass(sr)
80
+
81
+ # create parameter modifications as you like
82
+ myf = np.linspace(1, sr/4, len(x))
83
+ myq = np.linspace(2, 1/2, len(x))
84
+
85
+ # process all audio samples
86
+ y = f(x, f=myf, q=myq)
87
+ ```
88
+
89
+ Keep in mind:
90
+
91
+ - All filters have a default value for the persistent parameters `g` and `q`, which is set in the particular `__init__` method.
92
+ - Parameter `f` must be set either in the `__init__` or in the `__call__` method.
93
+ - The optional instantaneous parameters `f`, `g` and `q`, if specified in the `__call__` method, override the persistent ones.
94
+
95
+ ## References
96
+
97
+ 1. <span id="1">[Cookbook formulae for audio EQ biquad filter coefficients](https://webaudio.github.io/Audio-EQ-Cookbook/audio-eq-cookbook.html) by Robert Bristow-Johnson</span>
98
+ 2. <span id="2">[Introduction to Digital Filters with Audio Applications](https://ccrma.stanford.edu/~jos/filters/filters.html) by Julius O. Smith III</span>
99
+
100
+ ## License
101
+
102
+ [github.com/jurihock/biquad](https://github.com/jurihock/biquad) is licensed under the terms of the MIT license.
103
+ For details please refer to the accompanying [LICENSE](https://github.com/jurihock/biquad/raw/main/LICENSE) file distributed with it.
biquad-0.5/README.md ADDED
@@ -0,0 +1,70 @@
1
+ # Alterable biquad filters
2
+
3
+ ![language](https://img.shields.io/badge/languages-C%2B%2B%20Python-blue)
4
+ ![license](https://img.shields.io/github/license/jurihock/biquad?color=green)
5
+ ![pypi](https://img.shields.io/pypi/v/biquad?color=gold)
6
+
7
+ This is a collection of [digital biquad filters](https://webaudio.github.io/Audio-EQ-Cookbook/audio-eq-cookbook.html) whose parameters `f` (frequency in *Hz*), `g` (gain in *dB*) and `q` (quality) can be varied at runtime. Following [DF1](https://ccrma.stanford.edu/~jos/fp/Direct_Form_I.html) filter implementations are available:
8
+
9
+ - Allpass
10
+ - Bandpass
11
+ - Highpass
12
+ - Lowpass
13
+ - Highshelf
14
+ - Lowshelf
15
+ - Notch
16
+ - Peak
17
+
18
+ ## Basic usage
19
+
20
+ Filter with static configuration:
21
+
22
+ ```python
23
+ import biquad
24
+ import numpy as np
25
+
26
+ # load audio samples somehow
27
+ x, sr = np.zeros(...), 44100
28
+
29
+ # create a filter of your choice
30
+ f = biquad.bandpass(sr, f=sr/4, q=1)
31
+
32
+ # process all audio samples
33
+ y = f(x)
34
+ ```
35
+
36
+ Filter with dynamic configuration:
37
+
38
+ ```python
39
+ import biquad
40
+ import numpy as np
41
+
42
+ # load audio samples somehow
43
+ x, sr = np.zeros(...), 44100
44
+
45
+ # create a filter of your choice
46
+ f = biquad.bandpass(sr)
47
+
48
+ # create parameter modifications as you like
49
+ myf = np.linspace(1, sr/4, len(x))
50
+ myq = np.linspace(2, 1/2, len(x))
51
+
52
+ # process all audio samples
53
+ y = f(x, f=myf, q=myq)
54
+ ```
55
+
56
+ Keep in mind:
57
+
58
+ - All filters have a default value for the persistent parameters `g` and `q`, which is set in the particular `__init__` method.
59
+ - Parameter `f` must be set either in the `__init__` or in the `__call__` method.
60
+ - The optional instantaneous parameters `f`, `g` and `q`, if specified in the `__call__` method, override the persistent ones.
61
+
62
+ ## References
63
+
64
+ 1. <span id="1">[Cookbook formulae for audio EQ biquad filter coefficients](https://webaudio.github.io/Audio-EQ-Cookbook/audio-eq-cookbook.html) by Robert Bristow-Johnson</span>
65
+ 2. <span id="2">[Introduction to Digital Filters with Audio Applications](https://ccrma.stanford.edu/~jos/filters/filters.html) by Julius O. Smith III</span>
66
+
67
+ ## License
68
+
69
+ [github.com/jurihock/biquad](https://github.com/jurihock/biquad) is licensed under the terms of the MIT license.
70
+ For details please refer to the accompanying [LICENSE](https://github.com/jurihock/biquad/raw/main/LICENSE) file distributed with it.
@@ -1,3 +1,3 @@
1
- [build-system]
2
- requires = ["setuptools>=42", "wheel"]
3
- build-backend = "setuptools.build_meta"
1
+ [build-system]
2
+ requires = ["setuptools>=42", "wheel"]
3
+ build-backend = "setuptools.build_meta"
@@ -1,64 +1,68 @@
1
- [metadata]
2
- name = biquad
3
- version = attr: biquad.__version__
4
- author = Juergen Hock
5
- author_email = juergen.hock@jurihock.de
6
- url = https://github.com/jurihock/biquad
7
- description = Collection of alterable digital biquad filters for dynamic audio effect creation
8
- long_description = file: README.md
9
- long_description_content_type = text/markdown
10
- license = MIT
11
- license_file = LICENSE
12
- keywords =
13
- digital
14
- audio
15
- signal
16
- processing
17
- dasp
18
- dafx
19
- effects
20
- filter
21
- equalizer
22
- eq
23
- biquad
24
- frequency
25
- phase
26
- spectrum
27
- algorithms
28
- analysis
29
- synthesis
30
- c
31
- cpp
32
- python
33
- classifiers =
34
- Intended Audience :: Developers
35
- Intended Audience :: Education
36
- Intended Audience :: Other Audience
37
- Intended Audience :: Science/Research
38
- License :: OSI Approved :: MIT License
39
- Programming Language :: C
40
- Programming Language :: C++
41
- Programming Language :: Python :: 3
42
- Topic :: Artistic Software
43
- Topic :: Education
44
- Topic :: Multimedia :: Sound/Audio
45
- Topic :: Multimedia :: Sound/Audio :: Analysis
46
- Topic :: Multimedia :: Sound/Audio :: Sound Synthesis
47
- Topic :: Scientific/Engineering
48
- Topic :: Software Development :: Libraries
49
-
50
- [options]
51
- package_dir =
52
- = src/python
53
- packages =
54
- biquad
55
- python_requires =
56
- >= 3
57
- install_requires =
58
- numba
59
- numpy
60
-
61
- [egg_info]
62
- tag_build =
63
- tag_date = 0
64
-
1
+ [metadata]
2
+ name = biquad
3
+ version = attr: biquad.__version__
4
+ author = Juergen Hock
5
+ author_email = juergen.hock@jurihock.de
6
+ url = https://github.com/jurihock/biquad
7
+ description = Collection of alterable digital biquad filters for dynamic audio effect creation
8
+ long_description = file: README.md
9
+ long_description_content_type = text/markdown
10
+ license = MIT
11
+ license_file = LICENSE
12
+ keywords =
13
+ digital
14
+ audio
15
+ signal
16
+ processing
17
+ dasp
18
+ dafx
19
+ effects
20
+ filter
21
+ equalizer
22
+ eq
23
+ biquad
24
+ frequency
25
+ phase
26
+ spectrum
27
+ algorithms
28
+ analysis
29
+ synthesis
30
+ c
31
+ cpp
32
+ python
33
+ classifiers =
34
+ Intended Audience :: Developers
35
+ Intended Audience :: Education
36
+ Intended Audience :: Other Audience
37
+ Intended Audience :: Science/Research
38
+ License :: OSI Approved :: MIT License
39
+ Programming Language :: C
40
+ Programming Language :: C++
41
+ Programming Language :: Python :: 3
42
+ Topic :: Artistic Software
43
+ Topic :: Education
44
+ Topic :: Multimedia :: Sound/Audio
45
+ Topic :: Multimedia :: Sound/Audio :: Analysis
46
+ Topic :: Multimedia :: Sound/Audio :: Sound Synthesis
47
+ Topic :: Scientific/Engineering
48
+ Topic :: Software Development :: Libraries
49
+
50
+ [options]
51
+ package_dir =
52
+ = src/python
53
+ packages =
54
+ biquad
55
+ python_requires =
56
+ >= 3
57
+ install_requires =
58
+ numba
59
+ numpy
60
+
61
+ [options.extras_require]
62
+ plot =
63
+ matplotlib
64
+
65
+ [egg_info]
66
+ tag_build =
67
+ tag_date = 0
68
+
@@ -1,55 +1,55 @@
1
- __version__ = "0.3"
2
-
3
-
4
- from .allpass import allpass
5
- from .bandpass import bandpass
6
- from .biquad import biquad
7
- from .highpass import highpass
8
- from .highshelf import highshelf
9
- from .lowpass import lowpass
10
- from .lowshelf import lowshelf
11
- from .notch import notch
12
- from .peak import peak
13
-
14
-
15
- def filter(name, sr, **kwargs):
16
- """
17
- Create a filter instance of the specified filter name.
18
-
19
- Parameters
20
- ----------
21
- sr : int or float
22
- Sample rate in hertz.
23
- f : int or float, optional
24
- Persistent filter frequency parameter in hertz.
25
- q : int or float, optional
26
- Persistent filter quality parameter.
27
- """
28
-
29
- name = str(name).lower()
30
-
31
- if name in ['allpass', 'all', 'ap', 'apf']:
32
- return allpass(sr, **kwargs)
33
-
34
- if name in ['bandpass', 'band', 'bp', 'bpf']:
35
- return bandpass(sr, **kwargs)
36
-
37
- if name in ['highpass', 'high', 'hp', 'hpf']:
38
- return highpass(sr, **kwargs)
39
-
40
- if name in ['highshelf', 'hs', 'hsf']:
41
- return highshelf(sr, **kwargs)
42
-
43
- if name in ['lowpass', 'low', 'lp', 'lpf']:
44
- return lowpass(sr, **kwargs)
45
-
46
- if name in ['lowshelf', 'ls', 'lsf']:
47
- return lowshelf(sr, **kwargs)
48
-
49
- if name in ['notch', 'nf']:
50
- return notch(sr, **kwargs)
51
-
52
- if name in ['peak', 'pf']:
53
- return peak(sr, **kwargs)
54
-
55
- return biquad(sr, **kwargs)
1
+ __version__ = "0.5"
2
+
3
+
4
+ from .allpass import allpass
5
+ from .bandpass import bandpass
6
+ from .biquad import biquad
7
+ from .highpass import highpass
8
+ from .highshelf import highshelf
9
+ from .lowpass import lowpass
10
+ from .lowshelf import lowshelf
11
+ from .notch import notch
12
+ from .peak import peak
13
+
14
+
15
+ def filter(name, sr, **kwargs):
16
+ """
17
+ Create a filter instance of the specified filter name.
18
+
19
+ Parameters
20
+ ----------
21
+ sr : int or float
22
+ Sample rate in hertz.
23
+ f : int or float, optional
24
+ Persistent filter frequency parameter in hertz.
25
+ q : int or float, optional
26
+ Persistent filter quality parameter.
27
+ """
28
+
29
+ name = str(name).lower()
30
+
31
+ if name in ['allpass', 'all', 'ap', 'apf']:
32
+ return allpass(sr, **kwargs)
33
+
34
+ if name in ['bandpass', 'band', 'bp', 'bpf']:
35
+ return bandpass(sr, **kwargs)
36
+
37
+ if name in ['highpass', 'high', 'hp', 'hpf']:
38
+ return highpass(sr, **kwargs)
39
+
40
+ if name in ['highshelf', 'hs', 'hsf']:
41
+ return highshelf(sr, **kwargs)
42
+
43
+ if name in ['lowpass', 'low', 'lp', 'lpf']:
44
+ return lowpass(sr, **kwargs)
45
+
46
+ if name in ['lowshelf', 'ls', 'lsf']:
47
+ return lowshelf(sr, **kwargs)
48
+
49
+ if name in ['notch', 'nf']:
50
+ return notch(sr, **kwargs)
51
+
52
+ if name in ['peak', 'pf']:
53
+ return peak(sr, **kwargs)
54
+
55
+ return biquad(sr, **kwargs)
@@ -6,7 +6,7 @@ SPDX-License-Identifier: MIT
6
6
  Source: https://github.com/jurihock/biquad
7
7
  """
8
8
 
9
- from .biquad import biquad, __df1__
9
+ from .biquad import biquad, __df1__, __gain__, __resize__
10
10
 
11
11
  import numba
12
12
  import numpy
@@ -17,7 +17,7 @@ class allpass(biquad):
17
17
  Allpass filter (APF).
18
18
  """
19
19
 
20
- def __init__(self, sr, *, f=None, q=1):
20
+ def __init__(self, sr, f=None, g=0, q=1):
21
21
  """
22
22
  Create a new filter instance.
23
23
 
@@ -27,15 +27,17 @@ class allpass(biquad):
27
27
  Sample rate in hertz.
28
28
  f : int or float, optional
29
29
  Persistent filter frequency parameter in hertz.
30
+ g : int or float, optional
31
+ Persistent filter gain parameter in decibel.
30
32
  q : int or float, optional
31
33
  Persistent filter quality parameter.
32
34
  """
33
35
 
34
- super().__init__(sr=sr, f=f, q=q)
36
+ super().__init__(sr=sr, f=f, g=g, q=q)
35
37
 
36
- self.__call__(0, 1) # warmup numba
38
+ self.__call__(0) # warmup numba
37
39
 
38
- def __call__(self, x, f=None, q=None):
40
+ def __call__(self, x, f=None, g=None, q=None):
39
41
  """
40
42
  Process single or multiple contiguous signal values at once.
41
43
 
@@ -45,6 +47,8 @@ class allpass(biquad):
45
47
  Filter input data.
46
48
  f : scalar or array like, optional
47
49
  Instantaneous filter frequency parameter in hertz.
50
+ g : scalar or array like, optional
51
+ Instantaneous filter gain parameter in decibel.
48
52
  q : scalar or array like, optional
49
53
  Instantaneous filter quality parameter.
50
54
 
@@ -62,21 +66,23 @@ class allpass(biquad):
62
66
  x = numpy.atleast_1d(x)
63
67
  y = numpy.zeros(x.shape, x.dtype)
64
68
 
65
- f = numpy.atleast_1d(self.f if f is None else f)
66
- q = numpy.atleast_1d(self.q if q is None else q)
67
-
68
- f = numpy.resize(f, x.shape)
69
- q = numpy.resize(q, x.shape)
69
+ f = __resize__(self.f if f is None else f, x.shape)
70
+ g = __resize__(self.g if g is None else __gain__(g), x.shape)
71
+ q = __resize__(self.q if q is None else q, x.shape)
70
72
 
71
73
  sr = self.sr
72
74
 
73
- self.__filter__(ba, xy, x, y, f, q, sr)
75
+ self.__filter__(ba, xy, x, y, f, g, q, sr)
76
+
77
+ self.f = f[-1]
78
+ self.g = g[-1]
79
+ self.q = q[-1]
74
80
 
75
81
  return y[0] if scalar else y
76
82
 
77
83
  @staticmethod
78
84
  @numba.jit(nopython=True, fastmath=True)
79
- def __filter__(ba, xy, x, y, f, q, sr):
85
+ def __filter__(ba, xy, x, y, f, g, q, sr):
80
86
 
81
87
  rs = 2 * numpy.pi / sr
82
88
 
@@ -87,18 +93,18 @@ class allpass(biquad):
87
93
  cosw = numpy.cos(w)
88
94
  sinw = numpy.sin(w)
89
95
 
90
- c = -(2 * cosw)
91
- p = sinw / (2 * q[i])
96
+ alpha = sinw / (+2 * q[i])
97
+ beta = cosw * (-2)
92
98
 
93
99
  # update b
94
- ba[0, 0] = 1 - p
95
- ba[0, 1] = c
96
- ba[0, 2] = 1 + p
100
+ ba[0, 0] = 1 - alpha
101
+ ba[0, 1] = beta
102
+ ba[0, 2] = 1 + alpha
97
103
 
98
104
  # update a
99
- ba[1, 0] = 1 + p
100
- ba[1, 1] = c
101
- ba[1, 2] = 1 - p
105
+ ba[1, 0] = 1 + alpha
106
+ ba[1, 1] = beta
107
+ ba[1, 2] = 1 - alpha
102
108
 
103
109
  # update y
104
- __df1__(ba, xy, x, y, i)
110
+ __df1__(g[i], ba, xy, x, y, i)