How to use the spaudiopy.decoder.LoudspeakerSetup function in spaudiopy

To help you get started, we’ve selected a few spaudiopy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github chris-hld / spaudiopy / tests / test_parallel.py View on Github external
def test_allrap2(test_jobs):
    vecs = spa.grids.load_t_design(degree=5)
    hull = spa.decoder.LoudspeakerSetup(*vecs.T)
    hull.ambisonics_setup(update_hull=False)
    src = np.random.randn(1000, 3)
    gains_r = spa.decoder.allrap2(src, hull, jobs_count=1)
    gains_t = spa.decoder.allrap2(src, hull, jobs_count=test_jobs)
    assert_allclose(gains_t, gains_r)
github chris-hld / spaudiopy / spaudiopy / decoder.py View on Github external
print('Setting Ambisonics order =', self.characteristic_order)
            N_kernel = self.characteristic_order

        ls = self.points
        imaginary_loudspeaker_coordinates = find_imaginary_loudspeaker(self)
        # add imaginary speaker to hull
        new_ls = np.vstack([ls, imaginary_loudspeaker_coordinates])
        # This new triangulation is now the rendering setup
        ambisonics_hull = LoudspeakerSetup(new_ls[:, 0],
                                           new_ls[:, 1],
                                           new_ls[:, 2])
        # mark imaginary speaker (last one)
        ambisonics_hull.imaginary_speaker = new_ls.shape[0] - 1
        # virtual optimal loudspeaker arrangement
        virtual_speakers = grids.load_t_design(2 * N_kernel + 1)
        kernel_hull = LoudspeakerSetup(virtual_speakers[:, 0],
                                       virtual_speakers[:, 1],
                                       virtual_speakers[:, 2])

        del ambisonics_hull.ambisonics_hull
        del ambisonics_hull.kernel_hull
        self.ambisonics_hull = ambisonics_hull
        del kernel_hull.ambisonics_hull
        del kernel_hull.kernel_hull
        self.kernel_hull = kernel_hull
github chris-hld / spaudiopy / spaudiopy / decoder.py View on Github external
def setup_for_ambisonic(self, N_kernel=None):
        """Prepare loudspeaker hull for ambisonic rendering."""
        self.characteristic_order = self.get_characteristic_order()
        if N_kernel is None:
            print('Setting Ambisonics order =', self.characteristic_order)
            N_kernel = self.characteristic_order

        ls = self.points
        imaginary_loudspeaker_coordinates = find_imaginary_loudspeaker(self)
        # add imaginary speaker to hull
        new_ls = np.vstack([ls, imaginary_loudspeaker_coordinates])
        # This new triangulation is now the rendering setup
        ambisonics_hull = LoudspeakerSetup(new_ls[:, 0],
                                           new_ls[:, 1],
                                           new_ls[:, 2])
        # mark imaginary speaker (last one)
        ambisonics_hull.imaginary_speaker = new_ls.shape[0] - 1
        # virtual optimal loudspeaker arrangement
        virtual_speakers = grids.load_t_design(2 * N_kernel + 1)
        kernel_hull = LoudspeakerSetup(virtual_speakers[:, 0],
                                       virtual_speakers[:, 1],
                                       virtual_speakers[:, 2])

        del ambisonics_hull.ambisonics_hull
        del ambisonics_hull.kernel_hull
        self.ambisonics_hull = ambisonics_hull
        del kernel_hull.ambisonics_hull
        del kernel_hull.kernel_hull
        self.kernel_hull = kernel_hull