Full text
IEEE/ACM TRANSACTIONS ON AUDIO, SPEECH AND LANGUAGE PROCESSING, VOL. X, NO. Y, NOV. 2016 1 GPU-based Dynamic Wave Field Synthesis using Fractional Delay Filters and Room Compensation Jose A. Belloch?,Member, IEEE, Alberto Gonzalez, Senior Member, IEEE, Enrique S. Quintana-Ort´ ı, Miguel Ferrer, Member, IEEE, and Vesa V¨ alim¨ aki, Fellow, IEEE Abstract Wave Field Synthesis (WFS) is a multichannel audio reproduction method, of a considerable computational cost that renders an accurate spatial sound field using a large number of loudspeakers to emulate virtual sound sources. The moving of sound source locations can be improved by using fractional delay filters, and room reflections can be compensated by using an inverse filter bank that corrects the room effects at selected points within the listening area. However, both the fractional delay filters and the room compensation filters further increase the computational requirements of the WFS system. This paper analyzes the performance of a WFS system composed of 96 loudspeakers which integrates both strategies. In order to deal with the large computational complexity, we explore the use of a graphics processing unit (GPU) as a massive signal co-processor to increase the capabilities of the WFS system. The performance of the method as well as the benefits of the GPU acceleration are demonstrated by considering different sizes of room compensation filters and fractional delay filters of order 9. The results show that a 96-speaker WFS system that is efficiently implemented on a state-of-art GPU can Jose A. Belloch and Enrique S. Quintana-Ort´ ı are with the Depto. de Ingenier´ ıa y Ciencia de Computadores, Universitat Jaume I, 12071, Castell´ on, Spain. ?Corresponding author. E-mail: [email protected]. A. Gonzalez and M. Ferrer are with the Institute of Telecomunications and Multimedia Applications, Universitat Polit` ecnica de Val` encia, 46022, Valencia, Spain. V. V¨ alim¨ aki is with the Dept. of Signal Processing and Acoustics, Aalto University, Espoo, Finland. Dr. Jose A. Belloch is supported by the postdoctoral fellowship from Generalitat Valenciana APOSTD/2016/069. This work has been partially supported by EU together with Spanish Government through TEC2015-67387-C4-1-R and TIN2014-53495-R (MINECO/FEDER), and Generalitat Valenciana through PROMETEOII/2014/003. January 23, 2017 DRAFT
IEEE/ACM TRANSACTIONS ON AUDIO, SPEECH AND LANGUAGE PROCESSING, VOL. X, NO. Y, NOV. 2016 2 synthesize the movements of 94 sound sources in real time and, at the same time, can manage 9,216 room compensation filters having more than 4,000 coefficients each. Index Terms Audio systems, interpolation, parallel architectures, parallel processing, signal synthesis I. INTRODUCTION In the last few decades, there has been increasing interest in enhancing and improving listening experience, especially spatial audio rendering [1]. One of the spatial audio technologies available today is Wave Field Synthesis (WFS) in which a sound field is synthesized in a wide area by means of loudspeaker arrays, which are referred to as secondary sources [1]. WFS is usually tackled via digital signal processing techniques to reproduce complex auditory scenes consisting of multiple acoustic objects, which are generally denoted as primary or virtual sources. The WFS concept was introduced at the Delft University of Technology in the 1980s. Berkhout developed the first investigations in this field [2], [3], which were followed by several dissertation works [4], [5], [6], [7], [8]. One of the practical problems of implementing WFS is the interaction of the speaker array with the listening room. The room introduces echoes that are not part of the signal to be reproduced, thus altering the synthesized sound field and disturbing the spatial effect. One solution that can be added to the WFS system to minimize the undesirable interaction of the array with the listening room is a Room Compensation (RC) block. A common RC block is based on a multichannel inverse filter bank and corrects the room effects at selected points within the listening area [9], [10]. This formula was validated in [11], where significant improvements were presented in the acoustic field when an RC block is applied to a WFS system. In practice, the application of this spatial audio system (WFS + RC) in real environments (theaters, cinemas, etc.) requires a real-time solution with high computational requirements. Another special situation in WFS occurs when it is necessary to render a moving sound source through a specific trajectory. In a WFS system that is implemented using discrete-time processing, accurate modeling of propagation times requires a signal to be delayed by a number of samples that is not an integer multiple of the sampling intervals. To this end, we propose the use of fractional delay filters [12], [13] to render the audio signals in this scenario. These filters are used to interpolate a signal value between the sampling points. Other applications of fractional delay filtering in audio signal processing include digital audio effects [14], [15] and physical sound synthesis [16], [17]. Franck et al. have studied techniques to interpolate time delays in WFS and have analyzed artifacts that arise when fractional delays January 23, 2017 DRAFT
IEEE/ACM TRANSACTIONS ON AUDIO, SPEECH AND LANGUAGE PROCESSING, VOL. X, NO. Y, NOV. 2016 3 are not considered [18], [19], [20]. The use of fractional delays in a WFS system has also been analyzed in [21], [22], [23]. A large-scale WFS system with massive additional filtering requires costly computational operations in real time. One solution to this problem is to perform all audio processing tasks in a Graphics Processing Unit (GPU). Accelerators of this type have already been applied to different problems in acoustics and audio processing. Some applications include room acoustics modeling [24], [25], [26], [27], additive synthesis [28], [29], full 3-D model of drums in a large virtual room [30], sliding phase vocoder [31], beamforming [32], audio rendering [33], [34], [35], multichannel IIR filtering of audio signals [36], dynamic range reduction using multiple allpass filters [37], and adaptive filtering [38], [39], [40]. In recent years, there have been several studies aimed at implementing a WFS system. An approach that benefited from time-invariant preprocessing in order to reduce the computational load is presented in [41]. In [42], the authors propose a minimal processor architecture that is adapted to WFS-based audio applications. They estimated that their system could render (in real time) up to 32 acoustic sources when driving 64 loudspeakers. In [43], the same researchers presented a WFS implementation on different multi-core platforms, including a GPU-based implementation that controlled more than 64 sources when driving 96 loudspeakers. They concluded that GPUs are suitable for building immersive-audio, real-time systems. In [44], the authors also introduced a GPU-based hybrid time-frequency implementation of WFS. Real-time issues in WFS were tackled in [45] using the NU-Tech framework [46]. In comparison with previous efforts, the WFS implementation proposed in this work improves the quality of the virtual sound by adding room compensation and time-varying fractional delays filters. Moreover, we design our application to achieve high performance on GPUs by exploiting a Kepler GK110 [47] co-processor. This architecture can be found on the Tegra K1 (TK1) systems-on-chip (SoC), which is embedded in the Jetson development kit (DevKit) [48]. It is also integrated into current mobile devices such as the Google Nexus 9 tablet [49]. Therefore, this implementation can be ported to perform efficiently on GPUs which are currently embedded in mobile devices. This paper extends our previous work [50] in various ways. First, we use fractional delay filters in order to reproduce a sound source position with high accuracy and to be able to move a sound source smoothly using time-delay steps of less than one sample along the way. Second, we now implement the WFS system with different sample buffer sizes, which establish the minimum and the maximum time that a sound source can stay in one position and thus the different possibilities regarding the speed of the sound source. Finally, for shorter buffer sizes, we now implement a uniformly-partitioned, FFT-based convolution, which can efficiently convolve FIR filters that have a large number of coefficients with audio January 23, 2017 DRAFT
IEEE/ACM TRANSACTIONS ON AUDIO, SPEECH AND LANGUAGE PROCESSING, VOL. X, NO. Y, NOV. 2016 4 buffers with smaller size. The algorithm that we implement was introduced in [51] and uniformly splits the room compensation filters into blocks of the same size as the audio buffer. This improvement is crucial since it reduces the latency of the system independently of the size of the room compensation filters. This paper presents the performance of a GPU-based dynamic WFS implementation that (i) allows accurate synthesis of virtual sound source positions and thus accurate movement trajectories using Fractional Delay Filters; (ii) leverages an inverse filter bank to improve the spatial effect of the WFS; and (iii) is capable of synthesizing a large number of virtual sound sources in real time. We also analyze the potential of using time-varying fractional delay filters in WFS and the influence on the computational time for different sizes of audio buffers and room compensation filters. This paper is structured as follows. Section II briefly describes the key architecture aspects of the target GPUs from NVIDIA and highlights the features to be accounted for when implementing a real-time WFS on this type of accelerator. Section III offers a brief overview of the WFS theory. Section IV enumerates different kinds of fractional delay filters, assesses which fractional delay filter is the most appropriate for a WFS system, and tests subjectively the different techniques for carrying out sound source movements inside this system. Section V presents a detailed description of a GPU-based implementation of the WFS system. In Section VI, we evaluate the computational performance of the WFS system, and we summarize our results in Section VII. II. USE OF A GPU IN A REAL-TIME WFS SYSTEM Dealing with real-time audio applications on GPUs requires a basic understanding of how architectures of this type are programmed. This section provides a brief description of the GPU data flow and outlines some relevant issues to take into account when developing a real-time WFS application on a graphics accelerator from NVIDIA. A. GPU and CUDA Following Flynn’s taxonomy [52], from a conceptual point of view, a GPU can be viewed as a Single Instruction Multiple Data machine (SIMD), i.e., a computer in which a single flow of instructions is executed on different data sets. Implementations of this model usually work synchronously with a common clock signal. An instruction unit sends the same instruction to the processing elements, which execute this instruction on their own data simultaneously. A GPU is composed by multiple Stream Multiprocessors (SM) with 192 pipelined cores per SM, for NVIDIA’s 3.5 capability (Kepler architecture [47]). January 23, 2017 DRAFT
IEEE/ACM TRANSACTIONS ON AUDIO, SPEECH AND LANGUAGE PROCESSING, VOL. X, NO. Y, NOV. 2016 5 A GPU device has a large amount of off-chip device memory (global-memory) and a fast, but smaller, on-chip memory (shared-memory,registers). The shared-memory is normally used by threads that must share data. There are also read-only cached memories, which are called constant-memory and texturememory.Constant-memory is optimized for broadcast (e.g., all threads have to read the same memory location), while the texture-memory is oriented to graphics operations. Fig. 1 shows the organization of a GPU. Advanced GPU devices (beyond 2.x capability) come with an L1/L2 cache hierarchy that is used to cache global-memory. The L1 cache uses the same on-chip memory as shared-memory. An important aspect when reading from or writing to global-memory is to perform these accesses in acoalesced manner, as this can significantly reduce the memory-access time. Coalescing means that the threads have to read from/write to a small range of memory addresses that match a certain pattern. Let idx be the identification of a thread and array a pointer to global-memory. We attain perfect coalescence when the idx thread accesses the array[idx] and idx+1 accesses the array[idx+1]. SP SM GPU Shared M. / L1 Cache Registers SM Shared M. / L1 Cache Registers SM Shared M. / L1 Cache Registers Constant Memory/Texture Memory L2 Cache Global Memory SP SP SP SP SP SP SP SP SP SP SP SP SP SP SP SP SP SP SP SP SP SP SP SP SP SP SP SP SP SPSP SP SP SP SP Fig. 1. The GPU is configured by 16 Stream Multiprocessors (SMs), each of which has 192 pipelined cores (SP). CUDA is an extension of the C language to ease the development of GPU-oriented efficient solvers for complex problems with high computational cost [53]. This interface can be used to leverage the vast number of execution threads that are available in a state-of-the-art GPU. In CUDA, the programmer defines the kernel function that contains code (operations) to be executed on the GPU. This kernel routine is invoked from the main program, which also has to define a grid configuration stating the number of execution threads and how they are distributed and grouped. B. Real-Time Processing of a WFS System on a GPU The target WFS system is located at the Universitat Polit` ecnica de Val` encia (UPV) and is operated by the Audio and Communications Signal Processing Group (GTAC) [54]. This system is composed of January 23, 2017 DRAFT
IEEE/ACM TRANSACTIONS ON AUDIO, SPEECH AND LANGUAGE PROCESSING, VOL. X, NO. Y, NOV. 2016 6 N=96 loudspeakers that are positioned in an octogonal geometry, with a separation of 18 cm between neighboring loudspeakers (see Fig. 2 for a graphical representation of this configuration). 4.3 m 1.45 m 120º Fig. 2. Configuration of the WFS loudspeaker array available in the laboratory of the GTAC at UPV. The loudspeakers are connected to four MOTU 24I/O audio cards that use the ASIO (Audio Stream Input/Output) driver to communicate with the CPU. This driver works with blocks of Lsamples obtained with a sampling rate fs. Thus, every Lfsseconds, the audio card requires the loudspeakers to reproduce Noutput-data buffers of size L. This time is denoted as tbuff [35] and is independent of the number of loudspeakers and the number of virtual sound sources (M) in the WFS system. In contrast, the processing time tproc depends both on Mand N. Here, tproc includes the time spent on data transfers between the GPU and the CPU and the time used for the computation on the GPU (CUDA kernels). These data transfers are carried out via the PCI-e X 16 bus, which has an approximate bandwidth rate of 8 GB/s. Therefore, the WFS system works in real time provided tproc < tbuff . When this condition no longer holds, the application can still work off-line (i.e., processing the audio samples in order to reproduce them later). III. FUNDAMENTALS OF WFS Wave Field Synthesis is a sound rendering method that is based on fundamental acoustic principles [2]. It enables the generation of sound fields with natural temporal and spatial properties within a volume or area bounded by secondary sources (arrays of loudspeakers, see Fig. 2). This method offers a large listening area with uniform and high reproduction quality. January 23, 2017 DRAFT
IEEE/ACM TRANSACTIONS ON AUDIO, SPEECH AND LANGUAGE PROCESSING, VOL. X, NO. Y, NOV. 2016 7 The theoretical basis for WFS is given by Huygens’ principle [3]. According to this principle, the propagation of a wave front can be described by adding the contribution of a number of secondary-point sources distributed along the wave front, where a synthesis operator is derived for each secondary source. This principle can be used to synthesize acoustic wave fronts of any arbitrary shape. For simplicity, the general 3-D solution can be transformed into a 2-D solution, which is sufficient to be able to reconstruct the original sound field in the listening plane [4], [5], [55]. For that purpose, a linear array of loudspeakers is used to generate the sound field of virtual sources. Following a model-based rendering in which point sources and plane waves are used [56], the field rendered by a sound source mat a point R, within the area surrounded by Nloudspeakers, can be expressed as P(xR, ω) = N−1 X n=0 Qn(xm, ω)e −jωrnR c rnR ,(1) where cis the speed of the sound, xmis the position of the virtual sound source m,xRis the position of the point R, and rnR =|xn−xR|is the distance between the n-th loudspeaker and the point R. The driving signal of the n-th loudspeaker is represented by Qn(xm, ω), which is given by Qn(xm, ω) = S(ω)sjω 2πcK1 √rmn cos(θmn)e −jωrmn c,(2) where Kis a geometry-dependent constant, rmn =|xm−xn|and xnis the position of the loudspeaker n. Fig. 3 shows the geometry of the system, where θmn is the angle between the line that connects xmand xnand the normal vector nof the loudspeaker n. The piano represents the sound source m. The driving signal (2) consists of several elements that have different functionalities. The term Loudspeaker 0 x Sound Source Loudspeaker N-1 ... ... ... ... ... ... ... Loudspeaker n m xn xR r θ θ mn r nR mn mn Fig. 3. Geometry of a WFS system with the sound source m(piano), Nloudspeakers, and the distances among the sound source, the loudspeakers, and the listener (R). January 23, 2017 DRAFT
IEEE/ACM TRANSACTIONS ON AUDIO, SPEECH AND LANGUAGE PROCESSING, VOL. X, NO. Y, NOV. 2016 8 S(ω)is the frequency-domain characteristic of the source signal, while the term H(ω) = sjω 2πc (3) represents a filtering operation that is independent of the position of the virtual source. In [57], (3) is referred to as a WFS pre-equalization filter that represents a lowpass filter with a constant slope of 3 dB/octave when the loudspeaker is considered a monopole secondary source. If the loudspeaker is considered a dipole secondary source, the WFS pre-equalization filter corresponds to a highpass filter with a magnitude increase of 3 dB/octave. An important contribution in (2) is amn =K √rmn cos(θmn),(4) which denotes an amplitude factor that depends on the positions of the sound source mand the loudspeaker n. Finally, the term e −jωrmn crepresents the phase shift corresponding to a time delay that depends on the distance between the virtual sound source mand the loudspeaker n. The driving signal shown in (2) can also be expressed in the time domain as qm n(t) = amnsm(t)∗h(t)∗δ(t−|xm−xn| c),(5) where ∗denotes the convolution operator, sm(t)is the signal of sound source m, and h(t)is the inverse Fourier transform of H(ω)in (3). In a multi-source system composed of Mvirtual sound sources, the loudspeaker driving signal of the nth loudspeaker is qn(t) = M−1 X m=0 qm n(t).(6) In a discrete-time signal processing system with sampling frequency fs, (5) and (6) boil down to qn[k] = M−1 X m=0 amnsm[k]∗h[k]∗δ[k−τmn],(7) where kis the sample index, and τmn =|xm−xn| cfs(8) is the delay in number of samples. A. Room Compensation in a WFS System The interaction of the driving signals with the listening room can deteriorate the rendering properties of the WFS system. The synthesized sound field can be altered by new echoes that are introduced by the listening room, reducing the spatial effect. In [11], [58], the authors designed and validated a multichannel January 23, 2017 DRAFT
IEEE/ACM TRANSACTIONS ON AUDIO, SPEECH AND LANGUAGE PROCESSING, VOL. X, NO. Y, NOV. 2016 9 inverse filter bank that corrects these room effects at selected points within the listening area. However, in a WFS system composed of Nloudspeakers, this implies inserting N2FIR filters to the system, considerably increasing its computational demands. The operations that are carried out in a multichannel inverse filter bank with every driving signal are given by yn(t) = N−1 X j=0 qj(t)∗fjn(t).(9) Thus, the final signal to be reproduced by the n-th loudspeaker yn(t)is a combination of all of the filtered signals (as illustrated in Fig. 4), where the filter f0n(t)transmits the driving signal q0(t)to the loudspeaker n. Driving Signal N-1 Loudspeaker 0 f(N-1)(N-1) fj(N-1) f0(N-1) q(N-1) Driving Signal j qj Driving Signal 0 q0 f(N-1)n fjn f0n f(N-1)0 fj0 f00 y0y ny(N-1) Loudspeaker nLoudspeaker N-1 Fig. 4. Multichannel inverse filter bank, where each driving signal is convolved by Nfilters. The signal that is reproduced by a loudspeaker is a combination of all of the filtered signals. The calculation of the inverse filters can be carried out in a setup stage since the main room reflections at low frequencies, can be considered to be invariant for this specific room. Different methods have been proposed to obtain the bank of correction filters. There are methods that compute an approximate solution in the frequency domain using the FFT [59]. In this work, we instead leverage a method to compute the correction filters fjn, which guarantee a minimal square error solution in the time domain [60]. A detailed description of the operations that were carried out for the computation of the filters is reported in [11]. B. Accurate Location in Dynamic Sound Sources The virtualization of the sound source movements is carried out by smoothly varying the virtual positions of sound sources over time. In practice, this implies switching the synthesis of the sound source from the actual position to a new position. Considering a linear loudspeaker array composed of 24 loudspeakers, such as that in Fig. 5, we can define a uniform grid of points where a virtual sound source and a possible trajectory of the sound source (dark thin arrow from left to right) can be set. January 23, 2017 DRAFT
IEEE/ACM TRANSACTIONS ON AUDIO, SPEECH AND LANGUAGE PROCESSING, VOL. X, NO. Y, NOV. 2016 16 FD Fractional delay filtering (proposed method). This option, which is computationally simpler than CR above, consists of using a small trajectory resolution (dAB = 0.001 m was used) and changes the spatial position in smaller steps and more quickly to obtain a duration equal to the previous signals. A trajectory resolution of less than 8 mm requires an interpolation technique producing fractional delay values. To achieve a suitable trajectory resolution, we use of the truncated Lagrange interpolation, which delivers a close approximation to the ideal case (see Sec. V.A). January 23, 2017 DRAFT
IEEE/ACM TRANSACTIONS ON AUDIO, SPEECH AND LANGUAGE PROCESSING, VOL. X, NO. Y, NOV. 2016 17 A subjective test was carried out in order to reveal which technique produces the most realistic movement, taking into account the human perception. We carried out a test in which the three techniques were compared using a hidden reference paradigm [64]. The three techniques were compared by pairs in a test of six questions. A total of 21 people participated in the listening experiment; their ages were between 23 and 35. The hearing of all test subjects was tested using standard audiometry. None of them had a reportable hearing loss, which could affect the results. Fig. 7 shows the preference of the subjects when the three techniques were pair-compared. 0 5 10 15 20 25 30 35 40 FD NO Ind 39 21 25 1 16 33 2 7 FD vs NO FD vs CR CR vs NO CR NO Ind FD CR Ind Fig. 7. Preference of the test subjects when the three techniques were pair compared. Ind refers to indifference (i.e., no preference). The results in Fig. 7 show that the techniques CR and FD are preferred to the NO technique. This symbolizes that additional processing must be carried out in order to synthesize a realistic movement. Between CR and FD, the test subjects preferred FD. This implies that they identify the use of small trajectory resolution and a fractional delay interpolation as a more realistic movement than the one which is carried out by using a crossfading technique. This is a highly useful result, since the implementation based on fractional delay filters, which sounds better, requires also significantly less computing than the crossfading technique. V. IMPLEMENTATION OF THE WFS PROCESSING ON THE GPU As introduced in Section II-B, the WFS system consists of several multichannel audio cards that provide audio buffers every Lfsseconds, where Lis the buffer size in samples. We denote the input-data buffer of Lsamples of the sound source mby sbuffm, and the output-data buffer of the Lsamples that feeds the loudspeaker nby ybuffn. We use the GPU to accelerate all of the processing tasks of a WFS system that integrates fractional delay filters and room compensation filters. For this purpose, the operations are applied simultaneously on all of the buffers and on each sample. January 23, 2017 DRAFT
IEEE/ACM TRANSACTIONS ON AUDIO, SPEECH AND LANGUAGE PROCESSING, VOL. X, NO. Y, NOV. 2016 18 In previous work [50], we implemented a WFS system based on an overlap-save technique in the frequency domain. However, in this work we reduce the number of real-time filtering computations by convolving filter h(which is independent of the position of the virtual sound source) with all the filters that compose the multichannel inverse filter bank following the equation e fjn =fjn ∗h, (18) where n, j ∈[0, N −1]. Thus, our WFS implementation only requires delaying and weighting the source signal: qn[k] = M−1 X m=0 amnsm[k]∗δ[k−τmn].(19) As equation (19) is rather simple, we perform the delay τmn and the weight amn of the sound signal in the time domain for this WFS implementation. The WFS system starts from a virtual sound source, which is defined by its position xm, and the audio samples (which are given by audio buffers sbuffm). The distance rmn and the angle θmn are computed from this position xmand the location of the loudspeakers xn(see Fig. 3). Algorithm 1 describes all the operations that are necessary to execute the WFS system. The input variables for this algorithm are the number of sound sources M, the parameters rmn and θmn, the audio buffers sbuffm, and the filters e fjn. The following subsections present a detailed description of the GPU implementation of the two key processing blocks: Driving Signals of WFS and Room Compensation filtering. A. Driving Signals of WFS We use the following CUDA kernels to compute steps 2 to 14 in Algorithm 1. Kernel 1 launches NM threads and computes steps 5, 6, and 7. The kernel inputs are the coordinates of the virtual sound sources and the positions of the loudspeakers. Each thread computes a simple factor τmn,e τmn, and amn. Kernel 2 computes the coefficients of the fractional delay filters (step 8). The highest accuracy is obtained with a 9th-order filter based on truncated Lagrange. In this case, each filter is composed of ten coefficients, and, since there is a filter per sound source and loudspeaker, 10NM threads are spawned. Each thread computes a coefficient of one of the filters. Kernel 3 computes steps 9 and 10. A tridimensional matrix composed of the audio buffers qm buffnis configured: the number of rows in this matrix matches the number of sources M; the number of columns is 2L(number of samples per buffer, see section II-B); and the third dimension corresponds to the number of loudspeakers N= 96 in this WFS system (see Fig 8). Therefore, 2LNM threads are spawned. The January 23, 2017 DRAFT
IEEE/ACM TRANSACTIONS ON AUDIO, SPEECH AND LANGUAGE PROCESSING, VOL. X, NO. Y, NOV. 2016 19 Algorithm 1 WFS system with Room Compensation and Fractional Delay Filters. Input: M,θmn,rmn,sbuffm,e fjn Output: ybuffn 1: /*----- Driving Signals of WFS ----*/ 2: for n= 0, . . . , N −1do .Computation of amplitudes and delays 3: qbuffn= 0; .Initialization of buffers with zeros 4: for m= 0, . . . , M −1do .Combination Loudspeaker-Sound Source 5: amn =K √rmn cos(θmn)..rmn =|xm−xn|; 6: τmn =rmn cfs..see Fig (3) for θmn. 7: eτmn =bτmnc. 8: hfd = Compute Fractional Delay Filters(τmn −eτmn). 9: qm buffn=amn ·(sbuffm∗δ[k−eτmn]). 10: qbuffn=qbuffn+ (qm buffn∗hfd). 11: end for 12: end for 13: /*----- Room Compensation filtering ----*/ 14: for n= 0, . . . , N −1do 15: ybuffn= 0; .Initialization of output buffers with zeros 16: for j= 0, . . . , M −1do 17: ybuffn=ybuffn+ (qbuffj∗e fjn). .Filter his included. See Equation (18) 18: end for 19: end for task of the threads is to compute and to group all output audio samples by considering e τmn and amn (combining each sound source with each loudspeaker). The configuration of this matrix is crucial to be able to efficiently perform the next steps of the implementation. The threads access global-memory in a coalesced manner starting from the integer part of τmn, which is used internally as a pointer to inform the GPU threads which audio samples must be used for the processing. The CUDA device has a compute capability 3.5, and the compiler is forced to use the read-only memory path in order to load audio samples from the global-memory since this memory has a high bandwidth. The last feature to be configured in the CUDA programming is the L1 cache, which is set to 48 kB in order to cache memory loads from global-memory. These three combined actions reduce the possibility of memory conflicts when multiple threads access the global-memory concurrently. January 23, 2017 DRAFT
IEEE/ACM TRANSACTIONS ON AUDIO, SPEECH AND LANGUAGE PROCESSING, VOL. X, NO. Y, NOV. 2016 20 Kernel 4 is devoted to accumulating all of the samples of each loudspeaker (step 10). For this purpose, 2LN threads are spawned and each thread performs Madditions. Audio Samples 2L M N Audio Samples 2L M 10 coefficients from a fractional delay filter M N M N M N Amplitude factors Delay factors KERNEL 3 2LNM cuda threads are launched KERNEL 4 2LN cuda threads are launched N Audio Samples 2L Fig. 8. Kernel 3 and Kernel 4 perform the computation of the driving signals of a WFS system. If a crossfade technique is used, two tridimensional matrices composed of audio samples are configured since there are two amplitudes aA mn and aB mn, and two delays τA mn and τB mn (Aand Brepresent the two points between which the movement in the sound source is rendered). Therefore, twice the number of threads are spawned by Kernels 1,2, and 3in this case (see [50] for implementation details of the crossfade technique). B. Room Compensation In previous work [50], we used filters with the same size as the sample buffers. Specifically, the size that was previously considered was L= 512. However, the filters that carry out the Room Compensation usually have a large number of coefficients [65]. Therefore, if audio buffers of the same size are used, the latency of the system will substantially increase. This also implies that the movements of the virtual sound sources will become slow since the buffer size Lis very large. January 23, 2017 DRAFT
IEEE/ACM TRANSACTIONS ON AUDIO, SPEECH AND LANGUAGE PROCESSING, VOL. X, NO. Y, NOV. 2016 21 TABLE IV AVERAGE PERCENTAGE OF THE TOTAL PROCESSING TIME THAT EACH KERNEL REQUIRES FOR M= 300 AND B= 6. Processing Blocks Percentage Kernel 1 3% Kernel 2 1.5% Kernel 3 2% Kernel 4 1.5% Room Compensation Block 92% For this proposal, we consider the implementation that we presented in [35]. In that work, we presented a GPU-based implementation that efficiently filters audio buffers of a size that is much smaller than that of the filters. To this end, the approach leverages the algorithm presented in [51], [66], based on the uniformly-partitioned fast convolution algorithm using the overlap-save technique. This means that the room compensation filters are uniformly split into blocks of the same size as that of the input-data buffer. Thus, denoting the size of the filters e fjn by lf, we can define B=lf Las the number of partitions of the room compensation filter. The GPU-based implementation of this room compensation stage is described in [35]. Moreover, CUDA-like pseudo-codes of this stage are detailed in the dissertation [67]. Table IV shows the average percentage of the total processing time that each kernel requires. To carry out this measurement, we set the number of sound sources to M= 300 and the number of partitions to B= 6. As can be observed, most of the time is consumed by the 9216 filtering operations. If the room compensation block is not considered, the highest computational demands occur at Kernel 1 since the computation of τmn depends on a cosine operation, which is computationally expensive. VI. COMPUTATIONAL PERFORMANCE We have evaluated our WFS system on an NVIDIA device K20Xm board that belongs to the Keplerbased family of GPUs [53], [68], owns a compute capability of 3.5, and is composed of a read-only cache memory and 2688 cores. We set the audio card to provide blocks of L∈ {64,256,1024}samples with a sample frequency fs= 44.1kHz. This means that tbuff takes the values 1.45 ms, 5.80 ms, and 23.22 ms for the different buffer sizes. We assess our WFS system by gradually increasing the number of sources Mwhile measuring tproc for the target environments. Keep in mind that our WFS system operates under real-time conditions as long as tproc < tbuff . The performance of the WFS system has been analyzed for different variables: size of audio buffers L, length of room compensation filters lf, number of partitions Bthat can be executed at the room January 23, 2017 DRAFT
IEEE/ACM TRANSACTIONS ON AUDIO, SPEECH AND LANGUAGE PROCESSING, VOL. X, NO. Y, NOV. 2016 22 tbuff(ms) Number of Sound Sources FD: lf = 512, B=2 FD: lf = 768, B=3 FD: lf = 1024, B=4 tbuff(ms) CR: lf = 512, B=2 CR: lf = 768, B=3 CR: lf = 1024, B=4 2 3 4 5 20 40 60 80 100 120 Fractional Delay filters Vs Crossfade Technique Processing Time (ms) Fig. 9. Performance of the WFS system using a buffer size of L= 256 samples for three room compensation filter lengths: 512, 768, and 1024. The black curves synthesizes the virtual sound sources by using NM 9th-order fractional delay filters and the grey curves synthesizes the virtual sound sources by using the crossfade technique. compensation filters to reduce latency, possible accuracy requirements in the sound localization (use of 9th-order fractional delay filters), and use of any trajectory resolution for sound source movements (use of the crossfade technique). Fig. 9 shows the variation of the processing time tproc when the WFS system uses an input-data buffer of L= 256 samples. The computational performance has been measured when the filters e fjn consist of 512, 768, and 1024 coefficients, which imply a partition of the filter into B= 2, 3, and 4 partitions, respectively. Fig. 9 represents the time tproc for the case when WFS uses MN 9th-order fractional filters to render the virtual sound source (low trajectory resolution and high accuracy), see the black curves. As the number of partitions increases, the number of sound sources that can be rendered in real time decreases in approximately the same proportion. The use of fractional delays provides sound source synthesis with better accuracy, but it also requires that sound source displacements be carried out between closer points in order to avoid high variations of amplitudes and delays (see Table II). The consequence of limiting the sound source movement to a short displacement also constrains the speed of the sound source since this factor has a direct relation to the trajectory resolution. In order to synthesize any sound source speed (i.e. to shift between any two positions in the WFS system), we need to carry out the crossfade technique. This way audible artifacts are avoided. Fig. 9 shows also the time tproc for this scenario, see the grey curves. The crossfade technique involves more than twice the number of operations compared with the fractional delay filters. As a result, it reduces the maximum number of sound sources that can be reproduced in real time by a maximum factor of six. Note that slopes can be observed in grey curves when the sound sources in the WFS system are 15, January 23, 2017 DRAFT
IEEE/ACM TRANSACTIONS ON AUDIO, SPEECH AND LANGUAGE PROCESSING, VOL. X, NO. Y, NOV. 2016 23 23, and 31. Up to these values, all parallel resources are being used since the curve is quite flat. From there on, the slope becomes steeper because there is data that cannot be processed in parallel and must wait for other data to be computed. In Section II-A, the GPU architecture was shown to be composed of multiple SMs. Before the computation begins, the data is distributed among the SMs. Specifically, when there are 16 sound sources, there are few SMs that have more data to process than others. As the number of sound sources increases, the parallel resources are efficiently used. However, when the number of sound sources reaches 24, the volume of data does not match the parallel resources in the SMs. The same occurs with 32 sound sources. Tables V and VI repeat the above experimentation with L= 64 and L= 1024 and room compensation filters of different sizes. Column 3 shows the number of partitions Bof size 2Lthat is produced in each one of the 96 ×96 filters e fjn that make up our inverse filter bank (Fig. 4). Column 5 indicates the maximum number of sound sources that can be rendered by the system in real time. The time tproc used by the GPU to compute the target number of sound sources is shown in column 6. In these tables, the times tproc for L= 256 are extracted from Fig. 9. Fig. 10 illustrates the ratio that relates the maximum number of sound sources that can be rendered in real time using fractional delay filters and the crossfade technique for different numbers of partitions Band sizes of buffer L. In both cases, as Lincreases, the time tbuff increases and this allows a larger number of sound sources to be achieved in real time. However, as Bincreases, the number of operations increases, which implies a larger tproc, and thus a smaller number of sound sources in real time. In summary, we want to highlight that the decision to use the crossfade technique must be thoroughly assessed since it requires a great amount of computational resources and significantly penalizes the performance of a WFS system. Therefore, we recommend the use of WFS systems with a minimum trajectory resolution and Fractional Delay Filters. VII. CONCLUSION The use of GPUs in large-scale audio systems is gaining momentum. One of the audio systems that requires a great amount of processing power is Wave Field Synthesis with room compensation and moving virtual sound sources. In this paper, we have analyzed how a state-of-the-art GPU can be used to develop a high-performance solution for this problem. In terms of accuracy of the sound source localization, we have studied the impact of synthesizing a moving sound source via time-varying fractional delay filters. Our results show that filters of this kind offer the best approach for the theoretical WFS signal. Specifically, the best results were obtained with January 23, 2017 DRAFT
IEEE/ACM TRANSACTIONS ON AUDIO, SPEECH AND LANGUAGE PROCESSING, VOL. X, NO. Y, NOV. 2016 24 TABLE V MAXIMUM PERFORMANCE THAT THE WFS SYSTEM ACHIEVES WHEN THE SOUND SOURCES ARE SYNTHESIZED USING 9-TH ORDER FRACTIONAL DELAY FILTERS. BUFFER SIZES OF L= 64 AND L= 1024 AND DIFFERENT SIZE OF ROOM COMPENSATION FILTERS lfARE EVALUATED. L tbuff BSize of Max. Sources tproc (ms) (ms) e fjn Real Time Real Time 64 1.451 1 64 92 1.433 2 128 68 1.449 3 192 51 1.449 4 256 36 1.442 5 320 20 1.436 6 384 5 1.446 256 5.805 1 256 198 5.752 2 512 132 5.793 3 768 102 5.770 4 1024 73 5.744 5 1280 45 5.750 6 1536 18 5.791 1024 23.22 1 1024 262 23.175 2 2048 162 23.062 3 3072 130 23.198 4 4096 94 23.092 5 5120 60 23.199 6 6144 25 23.121 the truncated Lagrange interpolation technique. When shifting a virtual sound source between two points, audible non-linear artifacts can appear due to the large changes in amplitudes and delays that must be rendered by the WFS system. To avoid this, we have also evaluated the WFS system using the crossfade technique, which more than doubles the number of operations in comparison with the use of fractional delay filters. In addition, we have improved our previous GPU-based implementation by filtering audio buffers that are smaller than the size of room compensation filters. This allows the design of room compensation filters with a large number of coefficients and thus higher spatial sound quality. In order to implement the system efficiently, we have convolved the WFS pre-equalization filter hwith the room compensation filters before starting the real-time processing. Finally, our implementation exploits the resources of GPUs with Kepler architecture, which can currently be found in new-generation mobile devices such as modern tablets. January 23, 2017 DRAFT
IEEE/ACM TRANSACTIONS ON AUDIO, SPEECH AND LANGUAGE PROCESSING, VOL. X, NO. Y, NOV. 2016 25 1 1 - 2 - 3 - 4 - 5 - 6 - 7 - L=64 L=256 L=1024 Ratio Max Sound Sources in Real Time: Fractional Delay Filters vs Crossfade Number of Partitions B 23456 123456 123456 Fig. 10. Ratio that relates the maximum number of sound sources that can be rendered in real time using fractional delay filters and crossfade for different number of blocks Band sizes of buffer L. TABLE VI MAXIMUM PERFORMANCE THAT THE WFS SYSTEM ACHIEVES WHEN THE SOUND SOURCES ARE SYNTHESIZED USING THE CROSSFADE TECHNIQUE. BUFFER SIZES OF L= 64 AND L= 1024 AND DIFFERENT SIZE OF ROOM COMPENSATION FILTERS lfARE EVALUATED. L tbuff BSize of Max. Sources tproc (ms) (ms) e fjn Real Time Real Time 64 1.451 1 64 30 1.247 2 128 29 1.442 3 192 23 1.326 4 256 20 1.447 5 320 15 1.436 6 384 4 1.446 256 5.805 1 256 38 5.642 2 512 31 5.027 3 768 30 5.747 4 1024 23 5.336 5 1280 17 5.776 6 1536 10 5.786 1024 23.22 1 1024 38 21.361 2 2048 33 23.149 3 3072 31 22.468 4 4096 23 20.500 5 5120 19 22.917 6 6144 13 23.132 January 23, 2017 DRAFT