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.
- {biquad-0.3 → biquad-0.5}/LICENSE +21 -21
- {biquad-0.3/src/python/biquad.egg-info → biquad-0.5}/PKG-INFO +103 -86
- biquad-0.5/README.md +70 -0
- {biquad-0.3 → biquad-0.5}/pyproject.toml +3 -3
- {biquad-0.3 → biquad-0.5}/setup.cfg +68 -64
- {biquad-0.3 → biquad-0.5}/src/python/biquad/__init__.py +55 -55
- {biquad-0.3 → biquad-0.5}/src/python/biquad/allpass.py +27 -21
- {biquad-0.3 → biquad-0.5}/src/python/biquad/bandpass.py +33 -27
- biquad-0.5/src/python/biquad/biquad.py +268 -0
- {biquad-0.3 → biquad-0.5}/src/python/biquad/highpass.py +24 -18
- {biquad-0.3 → biquad-0.5}/src/python/biquad/highshelf.py +115 -113
- {biquad-0.3 → biquad-0.5}/src/python/biquad/lowpass.py +24 -18
- {biquad-0.3 → biquad-0.5}/src/python/biquad/lowshelf.py +115 -113
- {biquad-0.3 → biquad-0.5}/src/python/biquad/notch.py +25 -19
- {biquad-0.3 → biquad-0.5}/src/python/biquad/peak.py +29 -29
- {biquad-0.3 → biquad-0.5/src/python/biquad.egg-info}/PKG-INFO +103 -86
- {biquad-0.3 → biquad-0.5}/src/python/biquad.egg-info/SOURCES.txt +5 -1
- biquad-0.5/src/python/biquad.egg-info/requires.txt +5 -0
- biquad-0.3/README.md +0 -58
- biquad-0.3/src/python/biquad/biquad.py +0 -186
- biquad-0.3/src/python/biquad/plot.py +0 -96
- biquad-0.3/src/python/biquad.egg-info/requires.txt +0 -2
- {biquad-0.3 → biquad-0.5}/src/python/biquad.egg-info/dependency_links.txt +0 -0
- {biquad-0.3 → biquad-0.5}/src/python/biquad.egg-info/top_level.txt +0 -0
|
@@ -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.
|
|
2
|
-
Name: biquad
|
|
3
|
-
Version: 0.
|
|
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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
-
|
|
41
|
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
+

|
|
37
|
+

|
|
38
|
+

|
|
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
|
+

|
|
4
|
+

|
|
5
|
+

|
|
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
|
-
[
|
|
62
|
-
|
|
63
|
-
|
|
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.
|
|
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,
|
|
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
|
|
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 =
|
|
66
|
-
|
|
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
|
-
|
|
91
|
-
|
|
96
|
+
alpha = sinw / (+2 * q[i])
|
|
97
|
+
beta = cosw * (-2)
|
|
92
98
|
|
|
93
99
|
# update b
|
|
94
|
-
ba[0, 0] = 1 -
|
|
95
|
-
ba[0, 1] =
|
|
96
|
-
ba[0, 2] = 1 +
|
|
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 +
|
|
100
|
-
ba[1, 1] =
|
|
101
|
-
ba[1, 2] = 1 -
|
|
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)
|