@@ -281,28 +281,28 @@ def nfchoa_25d_plane(x0, r0, npw, max_order=None, c=None, fs=44100, normalize=Tr
281
281
weight : float
282
282
Overall weight (common to all secondary sources)
283
283
sos : dictionary
284
- Second-order section filters
284
+ Second-order section filters
285
285
phaseshift : float
286
286
Phase shift
287
-
287
+
288
288
References
289
289
----------
290
290
S. Spors, V. Kuscher, J. Ahrens (2011) - "Efficient realization of
291
291
model-based rendering for 2.5-dimensional near-field compensated higher
292
292
order Ambisonics", WASPAA, p. 61-64
293
-
293
+
294
294
See Eq.(10)
295
295
"""
296
296
if max_order is None :
297
- max_order = _max_order_circular_harmonics (len (x0 ), max_order )
297
+ max_order = _max_order_circular_harmonics (len (x0 ), max_order )
298
298
if c is None :
299
299
c = defs .c
300
300
301
301
x0 = util .asarray_of_rows (x0 )
302
302
npw = util .asarray_1d (npw )
303
303
phipw , _ , _ = util .cart2sph (* npw )
304
304
phi0 , _ , _ = util .cart2sph (* x0 .T )
305
-
305
+
306
306
delay = - r0 / c
307
307
weight = 2
308
308
sos = {}
@@ -347,21 +347,20 @@ def nfchoa_25d_point(x0, r0, xs, max_order=None, c=None, fs=44100, normalize=Tru
347
347
weight : float
348
348
Overall weight (common to all secondary sources)
349
349
sos : dictionary
350
- Second-order section filters
350
+ Second-order section filters
351
351
phaseshift : float
352
352
Phase shift
353
353
354
-
355
354
References
356
355
----------
357
356
S. Spors, V. Kuscher, J. Ahrens (2011) - "Efficient realization of
358
357
model-based rendering for 2.5-dimensional near-field compensated higher
359
358
order Ambisonics", WASPAA, p. 61-64
360
-
359
+
361
360
See Eq.(11)
362
361
"""
363
362
if max_order is None :
364
- max_order = _max_order_circular_harmonics (len (x0 ), max_order )
363
+ max_order = _max_order_circular_harmonics (len (x0 ), max_order )
365
364
if c is None :
366
365
c = defs .c
367
366
@@ -385,7 +384,7 @@ def nfchoa_25d_point(x0, r0, xs, max_order=None, c=None, fs=44100, normalize=Tru
385
384
k = _normalize_digital_filter_gain (s0 , sinf , z0 , zinf , fs = fs )
386
385
else :
387
386
k = 1
388
- sos [m ] = sig .zpk2sos (z0 ,zinf ,k , pairing = 'nearest' )
387
+ sos [m ] = sig .zpk2sos (z0 , zinf , k , pairing = 'nearest' )
389
388
# TODO: normalize the SOS filters individually?
390
389
phaseshift = phi0 - phi
391
390
return delay , weight , sos , phaseshift
@@ -401,7 +400,7 @@ def nfchoa_driving_signals(delay, weight, sos, phaseshift, signal, max_order=Non
401
400
weight : float
402
401
Overall weight (common to all secondary sources)
403
402
sos : dictionary
404
- Second-order section filters
403
+ Second-order section filters
405
404
phaseshift : (C,) array_like
406
405
Phase shift
407
406
signal : (N,) array_like
@@ -418,30 +417,32 @@ def nfchoa_driving_signals(delay, weight, sos, phaseshift, signal, max_order=Non
418
417
419
418
"""
420
419
if max_order is None :
421
- max_order = _max_order_circular_harmonics (len (phaseshift ), max_order )
420
+ max_order = _max_order_circular_harmonics (len (phaseshift ), max_order )
422
421
423
422
delay = util .asarray_1d (delay )
424
423
weight = util .asarray_1d (weight )
425
424
# TODO : check FOS/SOS structure
426
425
427
426
N = len (phaseshift )
428
427
L = len (signal )
429
- d = np .zeros ((L ,N ),dtype = 'complex128' )
428
+ d = np .zeros ((L , N ), dtype = 'complex128' )
430
429
431
430
modal_response = sig .sosfilt (sos [0 ], signal )
432
431
for l in range (N ):
433
- d [:,l ] += modal_response
432
+ d [:, l ] += modal_response
434
433
for m in range (1 , max_order + 1 ):
435
434
modal_response = sig .sosfilt (sos [np .abs (m )], signal )
436
435
for l in range (N ):
437
- d [:,l ] += modal_response * 2 * np .cos (m * phaseshift [l ])
436
+ d [:, l ] += modal_response * 2 * np .cos (m * phaseshift [l ])
438
437
t_offset = delay [0 ]
439
438
return np .real (d ) * weight , fs , t_offset
440
-
439
+
440
+
441
441
def _max_order_circular_harmonics (N , max_order ):
442
442
"""Compute order of 2D HOA."""
443
443
return (N - 1 ) // 2 if max_order is None else max_order
444
444
445
+
445
446
def _normalize_digital_filter_gain (s0 , sinf , z0 , zinf , fs = 44100 ):
446
447
"""Match the digital filter gain at the Nyquist freuqneycy"""
447
448
@@ -453,5 +454,4 @@ def _normalize_digital_filter_gain(s0, sinf, z0, zinf, fs=44100):
453
454
omega = 1j * np .pi * fs
454
455
k *= np .prod ((omega - s0 )/ (omega - sinf ))
455
456
k *= np .prod ((- 1 - zinf )/ (- 1 - z0 ))
456
- return np .abs (k )
457
-
457
+ return np .abs (k )
0 commit comments