## 3 Dynamic Replacement of Impulse Responses
### Example  
In order to illustrate the behavior of dynamic replacement of filter impulse responses, we present a simple example. Figure 2 shows the input signals to a convolution process. On top are the two impulse responses \(h_{A}(n)\) and \(h_{B}(n)\). They are both sinusoidal signals of duration 1.5 s sampled at 44,100 Hz and with a frequency of 60 and 10 Hz, respectively. At the bottom is the input signal \(x(n)\), which is an impulse train with pulses at 0.3 s interval, also sampled at 44,100 Hz.  
These signals are convolved using partitioned convolution (overlap-add STFT) with partition length \(N_{P}=256\) and FFT block size \(N_{B}=512\). At time index \(n_{s}=1\) s, a switch between the two impulse response filters is performed.  
Figure 3 shows the results. At the top is the output from convolving the input signal \(x(n)\) with impulse response \(h_{A}(n)\), but only up to the time index \(n_{s}\). Notice the convolution tail between 1.0 and 2.5 s, equal to the filter length. In the middle is the output from convolving the input signal \(x(n)\) with impulse response \(h_{B}(n)\) starting after the time index \(n_{s}\). Finally, at the bottom, we show the output from convolving the input signal \(x(n)\) with both filters, such that \(h_{A}(n)\) is stepwise replaced by \(h_{B}(n)\) starting at time index \(n_{s}\), following the scheme introduced in the previous section. The important thing to note here is that an identical result is achieved if we instead add together the two partial outputs (top and middle).  
The convolution process is working on a single impulse response buffer. During the filter transition, the buffer will contain parts of both the filters \(h_{A}(n)\) and \(h_{B}(n)\). Figure 4 illustrates the content of the buffer at four different points in time. Just before transition (\(n_{s}=1\) s), the buffer is entirely filled with impulse response \(h_{A}(n)\). During the transition (1.5 and 2.0 s), we notice how the buffer is gradually filled with impulse response \(h_{B}(n)\), starting from sample 0. After the transition (\(n_{s}+N-1=2.5\) s), the buffer is entirely filled with impulse response \(h_{B}(n)\).  
There are noticeable discontinuities in the buffer content during transition, but it is important to realize that each of these buffer snapshots will be multiplied with the input \(x(n)\) to produce a single output sample. They are not temporal objects per se. As mentioned earlier, the method is equivalent to segmenting the input signal at the time \(n_{s}\): any input \(x(n)\), \(n<n_{s}\) convolves with filter \(h_{A}(n)\) only. Any input \(x(n)\), \(n\geq n_{s}\) convolves with filter \(h_{B}(n)\) only.  
Figure 3: Demonstration of dynamic filter replacement. **Top**: The output from convolving the input \(x(n)\) with impulse response \(h_{A}(n)\) before \(n_{s}=1\) s **Middle**: The output from convolving the input \(x(n)\) with impulse response \(h_{B}(n)\) after \(n_{s}=1\) s **Bottom**: the output from convolving the input \(x(n)\) with \(h_{A}(n)\) and its stepwise with \(h_{B}(n)\) starting at \(n_{s}=1\) s The vertical lines mark the time indices \(n_{s}\), \(n_{s}+N/3\), \(n_{s}+2N/3\), and \(n_{s}+N\) in the transition region.  
Figure 2: Demonstration of dynamic filter replacement: **Top**: The two filter impulse responses \(h_{A}(n)\) and \(h_{B}(n)\). **Bottom**: The input signal \(x(n)\).