# Measurement of Head-Related Transfer Functions: A Review
## 2 Principle of HRTF Measurements
### Golay Codes
#### 2.2.2 HRTF Measurement with Sweep Signals  
A sweep signal, sometimes called \"chirp\" or \"swept-sine\", is a continuous signal whose frequency continuously changes with time. After the study presented by [PERSON] [41], who revealed some advantages by using sine sweep signals for identifying system nonlinearities, the use of the sweep method has become a popular way to measure acoustic impulse responses, such as room impulse responses, HRIRs, or electro-acoustical systems. As mentioned before, the use of sweep signals to measure acoustic systems has already been reported in early studies [46; 68; 69]. The reason why this approach was not successfully applied at that time is mainly due to the immature hardware and software technology used to perform measurements [70]. Different types of sweep signals can be found in the literature, such as linear sweep [46; 71; 72], exponential sweep [41; 70], red-colored sweep [38; 73], sweeplets [74], hyperbolic sweeps [75], and constant-SNR sweeps [76]. Among them, linear sweeps (some researchers call them time stretched pulses, TSP [71; 72]) and exponential sweeps (sometimes called log sweeps or logarithmic sweeps) are two popular sweep types that are often used to measure acoustic impulse responses when using sweep signals. Sweep Generation  
Linear and exponential sweep signals can be generated in either the time or the frequency domain. * Sweep Generation in the Time Domain  
In the time domain, a sweep signal with time-varying frequencies is represented as:  
\[x(t)=\text{A}\ \sin(\varphi(t)),\quad\text{and}\quad f(t)=\frac{1}{2\pi}\frac{d \varphi(t)}{dt}, \tag{10}\]  
where A is the amplitude of the sweep signal, \(\varphi(t)\) and \(f(t)\) represent the instantaneous phase and frequency, respectively. For a linearly varying frequency (linear sweep), from \(f_{1}\) to \(f_{2}\) within the time T, \(f(t)\) can be expressed as:  
\[f(t)=f_{1}+c\ t,\quad\text{with}\quad c=\frac{f_{2}-f_{1}}{\text{T}}. \tag{11}\]  
Figure 5: System identification using a pair of Golay codes (adapted from Figure 2 in [55]). The parameter \(c\) is derived by substituting the time instance t with T, and the frequency \(f(t)\) with \(f_{2}\). The instantaneous phase \(\varphi(t)\) is then calculated by integrating the frequency function over time, and the resulting linear sweep signal \(x(t)\) is expressed as:  
\[x(t)=\text{A}\ sin\left(2\pi\ f_{1}\ t+\frac{2\pi\ (f_{2}-f_{1})}{T}\ \frac{t^{2}}{2} \right). \tag{12}\]  
For a exponentially varying frequency (exponential sweep), also from \(f_{1}\) to \(f_{2}\) within the time T, the instantaneous frequency \(f(t)\) can be expressed as:  
\[f(t)=f_{1}\ e^{ct},\quad\text{with}\quad c=\frac{\ln\left(\frac{f_{2}}{f_{1}} \right)}{T}. \tag{13}\]  
After integrating the frequency over time, the resulting instantaneous phase \(\varphi(t)\) is then used to calculate the exponential sweep signal \(x(t)\) based on Equation (10):  
\[x(t)=\text{A}\ sin\left(2\pi\ \frac{f_{1}\ T}{\ln\left(\frac{f_{2}}{f_{1}} \right)}\ \left(e^{\frac{t}{T}\ \ln\left(\frac{f_{2}}{f_{1}}\right)}-1\right) \right). \tag{14}\]  
Unfortunately, as reported in [37; 38], spectral ripples may appear at the beginning and the end of desired frequencies caused by sudden on/off switching at the beginning and the end of sweep signals, leading to a degraded crest factor. This issue can be avoided by creating sweeps in the frequency domain, which means that the magnitude and phases/group delays are artificially synthesized and then transformed into the time domain to obtain the sweep signal via the IFFT. \(\circ\) Sweep Generation in the Frequency Domain  
The magnitude spectrum is white (constant over frequencies) and pink (decreases with 3 dB/octave) for the linear and the exponential sweep, respectively. The phase can be calculated by integrating the group delay \(\tau_{G}(f)\) over frequencies.