/SAFpy

Python binding for Spatial Audio Framework (SAF)

Primary LanguagePythonMIT LicenseMIT

SAFpy

Python application

This is a Python binding / wrapper for https://github.com/leomccormack/Spatial_Audio_Framework

So far, there are a bunch of functions exposed, please feel free to add/contribute more if needed!

Install

  1. Clone SAFpy, SAF is provided as a submodule, and change to the folder

git clone --recursive https://github.com/chris-hld/SAFpy && cd SAFpy

  1. Go to the SAF folder and compile SAF, see instructions in its docs. For example with

cmake -S . -B build -DSAF_PERFORMANCE_LIB=SAF_USE_OPEN_BLAS_AND_LAPACKE && cmake --build ./build

  1. Install numpy and CFFI (in the environment you want to use), e.g. conda install numpy cffi
  2. Now we need to build safpy, which creates the module. Running (in the environment you want to use)

pip install -e .

with . in the SAFpy folder, builds it automatically and installs any potentially missing Python dependencies.

  1. (Optional) Test if everything works, run pytest -vvv in the SAFpy folder.

By default, SAF is assumed in a subdirectory, which is also obtained by git submodule update --init --recursive . In case you want to use a different location, you can simply adapt the variable saf_path in safpy_build.py if needed. There you also have access to change the SAF performance library options, in case the default is not working for you.

You can also build SAFpy manually, e.g., for debugging, with python safpy_build.py.

If in trouble you can also have a look at the CI steps here.

Usage

Use safpy as a python package. Have a look at examples/test_call.py and examples/block_processing!