lasp/README.md

192 lines
6.0 KiB
Markdown
Raw Normal View History

Library for Acoustic Signal Processing
======================================
2018-03-06 20:15:21 +00:00
2023-01-12 21:27:42 +00:00
Welcome to LASP: Library for Acoustic Signal Processing. LASP is a C++ library
2023-01-12 10:50:34 +00:00
with a Python interface which is supposed to acquire and process (multi) sensor data in real time on a PC and output results.
2018-03-06 20:15:21 +00:00
Current features that are implemented:
2023-01-20 13:22:48 +00:00
2023-01-20 13:22:48 +00:00
- Communication with data acquisition (DAQ) devices, of which:
- Internal sound cards via the [RtAudio](http://www.music.mcgill.ca/~gary/rtaudio) backend. Many thanks to Gary P. Scavone et al.
- [Measurement Computing](https://www.mccdaq.com) [DT9838A](https://www.mccdaq.com/Products/Sound-Vibration-DAQ/DT9837) signal analyzer.
- Configuration of DAQ devices: AC coupling, IEPE, sensitivity physical
quantities.
- Recording of signals from these DAQ devices, and storing in a HDF5 file.
- Filter designers to create A/C sound pressure weighting
- Biquad filter designers for low pass, high pass, peaking and notch filters
- A Peak Programme Meter (PPM) to monitor signal levels from DAQ and to watch
for signal clipping.
- A signal generator to create sine waves, sweeps and noise (white / pink).
- Equalizers to equalize the output prior to sending.
2018-03-06 20:26:08 +00:00
- Averaged power spectra and power spectral density determination
using Welch' method. Taper functions of Hann, Hamming, Bartlett and
Blackman are provided.
2023-01-20 13:22:48 +00:00
- (One third) octave filter bank filters designed to comply with IEC 61260
(1995).
2018-03-06 20:15:21 +00:00
- Slow and fast time updates of (A/C/Z) weighted sound pressure levels
2023-01-20 13:22:48 +00:00
- Full Sound Level Meter implementation
- Real time Sound Level meter, Power / Transfer function estimator
- Spectra data smoothing algorithms
- Sensor calibration for microphones
Future features (wish-list)
2023-01-20 13:22:48 +00:00
- Conventional and delay-and-sum beam-forming algorithms
2023-01-20 13:22:48 +00:00
- Impedance tube measurement processing
2018-03-06 20:15:21 +00:00
2023-01-20 13:22:48 +00:00
For now, the source code is well-documented on [lasp.ascee.nl](https://lasp.ascee.nl) but it requires some
additional documentation (the math behind it). This is maintained
in a sister repository [lasp-doc](https://code.ascee.nl/ascee/lasp-doc).
2018-03-06 20:15:21 +00:00
If you have any question(s), please feel free to contact us: [email](info@ascee.nl).
2024-06-24 14:33:31 +00:00
# Installation - Linux (Ubuntu-based)
## Prerequisites
Run the following on the command line to install all prerequisites on
2024-06-24 14:33:31 +00:00
Debian-based Linux, x86-64:
- `sudo apt install python3-pip libfftw3-3 libopenblas-base libusb-1.0-0 libpulse0`
2024-06-24 14:33:31 +00:00
## Installation from wheel (recommended for non-developers)
Go to: [LASP releases](https://code.ascee.nl/ASCEE/lasp/releases/latest/) and
download the latest `.whl`. Then run:
- `pip install lasp-*-linux_x86_64.whl`
## From source (Ubuntu-based)
### Prerequisites
Run the following one-liner:
- `sudo apt install -y git python3 python3-virtualenv python3-venv libopenblas-dev python3-pip libfftw3-dev libusb-1.0-0-dev libpulse-dev python3-build`
2022-07-20 12:58:48 +00:00
2023-01-12 10:50:34 +00:00
If building RtAudio with the ALSA backend, you will also require the following packages:
2022-01-13 12:59:35 +00:00
- `sudo apt install libclalsadrv-dev`
2022-07-20 12:58:48 +00:00
2023-01-12 10:50:34 +00:00
If building RtAudio with the Jack Audio Connection Kit (JACK) backend, you will also require the following packages:
- `sudo apt install libjack-jackd2-dev`
### Download & build
2023-01-12 10:50:34 +00:00
- `$ git clone --recursive https://code.ascee.nl/ASCEE/lasp.git`
- `$ cd lasp`
- `pip install -e .`
2022-01-13 12:59:35 +00:00
2024-06-24 14:33:31 +00:00
# Building and installation for Raspberry Pi (Raspberry Pi OS)
Run the following on the command line to install all prerequisites on
Raspberry Pi OS:
- `sudo apt install libfftw3-dev libopenblas64-dev libhdf5-dev libclalsadrv-dev`
In a virtualenv: install `build`
- `$ pip install build`
Then run:
- `$ git clone --recursive https://code.ascee.nl/ASCEE/lasp.git`
- `$ cd lasp`
- `$ pyproject-build`
Which will generate a `whl` in the `dist` folder, that is redistributable for Raspberry Pis that run Raspberry Pi OS.
When installing the `whl`, it appears that H5PY takes quite some time to install. To follow this process, run it it verbose mode.
# Installation - (x86_64) Windows (with WinPython), build with MSYS2
2023-07-14 11:57:02 +00:00
## Prerequisites
- Download and install [WinPython](https://winpython.github.io)
## From wheel
2023-07-14 11:57:02 +00:00
- Download latest wheel from [LASP releases](https://code.ascee.nl/ASCEE/lasp/releases/latest/) and
download the latest `.whl`. Then install with `pip`.
2023-07-14 11:57:02 +00:00
## From source
2023-07-14 11:57:02 +00:00
- Download and install [MSYS2](https://msys2.org). Make sure to install the
x86_64 version.
- When unzipping WinPython, make sure to choose a proper and simple path, i.e.
C:\winpython
- Download and install [Git for Windows](https://git-scm.com)
- Open an MSYS2 **MINGW64** terminal, and install some tools we require:
- `$ pacman -S git`
- Create a new virtualenv:
- `$ /c/winpython/<py-distr-dir>/python.exe -m venv venv`
- Add the venv-python to the path (eases a lot of commands)
- `$ export PATH=$PATH:~/venv/Scripts`
- Install `build`:
- `$ pip install build`
- Clone LASP:
- `$ git clone --recurse-submodules https://code.ascee.nl/ascee/lasp && cd lasp`
- If run for the first time, we have to install the libraries we depend on in
MSYS2 (this only has to be done on a fresh MSYS2 installation):
- `$ scripts/install_msys2_builddeps.sh`
- Copy over required DLL's to be included in distribution:
- `scripts/copy_windows_dlls.sh`
- And... build!
- `pyproject-build`
- Lastly: the generated wheel can be installed in the current virtualenv:
- `pip install dist/lasp*.whl`
2023-07-14 11:57:02 +00:00
# Documentation
2022-01-13 12:59:35 +00:00
2023-10-24 17:49:56 +00:00
## Online
[Online LASP documentation](https://lasp.ascee.nl/).
## In directory (Linux/Debian)
2023-01-20 13:22:48 +00:00
`$ sudo apt install doxygen graphviz`
`$ pip install doxypypy`
2022-01-13 12:59:35 +00:00
2023-01-12 10:50:34 +00:00
While still in lasp dir:
2023-01-12 10:50:34 +00:00
`$ doxygen`
2023-01-12 10:50:34 +00:00
This will build the documentation. It can be read by:
2023-01-12 10:50:34 +00:00
`$ <YOUR-BROWSER> doc/html/index.html`
2023-10-24 17:49:56 +00:00
# Usage
- See examples directories for IPython notebooks.
- Please refer to the [documentation](https://lasp.ascee.nl/) for features.
# Development docs
## Bumping version number
When bumping the version number, please update the number in
- `pyproject.toml`
- `CMakeLists.txt`
Then, create a commit with tag `vX.X.X`, and push it.
2024-06-18 07:14:58 +00:00
## Updating to latest version (editable mode)
When updating to the latest version of LASP in editable mode:
```bash
- $ git pull
- $ git submodule update
- $ pip install -e . -v
```