# 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.
## Requirements
This library relies on numpy, scipy, matplotlib and optionally pyaudio. It is
recommended to create a virtual environment and let pip install the
dependencies automatically.
python3 -m venv <name-of-virtualenv>
. <name-of-virtualenv>/bin/activate
pip install zignal
Optionally, to be able to use a soundcard, first install the python development
headers and the portaudio development files. On debian/ubuntu,
sudo apt install python3-dev portaudio19-dev
then run
pip install zignal[sndcard]
which will automatically build the portaudio library and then pyaudio.
## Local development
Create a python3 virtualenv and install from the local source code to make the
zignal library editable. Note that the python development headers (python3-dev)
and portaudio19-dev must be installed first.
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.
Raw data
{
"_id": null,
"home_page": null,
"name": "zignal",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "12TET, CIC, DSP, FFT, FIR, IIR, audio, biquad, card, cascaded, comb, cookbook, decimation, decimator, digital, eq, equal, equaliser, equalizer, filter, filtering, finite, fourier, frequency, frequencyresponse, generator, impulse, impulseresponse, infinite, integrator, length, magnitude, magnituderesponse, maximum, maximumlengthsequence, measure, measurement, midi, mls, mlssa, notation, parametric, piano, pitch, playback, portaudio, processing, pseudo, pseudorandom, pyaudio, random, recording, response, scale, sequence, signal, signalprocessing, sine, sound, soundcard, spn, temperament, tuning",
"author": null,
"author_email": "Ronny Andersson <ronny@andersson.tk>",
"download_url": "https://files.pythonhosted.org/packages/db/51/45371b3877e771fbc95ef7e4d5d96ca6147512bba9e57add8b2017bb1ba1/zignal-0.7.0.tar.gz",
"platform": null,
"description": "# zignal\n\nThis is a python audio signal processing library.\n\n## Example usage\n\n >>> import zignal\n >>>\n >>> x = zignal.Sinetone(fs=44100, f0=997, duration=0.1, gaindb=-20)\n >>> print(x)\n =======================================\n classname : Sinetone\n sample rate : 44100.0 [Hz]\n channels : 1\n duration : 0.100 [s]\n datatype : float64\n samples per ch : 4410\n data size : 0.034 [Mb]\n has comment : no\n peak : [ 0.1]\n RMS : [ 0.0707]\n crestfactor : [ 1.4147]\n -----------------:---------------------\n frequency : 997.0 [Hz]\n phase : 0.0 [deg]\n -----------------:---------------------\n\n >>> x.fade_out(millisec=10)\n >>> x.convert_to_float(targetbits=32)\n >>> x.write_wav_file(\"sinetone.wav\")\n >>> x.plot()\n >>> x.plot_fft()\n >>>\n >>> f = zignal.filters.biquads.RBJ(filtertype=\"peak\", gaindb=-6, f0=997, Q=0.707, fs=96000)\n >>> print(f)\n =======================================\n classname : RBJ\n sample rate : 96000.0 [Hz]\n feedforward (B) : [ 0.96949457 -1.87369167 0.90819329]\n feedback (A) : [ 1. -1.87369167 0.87768787]\n number of zeros : 2\n number of poles : 2\n minimum phase? : Yes\n -----------------:---------------------\n stable? : Yes\n type : peak\n gain : -6.00 [dB]\n f0 : 997.0 [Hz]\n Q : 0.7070\n\n >>> f.plot_mag_phase()\n >>> f.plot_pole_zero()\n >>>\n\nSee the examples folder for more examples.\n\n## Requirements\n\nThis library relies on numpy, scipy, matplotlib and optionally pyaudio. It is\nrecommended to create a virtual environment and let pip install the\ndependencies automatically.\n\n python3 -m venv <name-of-virtualenv>\n . <name-of-virtualenv>/bin/activate\n pip install zignal\n\nOptionally, to be able to use a soundcard, first install the python development\nheaders and the portaudio development files. On debian/ubuntu,\n\n sudo apt install python3-dev portaudio19-dev\n\nthen run\n\n pip install zignal[sndcard]\n\nwhich will automatically build the portaudio library and then pyaudio.\n\n## Local development\n\nCreate a python3 virtualenv and install from the local source code to make the\nzignal library editable. Note that the python development headers (python3-dev)\nand portaudio19-dev must be installed first.\n\n python3 -m venv venv_dev\n . venv_dev/bin/activate\n pip install --editable .[dev]\n\nBy running `make` it is now possible to run isort, flake8 and also all the unit\ntests. They can also be executed directly from the command line, see the\nMakefile for the full commands to run.\n\n## Build a release\n\n python3 -m venv venv_build\n . ./venv_build/bin/activate\n pip install --upgrade pip build\n python3 -m build\n\n## Design goals\n\n1. Readability over efficiency. This is a python library for development and\n understanding of audio signal processing.\n2. The initial goal is to write the functionality in pure python, with the use\n of numpy, scipy and matplotlib. See rule 1. If efficiency becomes an issue\n a c/c++ library might be implemented but the pure python code must remain\n the default choice.\n3. Design for non real-time processing. Functionality to do real-time\n processing can be added if it does not break rule 1.\n4. Self documentation. The code should aim to be well documented, in the\n source code itself.\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Audio signal processing library",
"version": "0.7.0",
"project_urls": {
"Download": "https://pypi.python.org/pypi/zignal",
"Homepage": "https://github.com/ronnyandersson/zignal",
"Issues": "https://github.com/ronnyandersson/zignal/issues"
},
"split_keywords": [
"12tet",
" cic",
" dsp",
" fft",
" fir",
" iir",
" audio",
" biquad",
" card",
" cascaded",
" comb",
" cookbook",
" decimation",
" decimator",
" digital",
" eq",
" equal",
" equaliser",
" equalizer",
" filter",
" filtering",
" finite",
" fourier",
" frequency",
" frequencyresponse",
" generator",
" impulse",
" impulseresponse",
" infinite",
" integrator",
" length",
" magnitude",
" magnituderesponse",
" maximum",
" maximumlengthsequence",
" measure",
" measurement",
" midi",
" mls",
" mlssa",
" notation",
" parametric",
" piano",
" pitch",
" playback",
" portaudio",
" processing",
" pseudo",
" pseudorandom",
" pyaudio",
" random",
" recording",
" response",
" scale",
" sequence",
" signal",
" signalprocessing",
" sine",
" sound",
" soundcard",
" spn",
" temperament",
" tuning"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0165f1a503debc138ca2f6bae2df55485fe11c4fd123f85a9520ddc7d7219f59",
"md5": "128be6b7c388ccf684ad2158e846d6c0",
"sha256": "262975b2fe1e77dec208956b71712c2e22f0bf4d98c67347e33006058e65382b"
},
"downloads": -1,
"filename": "zignal-0.7.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "128be6b7c388ccf684ad2158e846d6c0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 43470,
"upload_time": "2024-05-02T07:56:33",
"upload_time_iso_8601": "2024-05-02T07:56:33.023089Z",
"url": "https://files.pythonhosted.org/packages/01/65/f1a503debc138ca2f6bae2df55485fe11c4fd123f85a9520ddc7d7219f59/zignal-0.7.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "db5145371b3877e771fbc95ef7e4d5d96ca6147512bba9e57add8b2017bb1ba1",
"md5": "e128114c87a85f8d972746189faddd8c",
"sha256": "74d3f0cf1e311f26aa03a8595b7e0d9ac7e47eaabb674dd3a3347710a0a8f819"
},
"downloads": -1,
"filename": "zignal-0.7.0.tar.gz",
"has_sig": false,
"md5_digest": "e128114c87a85f8d972746189faddd8c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 47689,
"upload_time": "2024-05-02T07:56:35",
"upload_time_iso_8601": "2024-05-02T07:56:35.051754Z",
"url": "https://files.pythonhosted.org/packages/db/51/45371b3877e771fbc95ef7e4d5d96ca6147512bba9e57add8b2017bb1ba1/zignal-0.7.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-02 07:56:35",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ronnyandersson",
"github_project": "zignal",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "zignal"
}