#!/usr/bin/env python # coding: utf-8 # [exercises](reproduction.ipynb) # In[1]: get_ipython().run_line_magic('matplotlib', 'inline') import matplotlib.pyplot as plt import numpy as np import sfs # In[2]: grid = sfs.util.xyz_grid([-2, 2], [-2, 2], 0, spacing=0.02) # In[3]: x0 = 0, 1.5, 0 f = 1000 # Hz omega = 2 * np.pi * f # In[4]: p_point = sfs.mono.source.point(omega, x0, None, grid) p_point *= 4 * np.pi sfs.plot.soundfield(p_point, grid) plt.title("Point Source at {} m".format(x0)); # In[5]: x0 = 0, 1.5 f = 1000 # Hz omega = 2 * np.pi * f # In[6]: p_line = sfs.mono.source.line(omega, x0, None, grid) p_line *= np.sqrt(8 * np.pi * omega / sfs.defs.c) * np.exp(1j * np.pi / 4) sfs.plot.soundfield(p_line, grid) plt.title("Line Source at {} m".format(x0[:2])); # Difference between point source and line source: # When doubling the distance, the sound level of a ... # # * ... point source is attenuated by 6 dB # # * ... line source is attenuated by 3 dB # In[7]: x0 = 0, 1.5, 0 n0 = 0, -1, 0 f = 1000 # Hz omega = 2 * np.pi * f # In[8]: p_plane = sfs.mono.source.plane(omega, x0, n0, grid) sfs.plot.soundfield(p_plane, grid); plt.title("Plane wave with $n_0 =$ {}".format(n0)); # From this snapshot, it's not possible to recognize if the plane wave is travelling up or down. # One would need an animation of some kind to see the direction of propagation (this was a trick question!). # # The level doesn't decay over distance (another trick question!). # If the weighting factors are equal, the phantom source is halfway between the two loudspeakers. # # TODO: intensity stereophony, time-of-arrival stereophony # Reason for artifacts: spatial aliasing. # # TODO: 2.5 D # WFS vs. NFC-HOA artifacts: HOA has a circular area (shrinking with higher frequencies) in the center without aliasing, but around that area the artifacts are stronger than in WFS. #

# # CC0 # #
# To the extent possible under law, # the person who associated CC0 # with this work has waived all copyright and related or neighboring # rights to this work. #