Giter Club home page Giter Club logo

spaudiopy's Introduction

spaudiopy

Documentation Status PyPI version Cross-Platform Test

Spatial Audio Python Package.

The focus (so far) is on spatial audio encoders and decoders. The package includes e.g. spherical harmonics processing and (binaural renderings of) loudspeaker decoders, such as VBAP and AllRAD.

Documentation

You can find the latest package documentation here:
https://spaudiopy.readthedocs.io/

Some details about the implementation can be found in my thesis, or just contact me.

Quickstart

It's easiest to start with something like Anaconda as a Python distribution. You'll need Python >= 3.6 .

You can simply install the latest release with pip:
pip install spaudiopy

This also works for the latest commit:
pip install git+https://github.com/chris-hld/spaudiopy.git@master

From Source

Alternatively, if you want to go into detail and install the package from source:

  1. Create a conda environment, called e.g. 'spaudio':
    conda create --name spaudio python=3.8 anaconda portaudio
  2. Activate this new environment:
    conda activate spaudio

Get the latest source code from GitHub:
git clone https://github.com/chris-hld/spaudiopy.git && cd spaudiopy

Install the package and remaining dependencies:
pip install -e .

Contributions

This is meant to be an open project and contributions or feature requests are always welcome!

Some functions are also (heavily) inspired by other packages, e.g. https://github.com/polarch/Spherical-Harmonic-Transform, https://github.com/spatialaudio/sfa-numpy, https://github.com/AppliedAcousticsChalmers/sound_field_analysis-py .

Licence

MIT -- see the file LICENSE for details.

spaudiopy's People

Contributors

benjsta avatar chris-hld avatar jr2804 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spaudiopy's Issues

define auralization

Hi
when I set src_coords, it defaults he has his face towards to me, any ideas I can make he has his back towards to me?

DOA estimation for FOA

Hi,

Thanks for the wonderful library.

I have a First Order Ambisonics (FOA) recording with a single static source. Can I use this library to estimate the direction of arrival (DOA), i.e. the azimuth and elevation angles of the sound source?

I am new to spatial audio, this might be a straightforward task, but I would greatly appreciate any guidance you can provide. A code snippet or a high-level explanation would be helpful.

Thanks,
Saksham

problem with matplotlib

Hello. It looks like this lib uses matplotlib to draw 3d environment model.
But matplotlib throws an error:
NotImplementedError: It is not currently possible to manually set the aspect on 3D axes
while trying to execute the following code:

File "\.conda\envs\vbap_test\lib\site-packages\spaudiopy\plots.py", line 362, in hull_normals
    ax = fig.add_subplot(1, 1, 1, projection='3d', aspect='equal')

I'm using matplotlib==3.1.1

Can VBAP be used in 2D?

Hi everyone,

first of all thanks for this great implementation! I was wondering if there is a way to make a simplified 2D use case work for VBAP algorithm? I am running into errors because my loudspeaker arrangement is coplanar for this simplified setup. Thank you!

Best, nwesem

Problem with `spaudiopy.grids.load_lebedev`

Hi! Great library, I found it because of your nice interface to the Lebedev Quadrature.
https://spaudiopy.readthedocs.io/en/latest/spaudiopy.grids.html#spaudiopy.grids.load_lebedev

Unfortunately, I have the impression something is wrong.
In my opinion and according to the source you cited for your values,
https://people.sc.fsu.edu/~jburkardt/datasets/sphere_lebedev_rule/lebedev_003.txt
the Lebedev grid of precision 3 should consist of six vectors. In your code, it only returns four of them:

>>> import spaudiopy as spa
fatal: not a git repository (or any of the parent directories): .git
>>> vecs, weights = spa.grids.load_lebedev(degree=3)
>>> len(vecs)
4

This seems to be a problem with the .mat file added in 4242e89 not containing the right data:

>>> from scipy.io import loadmat
>>> data = loadmat("/home/philipp/spaudiopy/lebedevQuadratures_3_131.mat")
>>> len(data['lebedev_003'])
4

Tutorial or demo exemple?

Hi
I am trying to use this great piece of code to simulate 3d spacial audio but I am not sure where to start. Is there a tutorial or some basic test exemples to get started and understand the basic concepts / building blocs and then develop from there?
I had a look at the doc and it is great but it assume already a good understanding of the overall expertise domain.
I went to the exemple folder but I am not sure what the exemlles are doing, I could not find a description except in the file names.

Looking for some guidance and first steps push, if you can point me to some documentation I would have missed that is great.

Thanks

Converting FOA Format from STARSS23 Dataset to Planar Circular Microphone Array Format Using spaudiopy

Hi everyone,
I’m currently working on a project that involves spatial audio processing using the STARSS23 dataset. My goal is to convert the FOA (First-Order Ambisonics) format audio files from this dataset into a format compatible with a planar circular four-microphone array.

The planar circular microphone array I’m using has the following coordinates in spherical format:

Mic 1: (0°, 0°, 1)
Mic 2: (90°, 0°, 1)
Mic 3: (180°, 0°, 1)
Mic 4: (270°, 0°, 1)
I’ve read that spaudiopy is a powerful tool for such spatial audio processing tasks, and I believe it can help with this conversion. However, I’m looking for guidance on how to effectively decode FOA signals to match this specific planar circular microphone configuration.

If anyone has experience with this kind of conversion or can point me to relevant documentation or examples using spaudiopy, I would greatly appreciate your help.

Thanks in advance for your assistance!

Best regards

tests/test_parallel.py fails sometimes

Test_parallel fails frequently, but not always.
It seems that tests/test_parallel.py::test_render_bsdm is causing it (most of the times?).
As it doesn't occur every time, it might be undefined behaviour related to the shared memory access.

I will first try to collect some tracebacks, maybe they show some pattern.

Test on macOS-latest with Python 3.6

test_jobs = None

    @pytest.mark.parametrize('test_jobs', JOB_COUNTS)
    def test_render_bsdm(test_jobs):
        sdm_p, sdm_phi, sdm_theta = [*np.random.randn(3, 1000)]
        hrirs = spa.IO.load_hrirs(fs=44100, filename='dummy')
        bsdm_l_r, bsdm_r_r = spa.sdm.render_bsdm(sdm_p, sdm_phi, sdm_theta, hrirs,
                                                 jobs_count=1)
        bsdm_l_t, bsdm_r_t = spa.sdm.render_bsdm(sdm_p, sdm_phi, sdm_theta, hrirs,
                                                 jobs_count=test_jobs)
>       assert_allclose([bsdm_l_t, bsdm_r_t], [bsdm_l_r, bsdm_r_r])
E       AssertionError: 
E       Not equal to tolerance rtol=1e-07, atol=0
E       
E       Mismatched elements: 1 / 2510 (0.0398%)
E       Max absolute difference: 0.64633057
E       Max relative difference: 1.
E        x: array([[ 1.955098,  0.205032, -1.341322, ...,  0.      ,  0.      ,
E                0.      ],
E              [ 1.955098,  0.205032, -1.341322, ...,  0.      ,  0.      ,
E                0.      ]])
E        y: array([[ 1.955098,  0.205032, -1.341322, ...,  0.      ,  0.      ,
E                0.      ],
E              [ 1.955098,  0.205032, -1.341322, ...,  0.      ,  0.      ,
E                0.      ]])

Different version in metadata

When installing the package with "pip install spaudiopy", the error occurs:

ERROR: Requested spaudiopy from https://files.pythonhosted.org/packages/45/d3/bc5d9e57b8b8a339b582dc47e058979403f771ffe368ebfc72585b64df7b/spaudiopy-0.1.3.tar.gz#sha256=0a35b290e11f148f4e9b0834748fbfe9e2c5b9f8054a31dd0814be3902511095 h
as different version in metadata: '-tail-.is.not.recognized.as.an.internal.or.external.command-operable.program.or.batch.file.-dirty'

Fractional Octave Smoothing

Hi! I was looking at the implementation of the fractional octave smoothing function and stumbled across this line.

win = np.hamming(k_hi-k_lo) # hamming is good because never 0

I believe it has a bug because the spectrum is expected to be linearly-spaced. This window definition will have linear-axis symmetry but not the log-axis one, which is expected for the fractional octave smoothing (the highest point of the window lies in the arithmetic mean between the indices, but the geometric mean would be the right one...)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.