https://github.com/ronnyandersson/zignal
Python audio signal processing library
https://github.com/ronnyandersson/zignal
audio audio-signal-processing digital-signal-processing filters maximum-length-sequences measurements mls python-library signal-processing sound
Last synced: 3 months ago
JSON representation
Python audio signal processing library
- Host: GitHub
- URL: https://github.com/ronnyandersson/zignal
- Owner: ronnyandersson
- License: mit
- Created: 2016-02-14T22:20:18.000Z (over 9 years ago)
- Default Branch: develop
- Last Pushed: 2025-01-28T14:27:10.000Z (8 months ago)
- Last Synced: 2025-06-21T09:17:50.688Z (4 months ago)
- Topics: audio, audio-signal-processing, digital-signal-processing, filters, maximum-length-sequences, measurements, mls, python-library, signal-processing, sound
- Language: Python
- Homepage:
- Size: 273 KB
- Stars: 23
- Watchers: 1
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# zignal
This is a python audio signal processing library.
## Example usage
>>> import zignal
>>>
>>> x = zignal.Sinetone(fs=44100, f0=997, duration=0.1, gaindb=-20)
>>> print(x)
=======================================
classname : Sinetone
sample rate : 44100.0 [Hz]
channels : 1
duration : 0.100 [s]
datatype : float64
samples per ch : 4410
data size : 0.034 [Mb]
has comment : no
peak : [ 0.1]
RMS : [ 0.0707]
crestfactor : [ 1.4147]
-----------------:---------------------
frequency : 997.0 [Hz]
phase : 0.0 [deg]
-----------------:--------------------->>> x.fade_out(millisec=10)
>>> x.convert_to_float(targetbits=32)
>>> x.write_wav_file("sinetone.wav")
>>> x.plot()
>>> x.plot_fft()
>>>
>>> f = zignal.filters.biquads.RBJ(filtertype="peak", gaindb=-6, f0=997, Q=0.707, fs=96000)
>>> print(f)
=======================================
classname : RBJ
sample rate : 96000.0 [Hz]
feedforward (B) : [ 0.96949457 -1.87369167 0.90819329]
feedback (A) : [ 1. -1.87369167 0.87768787]
number of zeros : 2
number of poles : 2
minimum phase? : Yes
-----------------:---------------------
stable? : Yes
type : peak
gain : -6.00 [dB]
f0 : 997.0 [Hz]
Q : 0.7070>>> f.plot_mag_phase()
>>> f.plot_pole_zero()
>>>See the examples folder for more examples. Also check out the sister project
[zoundcard](https://github.com/ronnyandersson/zoundcard) which can play audio
on a soundcard.## Requirements
This library relies on numpy, scipy and matplotlib. It is recommended to create
a virtual environment and let pip install the dependencies automatically.python3 -m venv
. /bin/activate
pip install zignal## Local development
Create a python3 virtualenv and install from the local source code to make the
zignal library editable.python3 -m venv venv_dev
. venv_dev/bin/activate
pip install --editable .[dev]By running `make` it is now possible to run isort, flake8 and also all the unit
tests. They can also be executed directly from the command line, see the
Makefile for the full commands to run.## Build a release
python3 -m venv venv_build
. ./venv_build/bin/activate
pip install --upgrade pip build
python3 -m build## Design goals
1. Readability over efficiency. This is a python library for development and
understanding of audio signal processing.
2. The initial goal is to write the functionality in pure python, with the use
of numpy, scipy and matplotlib. See rule 1. If efficiency becomes an issue
a c/c++ library might be implemented but the pure python code must remain
the default choice.
3. Design for non real-time processing. Functionality to do real-time
processing can be added if it does not break rule 1.
4. Self documentation. The code should aim to be well documented, in the
source code itself.