Band-Limited Impulse Train Generation Using Sampled Infinite

Oct 15, 2012 - a digital substitute for analog voltage controlled oscillators [1], [2]. .... Dirac impulses (when D = 0) must be taken into account if ..... filter mode.
863KB taille 3 téléchargements 188 vues
1

Band-Limited Impulse Train Generation Using Sampled Infinite Impulse Responses of Analog Filters St´ephan Tassart

Abstract The oscillator or waveform generator is at the heart of the musical sound synthesizers technology. A digital oscillator is the discrete time counterpart of the analog voltage control oscillator. A band-limited oscillator (BLO) is a digital oscillator that explicitly limits the power of the aliasing artifacts. It aims at reproducing on a Digital Signal Processor (DSP) the popular waveforms such as pulse-width modulated (PWM) square, sawtooth or triangle waveforms. The generation of a band-limited impulse train (BLIT) is central to most BLO algorithms. Most BLIT algorithms are based on finite impulse response (FIR) filters. The paper presents an innovative scheme for constructing a BLIT based on infinite impulse response (IIR) filters which have better stopband rejection performances. The BLIT is actualy obtained by emulating the sampling at an arbitrary sampling rate of an impulse train filtered by an analog IIR filter. The method is flexible because, at the end, it relies on the classical design of an analog low-pass filter. Furthermore the complexity of the method is not impacted by the length of the impulse response. Finally, as for most BLIT based methods, the power of the aliasing artifacts is reduced even in case of frequency or pulse width modulation in the audio range.

Index Terms Acoustic signal processing, anti-aliasing, audio oscillators, music, signal synthesis. Manuscript received Nov 9, 2011; revised April 16, 2012. Copyright (c) 2010 IEEE. Personal use of this material is permitted. However, permission to use this material for any other purposes must be obtained from the IEEE by sending a request to [email protected]. The author is with STMicroelectronics, 29 bd Romain Rolland, 75669 Paris, France., e-mail: [email protected].

October 15, 2012

DRAFT

2

I. I NTRODUCTION The oscillator is the primary sound source of a musical sound synthesizer and requires further processing (mixing, filtering, modulation, echo etc.) before becoming musically exploitable. The modular structure of the synthesizer system allows the system designer to focus separately on each different element. In the 90ies, the warm sounds from old vintage analog synthesizers started to become more appreciated than the cold but precise sounds from digital synthesizers. But vintage synthesizers are old, fragile, very expensive and untrustworthy materials hardly controllable by a computer musical workstation. Starting from that time, many different algorithms for band-limited oscillators (BLO) were proposed as a digital substitute for analog voltage controlled oscillators [1], [2]. Aliasing artifacts need to be rejected directly from the oscillator because, once created, they are hardly concealed by additional processings. The most straightforward BLO relies on the additive synthesis [3]. Based on the Fourier harmonic decomposition of a periodic waveform, the system adds synchronized sine waveforms at frequencies corresponding to the harmonic multiples from the pitch. At all time, the system knows which harmonic sine waveform is aliased and generates only non-aliased harmonic waveforms. This basic method is effective but not very computing efficient since it requires many sine waveform generators. The generation of synchronized harmonic waveforms can be improved with Chebyshev polynomials that shape an original sine wave exactly up to the necessary harmonic partial and with the appropriate partial gains [4]. Another improvement was proposed independently in [5] and by Moorer in [6], with the exploitation of a well known polynomial identity, the discrete summation formula (DSF) that replaces the sum of N sine waves by the sum of two sine waves and one division. The method based on the DSF suffers from numerical difficulties due to the presence of a division in the formula: the division is a complicated digital signal processing (DSP) operation and requires additional processing in order to overcome the difficulty that arises when both numerator and denominator become simultaneously close to zero. Furthermore only linear phase implementation (i.e. symmetrical waveforms) are possible with this technique. The feedback delay loop method presented in [7] is an alternate method that generates a slightly inharmonic but alias-free signal. Curiously, additive based methods (including DSF methods) and feedback delay loop methods are usually given ideal and alias-free [1], but are actually not robust against aliasing artifacts in the case of pitch modulation at audio rate. Stilson in [8] observes that the generation of a band-limited impulse train (BLIT) is central to the

October 15, 2012

DRAFT

3

BLO: most popular analog waveforms derive from a BLIT through leaky integration, e.g. a pulse-width modulated (PWM) waveform derives from an integrated bipolar BLIT etc. To the contrary to additive based methods, BLIT based methods support modulation of the pitch or the PWM in the audio range at a constant aliasing level. The temporal BLIT generation consists in the generation of a band-limited impulse triggered at a random time chosen in the temporal continuum. The finite impulse response (FIR) case has been thoroughly examined in the literature [1]. In the original approach, the generation of this randomly shifted band-limited impulse exploits the polyphase structure of a FIR low-pass filter as in methods related to sample rate conversion (SRC) and wavetable technology. For instance, the waveform of the oversampled bandlimited impulse is precomputed and stored in a permanent memory of the system. In this context, fractional shifting the band-limited impulse is equivalent to de-interleaving the oversampled waveform. As for variable rate resampling problems, oversampling the waveform may not be sufficient for covering every possible shift value and achieving a proper aliasing artifact rejection. The joint usage of polynomial interpolation and oversampling is a well-known SRC technique [9] that trades memory constraints to an additional computational complexity. Similar approaches have been proposed for the BLIT generation in [10]. Nam [11] proposes instead to generate the shifted band-limited impulse as the truncated impulse response of a all-pass fractional delay. Traditionally, the aliasing reduction performances of the FIR-BLIT methods are limited by the length of the polyphase components. Indeed, a polyphase component with a long duration increases the rate of overlaps between the different instances of fractionaly shifted band-limited impulses [11]. As a consequence, for a given complexity, the roll-off of the filter is limited. FIR-BLIT generation in the oversampled domain and phase modulation techniques, BLIT generation with polynomial expression prototype and emphasis/de-emphasis [12], [13] are recent contributions to overcome this problem. Still most of those improvements have a cost. The method based on differentiated polynomial waveforms [12], [13] boosts the signal with gains greater than 150 dB at high frequency and requires additional processing in order to control the growth of the SNR at high frequency. The complexity of methods based on oversampling in [13] grows linearly with the oversampling rate. The wavetable method from [1] requires a significant amount of memory for the storage of the oversampled waveform and possibly a specific architectural hardware design in order to support high voice polyphony. This paper considers the generation of a band-limited train of impulses (BLIT) as the sampled response of an analog infinite impulse response (IIR) filter to a train of impulses. The impulse is generated by October 15, 2012

DRAFT

4

manipulation of the state of the discrete equivalent filter rather than by the overlap-add of a shifted bandlimited impulse. As a consequence, the complexity of the method is not related directly to the effective length of the anti-aliasing filter. Aliasing artifacts reduction is improved by designing the anti-aliasing filter as an infinite impulse response (IIR) analog filter instead. Section II reminds the expressions from the zero-order discrete equivalent and describes a mean for evaluating the response of the filter when driven by a mixture of zero-order process and an arbitrary train of impulses. Various improvements of the algorithm e.g. for controlling the pitch or generating alternate band-limited waveforms are discussed in this section. As for other BLIT derived methods, pitch, frequency or PWM modulation is possible in the audio range at a constant low aliasing level. Section III proposes a numerical implementation of IIR-BLIT. The respective complexity of FIR-BLIT and IIR-BLIT are compared in Section IV. II. S YSTEM RESPONSE TO AN IMPULSE TRAIN A. Zero-order hold discrete equivalent Consider an analog, linear and time invariant system H . The dynamic of the system is described within the state space formulation (see [14]) as:    x(t) ˙ =

Ax(t) + Bu(t)

  s(t) =

Cx(t) + Du(t)

(1)

where u(t) (resp. s(t)) is a time function that represents the input (resp. output) of the system and x(t) is a N × 1-vector time function that represents the internal state of the system. The matrices A, B , C and D are constant real matrices of size compatible with u(t), s(t) and x(t). Given a reference time t0 where the state x(t0 ) is known, the state evolution for the system is (cf. [15]): A(t−t0 )

x(t) = e

Z t

x(t0 ) +

eA(t−τ ) Bu(τ ) dτ.

(2)

t0

The discrete signals un , sn and xn are obtained as the sampling of their analog counterpart at time t = nTs : xn = x(nTs ), un = u(nTs ), sn = s(nTs ).

October 15, 2012

DRAFT

5

Assume now that the input signal u(t) is the result of a zero-order hold process at a sampling period Ts , i.e.: ∀t ∈ [nTs , (n + 1)Ts ),

u(t) = un .

In that case, the sampled state xn+1 and the sampled output sn are both a linear combination from the sampled input un and the past sampled state xn . This discrete model is known as the zero-order hold discrete equivalent state space model [15] and its state space discrete equations are given by:    xn+1  

with

      

= Φxn

+ Γun

(3)

sn = Cxn + Dun Φ = eATs

I + ATs Ψ = Φ      

(4)

Γ = Ts ΨB.

B. Response to a mixture signal The previous section considered the case of a system H driven by a zero-order hold process. Consider now that the system H is driven by a mixture of a zero-order hold process u(t) and a train of Dirac impulses. From Eq. (2), it appears that the convolution kernel exp(At) regularizes the Dirac impulse into -at worst- a discontinuity. When driven by a mixture of a zero-hold process and a train of Dirac impulses, one observes at the output from the system H a mixture of a discontinuous signal, s(t), and a train of impulses, see Fig. 1. When D = 0, only remains the discontinuous signal. For the rest of this section, we shall track separately the action of H on a discontinuous signal and on a Dirac impulse. In particular, any Dirac impulse (at the input or at the output of the system) will be characterized by its amplitude β and its time of arrival. Considering a sampling period Ts , a time of arrival is represented by nTs + ∆T , where 0 ≤ ∆T < Ts , i.e. a fractional time between the sampling date n and n + 1 exclusive. Note that the zero-order hold operation does not apply to the train of impulse. Consider at time nTs + ∆T the arrival of a Dirac impulse. Assume that prior this time the system H is at rest. The state evolution of the discrete equivalent system is still driven by Eq. (3) for k > n:

it corresponds to the free response of the system. For k ≤ n, the state is xk = 0: it corresponds to the rest period of the system. One only needs to determine xn+1 in order to complete the description of the system response. October 15, 2012

DRAFT

6

un

u(t) ZOH

s(t)

sn

H(s) Ts

P k

Fig. 1.

βk δ(t − tk )

H(s)



P k

βk δ(t − tk )

System response model to a mixture signal

The value of xn+1 is obtained with the help of Eq. (2): Z (n+1)Ts

xn+1 =

eA((n+1)Ts −τ ) Bδ(τ − (nTs + ∆T )) dτ

nTs

= eA(Ts −∆T ) B = Φ × e−A∆T B.

Given the common factor Φ in this equation and in the discrete state update equation (3), it will be more convenient to update xn (the current state) rather than xn+1 (the future state). The superposition principle that governs linear systems allows the following statement: Algorithm 1 (Discrete Equivalent Response). The response of a linear time invariant system H to a mixture of a zero-order hold process u(t) and a train of scaled Dirac impulses is a mixture of a discontinuous signal s(t) and a train of scaled Dirac impulses (see Fig. 1). The sampled output, sn = s(nTs ), is obtained by the following algorithm:

1) use the observation equation in order to generate the current output: sn = Cx + Dun

(5)

2) for each Dirac impulse, with a scaling factor β that happens during the time interval [nTs , (n + 1)Ts ), at time nTs + ∆T , update the current state x as follows: x ← x + βe−A∆T B

(6)

3) update the state x as the action of the current input on the system as: x ← Φx + Γun

(7)

where Φ and Γ describes respectively the state and the observation matrix from the discrete zeroorder hold equivalent state space model from H , see Eq. (4). When D 6= 0, the train of Dirac impulses is reproduced at the output with the scaling factor D.

October 15, 2012

DRAFT

7

When multiple Dirac events happen during the same time interval [nTs , (n + 1)Ts ), Eq. (6) shall be used repeatitively before the state is updated with Eq. (7). The given algorithm emulates the filtering by H , a IIR analog filter, of a mixture of a zero-order hold process and impulse events. The transmitted Dirac impulses (when D 6= 0) must be taken into account if other IIR filters follow the system H . In such case, this algorithm must be repeated for the subsequent filters. C. Band-limited impulse train 1) Basic algorithm: The generation of a discrete band-limited impulse train (BLIT) results from a specialization from the Algorithm 1 where the driving signal is a periodic train of impulse, of period T , and the system H is designed as a low-pass filter with a stop-band starting at the Nyquist frequency. A demonstration source code is given in Appendix B. Algorithm 2 (BLIT generation). Consider a train of Dirac impulses of period T . Define the state transition matrix Φ(t) = exp(At). The following algorithm evaluates the response of the analog system H to the train of Dirac impulse, sampled at a period Ts . For each sample date nTs , repeat:

while τ < Ts

do

   x

← x + βΦ(−τ )B

  τ

← τ +T

x ← Φx,

(8)

(9)

n ← n + 1,

(10)

τ ← τ − Ts ,

(11)

sn = s(nTs ) ← Cx.

(12)

The complexity of the state update equation Eq. (8) is linear with the pitch frequency 1/T but is independant from the sampling rate of the audio stream. Indeed, the generation of a simple monopolar BLIT with a pitch of 1 kHz requires the trigger of Eq. (8) once every millisecond whatever the sampling rate may be. The sampling rate has a linear impact on the complexity of the rest of the filter implementation, i.e. Eqs.(9)-(12). The actual implementation of Eq. (8) requires a test operator that may break the pipeline flow on a modern processor architecture. Therefore, this algorithm may use more efficiently a processing core when oversampled (see also section II-E). The complexity of the algorithm is, in a first approach, quadratic in the size N of the state matrix, A (if the evaluation of the expression Φ(−τ )B does not exhibit a special structure). However, when the October 15, 2012

DRAFT

8

order of the filter is greater than 2, it may be advantageous to implement the filter H either as a chain or a parallel cascade of first and second order cells in order to return to a complexity linear in N . At this step, the complexity of the algorithm is not related to the effective length of the impulse response of the filter. This algorithm is not constrained to generate a periodic monopolar BLIT. For instance, a bipolar BLIT can be obtained by alternating the sign of β in Eq. (8). The duty cycle of a PWM waveform can be introduced by alternating two periods wT and (1 − w)T in Eq. (8). However, the complexity of the algorithm is impacted because Eq. (8) is trigged twice as often in the bipolar case than in the monopolar case. 2) Varying pitch frequency: In order to vary the pitch of the oscillator, the period T of the impulse train must vary. A naive solution consists in updating the value of T with the inverse of the requested pitch f (nTs ) when Eq. (8) is trigged. This section recalls the method generally preferred in BLIT-based methods in order to modulate the period T . When driven by a varying pitch frequency, the oscillator must track the running phase φ(t) in the waveform cycle [2]. Instantaneous frequency f (t) and phase φ(t) are related by the following relationship: Z t

f (τ ) dτ.

φ(t) = φ(t0 ) +

(13)

t0

For a monopolar BLIT, the trigger time tk for each impulse is obtained by modulo comparison with a reference phase φ0 : ∀k ∈ Z,

φ(tk ) = φ0 + 2kπ.

More generaly, for a multipolar BLIT, the trigger time tk for each impulse is obtained by modulo comparison with a sorted list of reference phases (φm )m∈[0,M −1] : ∀k ∈ Z,

∀m ∈ [0, M − 1],

φ(tm+kM ) = φm + 2kπ.

(14)

Once the trigger times are determined, the period T from Eq. (8) is evaluated as the difference between successive trigger times: ∀k ∈ Z,

Tk = tk − tk−1 .

(15)

Consider for instance the generation of a bipolar BLIT driven by an exponential swept frequency: f (t) = f0 exp(at). The evaluation of Tk , with the help of Eqs.(13), (14) and (15), leads to: 1 k + k0 log a k + k0 − w   1 k + k0 − w + 1 = log a k + k0 



T2k = T2k+1 October 15, 2012

(16)

DRAFT

9

Frequency (Hz)

20000

15000

10000

5000

0 0

0.1

0.2

0.3 0.4 Time (s)

0.5

0.6

Fig. 2. Spectrogram of a bipolar exponential swept BLIT (w = 0.314) obtained from H8 (s), an analog elliptic low-pass filter, 8th order,  = −90 dB and νc = 2.4/ (2Ts π), see Table II.

where w ∈ [0, 1) is the pulse-width modulation (PWM). The spectrogram of this signal is displayed in Fig. 2. Despite the very fast frequency change, the aliased components are kept at a constant low level. Aliased components can not appear in the discrete domain because the impulse generation and the anti-alias filter happens enterily in the analog domain. Note that when the requested pitch is higher than the Nyquist frequency, every harmonic component is low-pass filtered by the anti-alias filter and the output samples are now close to zero (of course, a specific logic could detect such high pitch and replace the output samples by true zeros). For a band-limited oscillator operating in real time, Eq. (13) must be approximated in the range [nTs , (n + 1)Ts ) with any available information. For instance, one can assume that the instantaneous

frequency f (t) is a zero-order hold process and φ(t) piecewise linear. The choice of the evolution model may modify the accuracy of the modulation but can not create unfiltered aliased components. The algorithm 2 allows pulse-width modulation, frequency modulation and phase modulation even in the audio range without aliased component creation. 3) Choice of H(s): As indicated in the previous section, the system H must be designed as a low-pass filter with a stop-band starting at the Nyquist frequency in order to reject the aliased components: ∀ν >

1 , 2Ts

|H(jν)| < .

For instance, the generation of a BLIT with a flat spectrum can be obtained with an analog filter H(s) designed with the following prototype: ∀ν ∈ [0, ν1 ],

October 15, 2012

1 − δ ≤ |H(jν)| ≤ 1 + δ.

DRAFT

10

magnitude spectrum from a pulse train 20

pulse train filter folded branches of the filter

magnitude (dB)

0

-20

-40

-60

-80 0

0.5

1 1.5 2 angular frequency (rad/sample)

2.5

3

Fig. 3. Amplitude spectrum of a train of impulse filtered by H4 (s), a 4th order analog elliptic low-pass filter with a stop-band  = −45 dB and a cutting frequency νc = 2.8/ (2Ts π), see Table II.

magnitude spectrum from a pulse train 20

pulse train filter folded branch of the filter

magnitude (dB)

0

-20

-40

-60

-80 0

Fig. 4.

0.5

1 1.5 2 angular frequency (rad/sample)

2.5

3

Amplitude spectrum of a train of impulse filtered by H8 (s), see Table II.

Any methods for designing the analog low-pass filter are suitable: Butterworth, Chebyshev, inverse Chebyshev, elliptic, Bessel filter, etc. Figures 3 and 4 illustrate different choices for H . On Figure 3, the anti-aliasing filter is chosen with poor performances: the stop-band is set to  = −45 dB and the order is set to 4. As seen in Figure 3, the spectral gain of H folds back on the aliased domain with a significant gain. As expected, the spectral envelop from the aliased components follows the spectral gain of H , even when folded. The aliased components are clearly visible with a gain greater than -40 dB for ω > 2 rad/sample. On Figure 4, the anti-aliasing filter has been designed with a rejection gain set to  = −90 dB. The spectral gain of H folds back in the aliased domain with a small gain and is almost not visible on the

October 15, 2012

DRAFT

11

figure. Only one aliased component from the BLIT is partially visible at ω = 3.1 rad/sample. The temporal shape of the impulses is preserved if the gain of H is flat and the phase is linear in the band. Minimal phase in the band can also be an interesting feature for H (i.e. a feature more in line with electronic constrains that appear in vintage analog circuitery). Other bandlimited waveforms are possible by varying the filter H(s). For instance, a bandlimited square waveform is obtained by integration of a bipolar BLIT. A bandlimited sawtooth or triangle waveform is obtained through a double integration [8] (see Fig. 5). The integration operation is a filtering process, essentially at -6 dB/octave, that may happen either in the analog domain, through H(s), or in the discrete domain with a post-processing filter G(z) (see Fig. 1). Due to its low-pass nature, it is attractive to include the integrator in the analog domain in order to reduce the absolute power from the aliasing components. Observe, as in [8], that analog or discrete integrators used for the generation of bandlimited waveforms must be conservatively leaky in prevention from a possible DC component in the BLIT generation. D. Emphasis and post-processing The filters H(s) and G(z), respectively the analog and the discrete post-processing filter, can be used as an emphasis/de-emphasis pair. For instance, the analog filter H(s) can include additional integrators (each corresponding to a slope of -6 dB/octave) compensated in the discrete domain, in G(z), by derivators (each of them contributing to +6 dB/octave). As observed in [12], [13], de-emphasis (in the analog domain) applies to both in-band and aliasing components whereas emphasis (in the discrete domain) applies only to in-band components (see Fig. 5) therefore improving significantly the rejection of the aliased components. Note that de-emphasis has no effect on the background computational noise whereas it is amplified by the emphasis stage. As a result, the power of the internal round-off errors grows in a proportion inverse to the aliasing rejection obtained from the emphasis/de-emphasis pair. E. Oversampling Oversampled processing is a general and popular mean for generating band-limited discrete signals. Two processing steps are necessary: 1) generate the signal in the oversampled domain, 2) downsample the oversampled signal at the audio rate. In the context of Eq. (8), Step 1 impacts only the complexity of the free response generation. The complexity due to the oversampling increases linearly with the growth of the oversampling rate. The October 15, 2012

DRAFT

12

bandlimited train waveforms 0.8

BLIT sawtooth

amplitude (linear)

0.6 0.4 0.2 0 -0.2 -0.4 -0.6 1050

1100

1150 time (sample)

1200

1250

magnitude spectrum from a sawtooth waveform 0

sawtooth filter folded branch of the filter

-20

magnitude (dB)

-40 -60 -80 -100 -120 -140 -160 -180 0

Fig. 5.

0.5

1 1.5 2 2.5 angular frequency (rad/sample)

3

Waveform (top) and amplitude spectrum (bottom) of a bipolar BLIT obtained from H8 (s), see Table II, then filtered

in the discrete domain by Hi (z), a leaky -12 dB/octave integrator, see Table III, in order to obtain a bandlimited sawtooth waveform.

complexity of the state update is unmodified because the triggering time from Eq. (8) is invariant in the analog domain. The complexity of the state update can even be reduced when operating in the oversampling domain because the need for a steep low-pass filter is relaxed and therefore one can achieve the same aliasing rejection with a lower filter order. Furthermore, in the oversampled domain, the duration of the computation period without a test instruction is longer; therefore the pipeline is less frequently broken and the actual signal processing is more efficient. Step 2 requires the processing of a downsampling filter which complexity is moderate. The procedure for downsampling an oversampled signal is well documented in the literature [13]. Figure 6 illustrates the generation of the train of impulse, first in the oversampling ×2 domain, then at the final rate.

October 15, 2012

DRAFT

13

magnitude spectrum from a downsampled pulse train 20

pulse train filter folded branch of the filter

magnitude (dB)

0

-20

-40

-60

-80 0

1

2 3 4 angular frequency (rad/sample)

5

6

magnitude spectrum from an oversampled pulse train 20

pulse train filter folded branch of the filter

magnitude (dB)

0

-20

-40

-60

-80 0

Fig. 6.

0.5

1 1.5 2 angular frequency (rad/sample)

2.5

3

Amplitude spectrum of a train of impulse filtered by Ho (s), a 4th order analog elliptic filter, see Table II, first in the

oversampled ×2 (top) domain then downsampled in the natural domain (bottom) with the help of B70 (z), see Table III.

III. N UMERICAL IMPLEMENTATION A. Computing the state transition vector Φ(t)B When the impulse response of the system H(s) is available in closed form or is tabulated, an effective possibility exists in order to evaluate the state transition vector Φ(t)B . First, let define the function h(t) as the extension of the impulse response to negative time. For the purpose of this definition, the contribution from the Dirac distribution is not included in the extended impulse response. Consider the N × N observability matrix O and the N × 1 impulse response vector,

October 15, 2012

DRAFT

14

h(t), that stacks successive versions of h(t): 

∀t,

       h(t) =        





h(t) h(t + Ts ) h(t + 2Ts )

.. .

       ,       

h(t + (N − 1)Ts )

C



       CΦ        2 . O= CΦ      ..    .      

CΦN −1

The size N of the vector h(t) is related to the order of the filter H and is not related to the effective length of the impulse response. The discrete equivalent system is observable iff the rank of the observability matrix is N [14]. Theorem 1 (State Transition Vector). If the zero-order hold discrete equivalent system is observable, then the state transition vector Φ(t)B is available as: Φ(t)B = O−1 h(t).

∀t,

Proof: Assume first that D = 0. The extended impulse response h(t) of the system is given by: ∀t,

Z t

h(t) = C

eA(t−τ ) Bδ(τ ) dτ = CeAt B.

(17)

0

This extended impulse response extrapolates the impulse response for negative time. The delayed impulse response h(t + kTs ) is obtained as: h(t + kTs ) = CeA(t+kTs ) B = CΦk Φ(t)B.

∀t, ∀k,

One may stack those equations for k ∈ [0, N ): 

∀t,

              



h(t) h(t + Ts ) h(t + 2Ts )

.. . h(t + (N − 1)Ts )





C             CΦ           2  =  CΦ   Φ(t)B         . ..             N −1  CΦ

which is to say that: ∀t,

October 15, 2012

h(t) = OΦ(t)B.

DRAFT

15

The zero-order hold discrete equivalent system is observable therefore the observability matrix is invertible. We conclude the proof by left-multiplying both sides of the later expression by O−1 . In the case D 6= 0, Eq. (17) still holds because, by definition, Dirac contributions are not included in h(t). The proof is therefore unchanged.

This theorem allows the rewording of Algorithm 2 in simpler terms, provided that the system H is observable. Since H is obtained by design, the observability can usually be granted. Algorithm 3 (IIR-BLIT). Consider a train of Dirac impulses of period T . Define the extended impulse response h(t) and its stacked and shifted version h(t). The following algorithm evaluates the response of the analog system H to the train of Dirac impulse, sampled at a period Ts . For each sample date nTs , repeat:

while τ < Ts

do

   x

← x + βO−1 h(−τ )

  τ

← τ +T

(18)

x ← Φx + un

(19)

n←n+1

(20)

τ ← τ − Ts

(21)

sn = s(nTs ) ← Cx.

(22)

The input signal un can be used in order to chain several filters. Otherwise, it must be set to 0. The complexity from Eq. (18) is comparable to the complexity from Eq. (8). However, Eq. (18) is convenient to implement because the matrix O−1 can be evaluated offline and the extended impulse response h(t), as a scalar function, is easier to tabulate than the transition matrix Φ(t). The impulse response vector h is needed for negative time that corresponds to an explicit extrapolation from the impulse response. Those values can be evaluated from Eq. (17). B. State update interpretation Theorem 2 (Impulse Response Equivalent). For a given τ , set the initial state vector of the discrete equivalent system from Eq. (3) to: x0 = Φ(τ )B.

The following assertions hold: •

for positive time, the response, sn , of the discrete system is: sn = h(nTs + τ ),

October 15, 2012

DRAFT

16

βh(0)

β t0

s1 = βh(Ts − ∆T ) s0 = βh(−∆T )

nTs

nTs + ∆T

(n + 1)Ts

∆T

Fig. 7.



State modification for a second-order system.

for negative time, the extrapolated response of the system is: s−n = h(−nTs + τ ) Proof for the impulse response equivalent: The evaluation of the response, sn , of the system requires

the knowledge of the state vector xn . The response sn is obtained as the transiant response of the system given the initial state x0 . Therefore, in Eq. (3), the discrete system is free from any input, i.e. un = 0. For positive time, the state vector is obtained as: ∀n ≥ 0,

xn = Φn x0 = Φn Φ(τ )B = Φ(nTs + τ )B.

For negative time, the state vector can be extrapolated as follows: ∀n > 0,

x−n = Φ−n x0 = Φ(−nTs + τ )B.

At all time, the observation sk is obtained from the state vector by Eq. (3): ∀n,

sn = CΦ(nTs + τ )B.

One recognizes in the later expression the definition of the extended analog impulse response h(t) from Eq. (17). Therefore, the response of the discrete system, extrapolated or not, is: ∀n,

October 15, 2012

sn = h(nTs + τ ).

DRAFT

17

Figure 7 illustrates how the IIR-BLIT algorithm applies in the case of a second order system. Assume that the system H was at rest prior the arrival of the scaled impulse at t0 = nTs + ∆T . For t > t0 , the response of the system is the scaled impulse response βh(t − t0 ). The ground idea of IIR-BLIT is to modify the state x of the discrete equivalent system so that its response sk matches the sampled response βh(kTs − ∆T ) for k > 0. Theorem 2 states that this state exists and can be obtained by matching the

extrapolated impulse response; in particular we can match sk = βh(kTs − ∆T ) for k ∈ {0, 1}. Now, the procedure from Eq. (18) can be interpreted as follows. For a scaled impulse arriving at t0 = nTs + ∆T , draw the impulse response βh(t − t0 ) of the system for t > t0 and the extrapolated impulse response for t < t0 . Form the vector βh(−∆T ) with the values s0 = βh(−∆T ) and s1 = βh(Ts − ∆T ). In the case

of a second order system, s0 and s1 are easy to evaluate because the impulse reponse is a damped sine wave. Apply finally the matrix O−1 in order to convert the vector (s0 , s1 )> = βh(−∆T ) into the state x0 . When the system H is not at rest for t < t0 , by virtue of the superposition principle, the calculated

state x0 is simply added to the current state of the system. The practical principle exposed in Fig. 7 can be applied for every linear system that can be decomposed as the sum of first or second order filter cells (i.e. a proper system with exclusively simple poles, i.e. poles with a multiplicity equals to one). In this case, the response of the system to a train of impulses is the superposition of several damped sine waves, each of them corresponding to the natural decay of a filter mode. The IIR-BLIT algorithm can therefore be interpreted as a damped sine waves generator and the principle from Fig. 7 as a mean to update the parameters of the damped sine waves when an impulse occurs. IV. C OMPARISON WITH FIR BLIT As highlighted in Section I, the aliasing rejection performances of a BLIT based algorithm are directly related to the performances of the underlying analog low-pass filter, whether it is a FIR or a IIR filter. Therefore, comparing Algorithm 3 vs. a FIR-BLIT method requires first to design a FIR analog low-pass filter with comparable performances. The basic operations (additions, multiplications) involved in both methods are counted, except for shared tasks (e.g. logic involved in counter looping or fractional index determination). We assume here that IIR-BLIT is obtained as a parallel cascade of conjugated or single pole cells. This structure corresponds to the modal decomposition of the system and has the advantage that, in the context of BLIT generation, the input signal un for every cell can be set to 0, saving therefore October 15, 2012

DRAFT

18

TABLE I R ELATIVE COMPLEXITY OF BLIT OPERATIONS

IIR-BLIT

per impulse

per sample

first order system

5

1

second order system

20

3

FIR-BLIT

per impulse

per sample

FIR-qM (quad. interp.)

11q

0

leaky integrator

0

2

unnecessary filtering operations. The extended impulse response h(t) for a biquadratic cell is a damped sine wave, see Fig. 7; its evaluation requires 5 basic operations, a scaling factor and 4 lookup tables storing respectively an exponential decay and a sine wave on 129 points (using linear interpolation and the precomputed differences tab[k+1] - tab[k]). When an impulse occurs, the multiplication by the matrix O−1 requires 6 new operations and the final state update needs 2 more operations. In the case of a single pole cell, the evaluation of the extended impulse response h(t) requires 2 basic operations, and a scaling factor. The rest of the state update requires 2 additional operations. The storage of O−1 , Φ and C requires 10 parameters for a biquadratic cell (resp. 3 parameters for a single pole cell). The

generation of one sample requires additional processing: 3 basic operations per sample for a biquadratic cell implemented in a Direct Form I (resp. 1 basic operation for a single pole filter), because the input signal un is 0 and the scaling factor is already integrated in the filter state. Polynomial interpolation between polyphase FIR components is a mean to reduce the size of the stored wavetables for FIR-BLIT generation [10], [16]. The oversampling rate M of the wavetable must be limited to 30 to 40 in order to produce storage constraints comparable with those from the IIR-BLIT. For this range of oversampling rate, a second-order interpolation must be considered in order to achieve an aliasing rejection performance of -90 dB [9]. Quadratic interpolation requires at least 9 operations (e.g. in the case of the Lagrange interpolation [17]). For each impulse, the FIR-BLIT generator must overlap-add the interpolated waveform, which implies 9q operations, where q is the size of the polyphase component, plus the scaling and the overlap operations. Table I summarizes the complexity of the different operations, respectively for IIR-BLIT and FIR-BLIT algorithms. The low-pass filter template used for this comparison consists in a pass-band extending up to 0.8Ts /2,

October 15, 2012

DRAFT

19

Magnitude of the transfer function of the analog band-limited impulse constrained L2 FIR design elliptic IIR design

0

magnitude (dB)

-50

-100

-150

-200 0

Fig. 8.

1

2 3 4 5 6 7 Frequency (multiple of the Nyquist frequency)

8

Transfer function for the underlying low-pass filters H9 (s) and B30 (z) (see Table II and III), resp. for IIR-BLIT and

FIR-BLIT.

with ripples in the band oscillating in ±0.5 dB and a stop-band at -90 dB starting at Ts /2, the Nyquist frequency. The elliptic filter H9 (s), with 4 conjugated poles and one single real pole, see Table II, fulfills the constraints (see Fig. 8). The discrete-time FIR filter can be designed with the Remez method or a constrained L2 approach [18]. The size of the polyphase components must be at least set to q = 30 in order to fulfill the constraints (see Fig. 8 and Table III). Table I demonstrates that the IIR-BLIT approach have an efficient impulse generation mechanism compared to the FIR-BLIT approach, at the cost of a constant filtering processing, nonexistent in the later approach. Therefore, the IIR-BLIT approach can become competitive for high pitch and multipolar BLIT. In the example presented here, the pitch threshold is about 1300 Hz for a bipolar BLIT oscillator at a sampling rate of 48 kHz (see Fig. 9). Some additional optimizations can be considered for IIR-BLIT. First, it is not necessary to continue processing the filtering equations when the cell impulse response becomes low [11]. For instance, in the case of H9 (s), the effective length (in samples and evaluated at -90 dB) of each pole is respectively 21, 24, 36, 66 and 193. In addition, leaky integration (a single pole cell) is more efficiently performed in the analog domain for IIR-BLIT than in the discrete-time domain for FIR-BLIT. As a result, IIR-BLIT becomes at least comparable to FIR-BLIT for sawtooth waveform generation, see Fig. 10. V. C ONCLUSION Since the seminal paper from Stilson and Smith [8], BLIT has become a well-established method that implements the BLO. Most BLIT algorithms use an underlying FIR analog low-pass filter prototype: the

October 15, 2012

DRAFT

20

IIR-BLIT complexity vs. FIR-BLIT w = 0.05 w = 0.1 w = 0.2 w = 0.3 w = 0.4 w = 0.5

3

complexity ratio

2.5 2 1.5 1 0.5 100

1000 frequency (Hz)

10000

Fig. 9. Relative complexity of IIR-BLIT operations compared to FIR-BLIT, for a single bipolar BLIT tuned at a given frequency f , and a given PWM w, with the complexity weights from Table I.

IIR-BLIT complexity vs. FIR-BLIT with leaky double integrator 1.4

w = 0.05 w = 0.1 w = 0.2 w = 0.3 w = 0.4 w = 0.5

complexity ratio

1.2

1

0.8

0.6

0.4 100

Fig. 10.

1000 frequency (Hz)

10000

Relative complexity of IIR-BLIT operations compared to FIR-BLIT, for a sawtooth waveform generation implying a

single bipolar BLIT tuned at a given frequency f , and a given PWM w, and a leaky double integrator L2 (s) (see Table II).

generation of the individual band-limited impulses is obtained by overlapping a sampled version of the impulse response. In this paper, we propose an alternate formulation of BLIT using a IIR filter instead. The actual signal generation is obtained as the natural decay of the filter modes. Individual bandlimited impulses are processed in the state space domain by modification of the filter register memories. In many pratical cases, the underlying IIR filter can be decomposed as a sum of first or second order cells and the IIR-BLIT algorithm can be interpreted as a damped sine wave generator that updates offset and amplitude parameters when an impulse occurs. Many benefits and improvements available for FIR-BLIT are also available for IIR-BLIT: multipolar BLIT generation, arbitrary period, frequency, phase or PWM modulation, power level of aliased

October 15, 2012

DRAFT

21

components kept low and constant, even in case of modulation in the audio range, and emphasis/deemphasis mechanism available for further rejection of high frequency aliased components. In addition, the design of a minimal phase BLIT is natural with IIR-BLIT. It seems to be an interesting feature because it is more in line with electronic constrains from vintage analog circuitery. The complexity of IIR-BLIT is mostly related with the order of the low-pass filter rather than its effective length. As IIR filters have usually better stopband performances than their FIR conterparts, the aliasing rejection performances of IIR-BLIT is expected to be improved. This paper demonstrates that the IIR-BLIT approach has an efficient impulse generation mechanism compared to FIR-BLIT but requires an almost constant filtering activity instead. A preliminary complexity study tends to indicate that, for equivalent memory constraints and high aliasing rejection performances, IIR-BLIT performs better than FIR-BLIT for high pitched sounds, for multi-polar BLIT and for doubly integrated signals (e.g. a sawtooth waveform). For instance the IIR-BLIT method is expected to become really interesting when slightly detuned oscillators are needed simultaneously as for the super-saw waveform originally from the Roland JP-8000 synthesizer. In that case, only the logic for the impulse generation needs to be duplicated for each oscillator; the remaining filtering operations are shared for every oscillator and need to be processed only once per sample. A PPENDIX A N UMERICAL VALUES OF THE FILTERS The filters demonstrated in this paper were designed with functions from the Signal toolbox v1.0.8 (available in Octave-Forge R2008-08-24). In particular, the analog filters, H9 (s), H8 (s), H4 (s) and Ho (s) (see Table II and Figs. 2-8) are elliptic low-pass filters designed with the function ellip(). For the purpose of the design of the analog filters, the sampling rate Ts was arbitrary set to 1. The analog leaky integrator L(s) is a filter with a single real pole located at -1/26. Half-rate decimation is obtained with a 70-tap FIR filter B70 (z) obtained from decimate(), see Table III. The leaky double integrator Hi (z) is designed as a second order Butterworth discrete-time filter, see again Table III. The low-pass filter B30 (z) is designed with the cl2lp() function from [18] implementing a constrained least square design

of FIR filters1 . 1

The actual order of the filter Bq (z) is M q − 1, with q, the length of the polyphase component and M , the oversampling

rate. Only the polyphase order q is mentionned in the label of the filter because the oversampling rate M has a very limited impact on the actual performances of the low-pass filter in the oversampled domain. In Fig. 8, the transfer function of B30 was evaluated with M = 8.

October 15, 2012

DRAFT

22

TABLE II S ETTING OF THE ANALOG FILTERS

H9 (s)

ellip(9, 1, 90, 2.5, ’s’)

Fig. 8

H8 (s)

ellip(8, 1, 90, 2.4, ’s’)

Figs. 2, 4 and 5

H4 (s)

ellip(4, 1, 45, 2.8, ’s’)

Fig. 3

Ho (s)

ellip(4, 1, 90, 1.4, ’s’)

Fig. 6

L(s)

tf([1], [1 1/26])

Fig. 10

TABLE III S ETTING OF THE DISCRETE - TIME FILTERS

B70 (z)

decimate(so, 2 , 70, "fir")

Fig. 6

Hi (z)

butter(2, 0.01)

Fig. 6

B30 (z)

cl2lp(119,0.334,up,low,8192) [18]

Fig. 8

up = [1.06,3.35e-5] lo = [0.94,-3.35e-5]

A PPENDIX B S OURCE CODE OF A BIPOLAR BLIT GENERATOR The example source code of the BLIT generator is developped and tested with Octave v3.0.3 [19]. function s = genpulse(sysc, Tv, gv, N, Ts) ## s = genpulse(sysc, Tv, gv, N, Ts) ## s = genpulse(sysc, Tv, gv, N) ## ## sysc: analog system (low-pass filter) ## Tv:

vector of periods for the BLIT (in second)

## gv:

vector of gain for each impulse (same size as Tv)

## N:

number of sample generated

## Ts:

sampling rate

(Ts=1 is the default)

## ## Create the sampled train of filtered impulse response. ## (source code for Octave [19]) ## ## Monopolar BLIT at a period T is obtained with ##

Tv = [T];

##

gv = [1];

October 15, 2012

DRAFT

23

## ## Bipolar BLIT at a period T is obtained with ##

Tv = [w*T, (1-w)*T];

##

gv = [1, -1];

## ## Pitch modulated bipolar BLIT is obtained with ##

Tv = [T_1, T_2, T_3...]; (cf. Eq.(16))

##

gv = [1, -1, 1, ...];

## ## Stephan Tassart - 2012

if (nargin < 4) || (nargin > 5) error("Wrong arguments"); endif

if (nargin==4) Ts = 1; endif;

# initial settings sys = c2d(sysc,"ex",Ts); P

= length(sys.a);

t

= 0;

s

= zeros(N,1);

X

= zeros(P,1);

# prepare to loop on Tv and gv k_max = length(Tv); k

= 1;

# main sample loop for n=1:N while (tk_max) k=1; endif; endwhile; X

= sys.a * X;

s(n) = sys.c * X; t

= t - Ts;

endfor;

endfunction

October 15, 2012

DRAFT

24

ACKNOWLEDGMENT The author would like to thank the reviewers for their time and valuable comments. The work was supported by ST-Ericsson. R EFERENCES [1] V. V¨alim¨aki and A. Huovilainen, “Antialiasing oscillators in subtractive synthesis,” IEEE Signal Process. Mag., vol. 24, no. 2, pp. 116–125, Mar. 2007. [2] B. Frei, “Digital sound generation,” Institute for Computer Music and Sound Technology (ICST) Zurich University of the Arts, May 2009. [Online]. Available: http://www.icst.net [3] A. Chaudhary, “Bandlimited simulation of analog synthesizer modules by additive synthesis,” in AES 105th Convention, no. Convention Paper 4779, Sep. 1998. [4] J. Lane, E. M. D. Hoory, and P. Wang, “Modeling analog synthesizers with DSPs,” Comput. Music. J., vol. 21, no. 4, pp. 23–41, winter 1997. [5] G. Winham and K. Steiglitz, “Input generators for digital sound synthesis,” Journal of the Acoustical Society of America, vol. 47, no. 2, pp. 665–666, Feb. 1970. [6] J. Moorer, “The synthesis of complex audio spectra by means of discrete summation formulæ,” J. Audio Eng. Soc., vol. 24, no. STAN-M-5, Dec. 1975. [7] J. Nam, V. V¨alim¨aki, J. Abel, and J. Smith, “Alias-free virtual analog oscillators using a feedback delay loop,” in Proc. of the 12th Int. Conference on Digital Audio Effects (DAFx-09), Como, Italy, Sept. 1-4 2009. [8] T. Stilson and J. Smith, “Alias-free digital synthesis of classic analog waveforms,” in Proc. Int. Computer Music Conf., 1996, pp. 332–335. [9] O. Niemitalo, “Polynomial interpolators for high-quality resampling of oversampled audio,” Aug. 2001. [Online]. Available: http://www.student.oulu.fi/ oniemita/dsp/deip.pdf [10] J. Pekonen, J. Nam, J. Smith, and V. V¨alim¨aki, “Optimized polynomial spline basis function design for quasi-bandlimited classical waveform synthesis,” IEEE Signal Process. Lett., vol. 19, no. 3, pp. 159–162, Mar. 2012. [11] J. Nam, V. V¨alim¨aki, J. Abel, and J. Smith, “Efficient antialiasing oscillator algorithms using low-order fractional delay filters,” IEEE Trans. Audio Speech Lang. Process., vol. 18, no. 4, pp. 773–785, May 2010. [12] V. V¨alim¨aki, J. Nam, J. Smith, and J. Abel, “Alias-suppressed oscillators based on differentiated polynomial waveforms,” IEEE Trans. Audio Speech Lang. Process., vol. 18, no. 4, pp. 786–798, May 2010. [13] V. V¨alim¨aki, “Discrete-time synthesis of the sawtooth waveform with reduced aliasing,” IEEE Signal Process. Lett., vol. 12, no. 3, pp. 214–217, Mar. 2005. [14] Z. Gajic and M. Lelic, Modern Control System Engineering, ser. International Series in Systems and Control Engineering. London: Prentice Hall International, 1996. [15] G. Franklin, J. Powell, and M. Workman, Digital Control of Dynamic Systems, 3rd ed.

Addison Wesley, 1998.

[16] T. Stilson, “Efficiently-variable non-oversampled algorithms in virtual-analog music synthesis - a root-locus perspective,” Ph.D. dissertation, Stanford University, Jun. 2006. [Online]. Available: http://ccrma.stanford.edu/ stilti/papers/Welcome.html [17] S. Tassart, “Mod´elisation, simulation et analyse des instruments a` vents avec retard fractionnaire,” Ph.D. dissertation, Universit´e Paris 6, Mar. 2000. [Online]. Available: http://tassart.free.fr/these abstract 12.html

October 15, 2012

DRAFT

25

[18] I. W. Selesnick, L. Markus, and C. Burrus, “Constrained least square design of FIR filters without specified transition bands,” IEEE Trans. Sig. Process., vol. 44, no. 8, Jan. 1996. [19] “GNU octave.” [Online]. Available: http://www.gnu.org/software/octave/

St´ephan Tassart was born in France in 1970. He received the Eng. degree in electrical engineering from ´ Ecole Nationale Sup´erieure des T´el´ecommunications (ENST), Paris, in signal processing in 1993, a M.Sc. degree with honors in acoustics, computer science and signal processing applied to music (ATIAM, Paris) in 1994 and a Ph.D. degree in signal processing from Universit´e Pierre et Marie Curie (UPMC Paris-6) in 2000. Since 1998, he has been working in the audio industry (studies, experimentations, expertise) for different companies: Applied Acoustics Systems, Alcatel Mobile Phone, STMicroelectronics and ST-Ericsson. His main research interests are in the field of musical sound synthesis (physical modeling, analog virtual instruments), sample rate conversion techniques and multimodal systems for mobile multimedia applications. Dr. Tassart is a member of the STMicroelectronics Technical Staff.

October 15, 2012

DRAFT