Nir = data['Nir'] M = data['M'] R = data['R'] phi = data['phi'] Omega = data['Omega'] Omega_al = data['Omega_al'] s = data['s'] p = data['p'] snr = data['snr'] # Target positions K_target = 360 # number of microphones phi_target = np.linspace(0, 2 * np.pi, num=K_target, endpoint=False) theta_target = np.pi / 2 x_target = sph2cart(phi_target, theta_target, R) + array_center x_target = np.array([x_target[0], x_target[1], x_target[2] * np.ones(K_target)]).T # Desired impulse responses h0 = [] for m in range(M): htemp = np.zeros((K_target, Nir)) xs = image_sources[m] scale = source_strength[m] for i, source_pos in enumerate(xs): waveform, shift, _ = impulse_response(source_pos, x_target, source_type, fs) Lw = waveform.shape[1] waveform *= scale[i] for k in range(K_target): htemp[k, shift[k]:shift[k]+Lw] += waveform[k] h0.append(htemp)
xs, wall_count = image_sources_for_box(x0, dimension, ism_order) image_sources.append(xs) source_strength.append(np.prod(coeff**wall_count, axis=1)) # Receiver array_center = room_center R = 0.2 # radius # Moving microphone Omega = 2 * np.pi / 16 L = int(np.ceil(2 * np.pi / Omega * fs)) t = 1 / fs * np.arange(L) phi0 = 0 phi = Omega * t + phi0 theta = np.pi / 2 x = sph2cart(phi, theta, R) + array_center x = np.array([x[0], x[1], x[2] * np.ones(L)]).T # Perfect sequence max_delay = (np.max(dimension) * (max_order + 1)) / c * fs Nir = next_divisor(max_delay, fs) N = M * Nir p = perfect_sequence_randomphase(N) #p = perfect_sweep(N) # Anti-aliasing condition Omega_al = c / N / R * 0.8 # anti-aliasing angular speed # Captured signal snr = -np.infty s = 0
from utils import * from source import * from sfs.util import sph2cart from sys import path path.append('../') # Constants c = 343 fs = 16000 # Source rho = 3 alpha = np.pi / 2 beta = np.pi / 4 xs = sph2cart(alpha, beta, rho) source_type = 'point' # Excitation N = 800 # excitation period p = perfect_sequence_randomphase(N) # Spherical array R = 0.15 # Gaussian-like sampling scheme modal_bandwidth = int(np.ceil(np.exp(1) * np.pi * fs / 2 * R / c)) max_sht_order = 15 x, weights = np.polynomial.legendre.leggauss(max_sht_order + 1) weights *= np.pi / (max_sht_order + 1) theta = np.arccos(x)