# Alterable biquad filters
![language](https://img.shields.io/badge/languages-C%2B%2B%20Python-blue)
![license](https://img.shields.io/github/license/jurihock/biquad?color=green)
![pypi](https://img.shields.io/pypi/v/biquad?color=gold)
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:
- Allpass
- Bandpass
- Highpass
- Lowpass
- Highshelf
- Lowshelf
- Notch
- Peak
## Basic usage
Filter with static configuration:
```python
import biquad
import numpy as np
# load audio samples somehow
x, sr = np.zeros(...), 44100
# create a filter of your choice
f = biquad.bandpass(sr, f=sr/4, q=1)
# process all audio samples
y = f(x)
```
Filter with dynamic configuration:
```python
import biquad
import numpy as np
# load audio samples somehow
x, sr = np.zeros(...), 44100
# create a filter of your choice
f = biquad.bandpass(sr)
# create parameter modifications as you like
myf = np.linspace(1, sr/4, len(x))
myq = np.linspace(2, 1/2, len(x))
# process all audio samples
y = f(x, f=myf, q=myq)
```
Keep in mind:
- All filters have a default value for the persistent parameters `g` and `q`, which is set in the particular `__init__` method.
- Parameter `f` must be set either in the `__init__` or in the `__call__` method.
- The optional instantaneous parameters `f`, `g` and `q`, if specified in the `__call__` method, override the persistent ones.
## References
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>
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>
## License
[github.com/jurihock/biquad](https://github.com/jurihock/biquad) is licensed under the terms of the MIT license.
For details please refer to the accompanying [LICENSE](https://github.com/jurihock/biquad/raw/main/LICENSE) file distributed with it.
Raw data
{
"_id": null,
"home_page": "https://github.com/jurihock/biquad",
"name": "biquad",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3",
"maintainer_email": "",
"keywords": "digital,audio,signal,processing,dasp,dafx,effects,filter,equalizer,eq,biquad,frequency,phase,spectrum,algorithms,analysis,synthesis,c,cpp,python",
"author": "Juergen Hock",
"author_email": "juergen.hock@jurihock.de",
"download_url": "https://files.pythonhosted.org/packages/50/65/48e2c7e10a29c68b49161d1569c89420cd946dd5508e7dec92b331b2aa3b/biquad-0.4.tar.gz",
"platform": null,
"description": "# Alterable biquad filters\n\n![language](https://img.shields.io/badge/languages-C%2B%2B%20Python-blue)\n![license](https://img.shields.io/github/license/jurihock/biquad?color=green)\n![pypi](https://img.shields.io/pypi/v/biquad?color=gold)\n\nThis 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:\n\n- Allpass\n- Bandpass\n- Highpass\n- Lowpass\n- Highshelf\n- Lowshelf\n- Notch\n- Peak\n\n## Basic usage\n\nFilter with static configuration:\n\n```python\nimport biquad\nimport numpy as np\n\n# load audio samples somehow\nx, sr = np.zeros(...), 44100\n\n# create a filter of your choice\nf = biquad.bandpass(sr, f=sr/4, q=1)\n\n# process all audio samples\ny = f(x)\n```\n\nFilter with dynamic configuration:\n\n```python\nimport biquad\nimport numpy as np\n\n# load audio samples somehow\nx, sr = np.zeros(...), 44100\n\n# create a filter of your choice\nf = biquad.bandpass(sr)\n\n# create parameter modifications as you like\nmyf = np.linspace(1, sr/4, len(x))\nmyq = np.linspace(2, 1/2, len(x))\n\n# process all audio samples\ny = f(x, f=myf, q=myq)\n```\n\nKeep in mind:\n\n- All filters have a default value for the persistent parameters `g` and `q`, which is set in the particular `__init__` method.\n- Parameter `f` must be set either in the `__init__` or in the `__call__` method.\n- The optional instantaneous parameters `f`, `g` and `q`, if specified in the `__call__` method, override the persistent ones. \n\n## References\n\n1. <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>\n2. <span id=\"2\">[Introduction to Digital Filters with Audio Applications](https://ccrma.stanford.edu/~jos/filters/filters.html) by Julius O. Smith III</span>\n\n## License\n\n[github.com/jurihock/biquad](https://github.com/jurihock/biquad) is licensed under the terms of the MIT license.\nFor details please refer to the accompanying [LICENSE](https://github.com/jurihock/biquad/raw/main/LICENSE) file distributed with it.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Collection of alterable digital biquad filters for dynamic audio effect creation",
"version": "0.4",
"split_keywords": [
"digital",
"audio",
"signal",
"processing",
"dasp",
"dafx",
"effects",
"filter",
"equalizer",
"eq",
"biquad",
"frequency",
"phase",
"spectrum",
"algorithms",
"analysis",
"synthesis",
"c",
"cpp",
"python"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "90294eec58e3c453906b275aa275ae656177af4394657e931b7f10a3b0a1452d",
"md5": "fac4d15c7b6af44903aee6a8d32c0a9f",
"sha256": "2c61e21d4c9bda16cb5604b24df2cd6f6116481c9497992ae5c7e441b140043f"
},
"downloads": -1,
"filename": "biquad-0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fac4d15c7b6af44903aee6a8d32c0a9f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3",
"size": 15172,
"upload_time": "2023-03-19T12:32:53",
"upload_time_iso_8601": "2023-03-19T12:32:53.489495Z",
"url": "https://files.pythonhosted.org/packages/90/29/4eec58e3c453906b275aa275ae656177af4394657e931b7f10a3b0a1452d/biquad-0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "506548e2c7e10a29c68b49161d1569c89420cd946dd5508e7dec92b331b2aa3b",
"md5": "f18e71b72e8386c6865b541435e440d0",
"sha256": "f432a6fe83fabd7c785021b0a81b848765a6f2d8f0707620bb3d875b343fadd9"
},
"downloads": -1,
"filename": "biquad-0.4.tar.gz",
"has_sig": false,
"md5_digest": "f18e71b72e8386c6865b541435e440d0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3",
"size": 8969,
"upload_time": "2023-03-19T12:32:55",
"upload_time_iso_8601": "2023-03-19T12:32:55.693583Z",
"url": "https://files.pythonhosted.org/packages/50/65/48e2c7e10a29c68b49161d1569c89420cd946dd5508e7dec92b331b2aa3b/biquad-0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-03-19 12:32:55",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "jurihock",
"github_project": "biquad",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "biquad"
}