Pitch Shifting by H ∞ -Optimal Variable
Fractional Delay Filters
Masaaki Nagahara ∗ Kazutaka Hanibuchi ∗∗Yutaka Yamamoto ∗∗∗∗Graduate School of Informatics, Kyoto University, Kyoto,606-8501, JAPAN (e-mail: nagahara@ieee.org).
∗∗
IHI Corporation, Tokyo,
135-8710, JAPAN(e-mail: zam0082@gmail.com).
∗∗∗
Graduate School of Informatics, Kyoto University, Kyoto,606-8501, JAPAN (e-mail: yy@i.kyoto-u.ac.jp).
Abstract: Fractional delay ﬁlters are those that are designed to delay the input samples by afractional amount of the sampling period. Since the delay is fractional, the intersample behaviorof original analog signals becomes crucial. For this, we propose an optimal design via sampleddata H ∞ control theory. By this theory, our design problem is equivalently reduced to a discretetime H ∞ optimization, and, an analytical solution is obtained under an assumption on theoriginal analog signals. Using this analytical solution, we propose a sampling rate conversion
with arbitrary conversion rate. This conversion is much faster than conventional methods using
an upsampler, a digital ﬁlter, and a downsampler. We also show an application of the proposed
sampling rate conversion to pitch shifting of guitar sounds. A design example is shown toillustrate the advantage of the proposed method.
Keywords: Digital signal processing, sampled-data control, sampling rate conversion, pitch
shifting.
1. INTRODUCTION
Fractional delay ﬁlters are to delay the input signal bya fraction of the sampling period. Such a ﬁlter has wide
applications in signal processing, including digital communications, speech processing and digital modeling ofmusical instruments [Laakso et al. (1996); Välimäki and
Laakso (2000)].
Conventionally, fractional delay ﬁlters are designed in
the discrete-time domain by assuming that the incoming
continuous-time signals are fully band-limited up to the
Nyquist frequency. Under this assumption, the optimal
fractional delay ﬁlter is given by a delayed sinc function.
Such a ﬁlter is however not realizable because of its noncausality and instability, and hence many studies havefocused on approximating the ideal ﬁlter [Laakso et al.
(1996); Hermanowicz (1992); Pei and Wang (2004)].
Although these studies are based on the band-limiting
assumption, no real analog signals are fully band-limited,and hence the assumption is not realistic. Moreover, by
their very nature, fractional delay ﬁlters should reconstruct intersample signal values. It is, therefore, necessary
for designing the ﬁlters to take account of high-frequency
components beyond the Nyquist frequency and the intersample behavior of input analog signals.
For such problems, sampled-data control theory provides
an optimal platform. Based on this theory, the design
problem of fractional delay ﬁlters has been formulated as asampled-data H ∞ optimization [Nagahara and Yamamoto(2003, 2005)]. In particular, the analytical expression for
the H ∞ optimal fractional delay ﬁlter is given under theassumption that the underlying frequency characteristic of
the continuous-time input signal is governed by a low-passﬁlter of ﬁrst order.
By this analytical solution, we propose a method for fastsampling rate conversion. Conventionally, sampling rate
conversion is executed by an upsampler, a digital ﬁlter
and a downsampler [Vaidyanathan (1993)]. This scheme
is eﬀective if the conversion rate is a fraction of small
integers (e.g., 2/3). It however seriously increases thecomputation load when both integers become very large,e.g., 44100/48000= 147/160 as in CD to DAT conversion[Zölzer (2008)]. Moreover, if the rate is an irrational
number, this scheme cannot be used. On the other hand,by using the fractional delay ﬁlters, we can convert digital
signals with arbitrary positive real rate [Ramstad (1984)].
In addition, while conventional design of the digital ﬁlter
in sampling rate conversion depends on the band-limiting
assumption mentioned above, our design can take accountof analog characteristic of input signals.
By using this sampling rate converter, we propose a new
pitch shifting method. Pitch shifting is a technique forraising or lowering the original pitch of audio signals.
This is often used in synthesizing musical tone from arecorded signal of a musical instrument with a ﬁxed
fundamental frequency [Roads (1996)]. A naive methodof pitch shifting does not conserve the signal length, forexample, if the pitch is made higher, the length becomesv(t)v(t − D)

w

F (s)

v

zd

e−Ds
T
yd
T

(a)
v(nT )(b)v(nT − D)(c)(d)
Fig. 1. (a) continuous-time signal v(t), (b) delayed signalv(t − D), (c) sampled signal v(nT ), (d) delayed andsampled signal v(nT − D)short. To conserve the length, we also propose a methodby adding (or cutting) the shifted signal.
The article is organized as follows. Section 2 deﬁnes
fractional delay ﬁlters, and formulates the design problem
as a sampled-data H ∞ optimization and show its solution.
In Section 3, we propose a new sampling rate conversion
method based on sampled-data H ∞ optimal fractional
delay ﬁlters, and propose a method for conservation of thesignal length. Numerical examples are shown in Section
4 to illustrate the superiority of the proposed method.
Section 5 makes a conclusion.
2. DESIGN OF FRACTIONAL DELAY FILTERS
2.1 Fractional delay filters
Consider a continuous-time signal v(t), t ∈ R+ as shown in
Fig. 1 (a). Delaying the signal v(t) by the continuous-timedelay operator e−Ds (D > 0), we obtain the delayed signalv(t − D) shown in Fig. 1 (b). Then the signal v(t − D) is
sampled with period T and becomes a discrete-time signalv(nT − D), n ∈ Z+ as shown in Fig. 1 (d).
On the other hand, consider the sampled signal v(nT ), as
shown in Fig. 1 (c). Then we deﬁne the ideal fractional
delay ﬁlter as follows:
Definition 1. The ideal fractional delay filter K id withdelay time D is deﬁned by
K id : v(nT ) → v(nT − D).
Note that if the delay D is an integer multiple of thesampling period T , that is, D = mT , m ∈ Z+ , the ideal
ﬁlter K id is the discrete-time delay z −m . Moreover, if
the input analog signal v(t) is fully band-limited up to
the Nyquist frequency ωN := π/T , that is, the Fouriertransform V (jω) of v(t) vanishes at |ω| ≥ ωN , the impulse
response of the ideal fractional delay ﬁlter is obtained asfollows [Laakso et al. (1996)]:
(nT − D)sin π(nT − D)/T= sinck id [n] =,π(nT − D)/TT
(1)
n = 0, ±1, ±2, . . . , sinc t := (sin πt)/(πt).

K(z)

ud + ed−Fig. 2. Error system E for designing fractional delay ﬁlter
K(z)The frequency response of this ideal ﬁlter is derived by the
Fourier transform:
K id (ejωT ) = e−jωD , ω ≤ ωN .
(2)
Since the impulse response (1) does not vanish at n =−1, −2, . . . and is not absolutely summable, the ideal ﬁlter
must be noncausal and unstable, and hence the ideal
ﬁlter cannot be realized. Conventional designs thus aim
at approximating (1) or (2) to a causal and stable ﬁlter
via a window method, maximally-ﬂat FIR approximations, weighted least-squares approximation, and so forth[Laakso et al. (1996)].
These methods are based upon the band-limiting assumption as mentioned above. In practice, however, real analog
signals always contain some frequency components beyond
the Nyquist frequency. In what follows, we formulate thedesign problem of fractional delay ﬁlters without such anassumption by using the sampled-data H ∞ optimization.
2.2 Design problem of fractional delay filters
Consider the block diagram Fig. 2. In this diagram, F (s)governs the frequency-domain characteristic 1 of the input
signal w ∈ L2 . Then, the upper path of the diagram is
the ideal process of the fractional delay ﬁlter (the process(a) → (b) → (d) in Fig. 1), that is, the continuous-time
signal v is delayed by the continuous-time delay e−Ds , thensampled with period T , and becomes a discrete-time signal
zd ∈ 2 . On the other hand, the lower path is the realprocess ((a) → (c) → (d) in Fig. 1), that is, the continuoustime signal v is sampled with period T , ﬁltered by K(z) to
be designed, and becomes a discrete-time signal ud ∈ 2 .
Put ed := zd − ud (the diﬀerence between the ideal output
zd and the real output ud ), and let E denote the systemfrom w ∈ L2 to ed ∈ 2 . Then our problem is to ﬁnd theﬁlter K(z) which minimizes the H ∞ norm of the error
system E.
Problem 1. Given a stable, strictly proper F (s), a delay
time D > 0, and a sampling period T > 0, ﬁnd the digitalﬁlter K(z) which minimizes
ed 2
E∞ := sup.
(3)w∈L2 wL2w=0

2.3 Design of Optimal Filters
Assume the delay D is decomposed by
D = mT + d,
1 Conventionally, F (s) is assumed to be an ideal filter such that
F (jω) = 0, |ω| ≥ ωN (the Nyquist frequency).

where m is a non-negative integer and 0 < d ≤ T . Assume
also that the ﬁlter F (s) is a ﬁrst-order low-pass ﬁlter with
cutoﬀ frequency ω = ωc , that is,ωc.
F (s) =s + ωcThen the H ∞ optimal ﬁlter K(z) which minimizes (3) canbe obtained with an analytical representation [Nagahara
and Yamamoto (2003, 2005)]:
Theorem 1. The optimal ﬁlter K(z) is obtained byK(z) = a0 (d)z −m + a1 (d)z −m−1 ,

(4)

where

sinh (ωc (T − d)),a0 (d) :=sinh(ωc T )−ωc T

a1 (d) := e

ωc d

(e

v

↑ Mr

Moreover, the optimal value of E∞ isωc sinh(ωc d) sinh(ωc (T − d)).
E∞ :=
sinh(ωc T )(6)Remark 2. When d = 0, the formula (5) gives a0 (0) = 1,
a1 (0) = 0 and the optimal ﬁlter in (4) becomes K(z) =z −m . Also when d = T , we have a0 (T ) = 0, a1 (T ) = 1,
and the optimal ﬁlter becomes K(z) = z −m−1 . In bothcases, the optimal value of E∞ given in (6) becomes 0,that is, perfect reconstruction.
Remark 3. Since sinh(x) ≈ x and e−x ≈ 1 − x when x is
suﬃciently small, we haveT −dωc (T − d)=,a0 (d) ≈
ωc T
T
d
T −d
= ,
a1 (d) ≈ 1 − ωc (T − d) − (1 − ωc T ) ·T
Twhen ωc T is suﬃciently small, that is, when the frequency
ωc is much smaller than the sampling frequency 1/T . Thenthe optimal ﬁlter becomesT − d −m d −m−1z
+ z.
K(z) =
T
T
This is the linear interpolation between two points yd [m]and yd [m + 1]. In other words, if the original signals
contain very few high-frequency components relative tothe sampling frequency 1/T and the decay of the Fouriertransform is the ﬁrst order, then the linear interpolation
is approximately optimal.
3. FAST SAMPLING RATE CONVERSION AND
PITCH SHIFTING
3.1 Fast sampling rate conversion
Consider a continuous-time signal {v(t)}t∈R+ . Assume
that we are given sampled data v[m] := v(mT ), m ∈ Z+
where T > 0 is a sampling period. Then we execute
sampling rate conversion on this discrete-time signal. By
r, we denote the conversion rate. We assume r is apositive real number. Then sampling rate conversion aims
at estimating the values of {v(krT )}k∈Z+ }. Since we missthe intersample values of {v(t)}t∈R+ , the exact estimation
is impossible.
Conventionally, this estimation is done by an upsampler,a digital ﬁlter and a downsampler [Vaidyanathan (1993);
Zölzer (2008)]. Fig. 3 shows this scheme. As mentioned

vrFig. 3. Sampling rate conversion by upsampler-ﬁlterdownsampler system. The rate is r = Nr /Mr where
Mr and Nr are positive integers.
v(t)v(mT )− a0 ).
(5)

↓ Nr

H(z)

v(krT )v((m + 1)T )

dk
t
mT
krT
(m + 1)T
Fig. 4. The value v(krT ) is given by shifting v(t) by
dk = (m + 1)T − krT and sampling at t = (m + 1)T .
in Section 1, this scheme cannot be used if the rate r is
irrational.
Alternatively, we adopt a sampling rate conversion byusing fractional delay ﬁlters [Ramstad (1984)]. In this conversion, we use the sampled-data H ∞ optimal fractional
delay ﬁlter given in Theorem 1. Let us consider estimationof the value v(krT ) where k is a positive integer. Assume
that the time krT satisﬁes mT < krT ≤ (m + 1)T wherem is a non-negative integer. Let dk := (m + 1)T − krT .
Then we havev(krT ) = v ((m + 1)T − (m + 1)T + krT )= v ((m + 1)T − dk )= v(t − dk )|t=(m+1)T .
That is, the value v(krT ) is obtained by delaying v(t) by dk
and sampling at time t = (m + 1)T (see Fig. 4). Therefore,
the estimation vr [k] for v(krT ) can be obtained by thefractional delay ﬁlter given in (4) as
vr [k] = a0 (dk )v ((m + 1)T ) + a1 (dk )v(mT ),where a0 (·) and a1 (·) are given in (5). Note that thisﬁlter is a two-tap FIR ﬁlter and the estimation needs
much fewer computation than the conventional scheme
shown in Fig. 3. Also we emphasize that the computationload is the same for arbitrary real rate r while that of
the conventional scheme increases the load when Nr andMr are large. This is an advantage over conventional
methods in the case of real-time processing. In addition,
while conventional design of the digital ﬁlter in sampling
rate conversion depends on the band-limiting assumption
mentioned above, our design can take account of analog
characteristic of input signals.
The algorithm of the proposed sampling rate conversion
is shown in Algorithm 1. In this algorithm, we deﬁnev[m] := v(mT ), m = 0, 1, 2, . . ..
3.2 Pitch shifting
Pitch shifting is a technique for raising or lowering theoriginal pitch of audio signals. To accomplish this, we
can use a sampling rate converter; convert the sampling
period T to rT with r > 0, and play the converted signal
with the original sampling period T . By this process, wehave a raised (if r > 1) or lowered (if r < 1) pitch. For

1.5
Decay

Attack1

Amplitude

Algorithm 1 Sampling rate conversion
vr [0] := v[0]k := 1for m = 0, 1, 2, . . . dowhile kr ≤ m + 1 do
d := (m + 1)T − krT
vr [k] := a0 (d)v[m + 1] + a1 (d)v[m]k := k + 1
end while
end for

0.5

0

−0.5

−1
0

0.5

1

1.5
Time (sec)

2

2.5

3

Fig. 6. Guitar sound with the fundamental frequency 110
Hz (A2 ) split into attack and decay portions
(a)

0.5
0.4
0.3

Amplitude

0.2

(b)

0.1
0
−0.1
−0.2
−0.3
−0.4
−0.5
1

(c)
Fig. 5. Pitch shifting by sampling rate converter: (a)original digital signal, (b) sampling rate conversion,and (c) pitch sifting by processing the signal in (b)with the same sampling rate as (a).
example 2 , the pitch 110 Hz, that is A2 note is converted
to D3 note (110 × 25/12 ≈ 146.83 Hz) with r = 2−5/12 .
This is analogous to listening to music by fast- or slowforwarding a cassette tape. This process is eﬀectively doneby the proposed algorithm (Algorithm 1) if the sound isgiven by digital data. We illustrate this process in Fig. 5.
A problem of this process is that the length of signal
is also changed (compare (a) and (c) in Fig. 5). Let L
be the length of the original signal. Then if we shift its
pitch by Algorithm 1 with rate r > 1, the length of theconverted signal will be L/r < L. To adjust the length,
we should ﬁll in a signal whose length is L − L/r. Whenr < 1, then cut out a signal whose length is L/r − L. To
execute this, we split the original signal into attack anddecay portions [Roads (1996)]. Fig. 6 shows an example ofthis representation. The attack is the transient response of
the sound, and it is known that this portion plays the mostimportant role in distinguishing a particular instrument[Risset and Wessel (1998)]. On the other hand, the decay
is the steady-state response with decay. Fig. 7 shows a partof this stage. We can see that the signal in this portion is2

In this article, we consider equal temperament [French (2009)].

1.005

1.01

1.015

1.02

1.025 1.03
Time (sec)

1.035

1.04

1.045

1.05

Fig. 7. Decay: locally periodic signal with the fundamental
frequency 110 Hz (A2 )locally a periodic signal. Based on this fact, we split theprocessing in two stages.
The ﬁrst stage is for the attack portion. Let L0 > 0 be
the length of the attack signal. We convert this signal by
Algorithm 1 with r, and we obtain a signal with length
L0 /r. The next stage is for the decay portion. We split
the decay signal (note that this signal has the length
L − L0 ) into N frames of equal length τ . Let f be thefundamental frequency of the original signal and l := 1/f
be the fundamental period. We choose the frame length τto satisfy the following:
L − L0
l
τ=
·
· n,
(7)
L
|r − 1|
where n is an integer satisfyingLn≥max{r − 1, r−1 − 1}.
(8)
L − L0We assume that N := (L − L0 )/τ is a positive integer (ifnot, we truncate the original signal). Then we convert eachframe by Algorithm 1. If r > 1, we cut oﬀ the fundamental
wave with period l/r from the converted frame, and add npitch-shifted fundamental waves at the end of the frame.
This procedure is illustrated in Fig. 8. If r < 1, we cut
out n fundamental waves. Note that in both cases theconverted frame includes at least one fundamental wave
if (8) is satisﬁed. Then the length τ  of converted frames
becomes (see Fig. 8)

τ
1

0.8

Amplitude

0.6

l

0.4

(a) Original frame

0.2

0Time (sec)
0

τ /r

nl/r

(b) Processed frame

4. DESIGN EXAMPLES
We ﬁrst demonstrate sampling rate conversion. We set theanalog ﬁlter F (s) as
0.1,
F (s) =
s + 0.1
that is, we set ωc = 0.1. The sampling time T is set to be 1.
We consider here
√ sampling rate conversion with irrational
rate r = 1/ 10. The input signal is a triangle wave,
and we convert the sampling rate by Algorithm 1. For
comparison, we also execute sampling rate conversion by
the conventional scheme shown in Fig. 3. The number√Mr
and Nr are given by rational approximation of r = 1/ 10
asMr = 19, Nr = 6.
With this approximation, the approximation error isbounded by1√ − 6/19 < 10−3 ,10where we used the MATLAB function

10

15

20

25

30

Fig. 9. Sampling rate conversion by the proposed method:original signal (dash), sampled-data (×), and converted data (◦)

Fig. 8. Processing of a frame in decay portion: (a) Originalframe with length τ and fundamental period l, (b)Processed frame added n = 2 pitch-shifted fundamental waves.

1

0.8

0.6
Amplitudelττ  = + · n.
rr
Then the equation (7) gives the length of the converted
signal in the decay portion as follows
τnl L − L0±τ N =rr
τ
L − L0nl(L − L0 )
=
±
r
rτ
1
= (L − L0 ± L|r − 1|)
r
L0
,
=L−
r
where the double sign corresponds to the two conditionsr > 1 or r < 1. Since the length of the converted attack
portion is L0 /r, the length of the whole converted signal
becomes L, which is equal to the original length.

5

0.4

0.2

0

0

5

10

15
Time (sec)

20

25

30

Fig. 10. Sampling rate conversion by the conventional
method: original signal (dash), sampled-data (×), andconverted data (◦)
rat(1/sqrt(10), 1e-3)
for Mr and Nr . The sampling rate conversion by thescheme shown in Fig. 3 is easily executed by the MATLAB
function
resample(v,19,6)
We also obtain the ﬁlter H(z) in Fig. 3 by the same
MATLAB function, which is a 381-tap FIR ﬁlter.
The converted signals are shown in Fig. 9 (proposed
method) and Fig. 10 (conventional method). We can seethat the proposed method produces much better reconstruction than the conventional method. In fact, the 2norm of the reconstruction error is 0.2530 for the proposed
method and 0.4820 for the conventional one. That is, ourmethod is about 50% better than the conventional methodin 2 norm of the reconstruction error.
Moreover, our method requires much fewer computation
than the conventional method. The computation time forcomputation by the proposed method is 0.000143 (sec),
while that by the conventional method is 0.001788 (sec).
That is, our method is about 10 times faster than theconventional method. This shows the eﬀectiveness of the
proposed method.

1600014000
12000

Amplitude

10000
8000
6000
4000
2000
0
0

(a) Proposed method
100

200

300
Frequency [Hz]

400

500

600

Fig. 11. Frequency response: original signal with fundamental frequency 110 Hz (dots) and pitch-shifted signal with fundamental frequency 110 × 25/12 ≈ 146.83
Hz (solid).
Then by using the proposed sampling rate converter, we
shift the pitch of a guitar sound with A2 (110 Hz) shownin Fig. 6 to D3 note (110 × 25/12 ≈ 146.83 Hz). For this,
we take r = 2−5/12 . Fig. 11 shows the frequency responsesof the original signal with fundamental frequency 110 Hz(dots) and the pitch-shifted signal. The frequency responseof the shifted signal shows that the processed signal has avalid fundamental frequency 110 × 25/12 ≈ 146.83 Hz andthe harmonics with 110 × 25/12 × n, n = 2, 3, 4.
We show another example of pitch shifting. We shift thenote A2 (110Hz) used above to A3 (220 Hz). Then theshifted signal is again shifted down to the original note A2 .
We measure the error between the original sound and theprocessed one. Figure 12(a) shows the reconstruction error
by the proposed method. For comparison, we processed by
the phase vocoder [Portoﬀ (1976); Ellis (2002)], which is
widely used in pitch shifting. Figure 12(b) shows the errorof the phase vocoder. We can see that the phase vocoder
produces much larger errors than the proposed method.
This shows eﬀectiveness of our method.
One can listen to the processed sounds at the following
web page:
http://www-ics.acs.i.kyoto-u.ac.jp/~nagahara/ps/

5. CONCLUSION
We have presented a new method of designing variablefractional delay ﬁlters via sampled-data H ∞ optimization.
We have given the H ∞ optimal ﬁlter having delay time
variable D as an adaptive variable, when the frequency
distribution of the input analog signal is modeled as aﬁrst-order low-pass ﬁlter. Moreover, by using this optimalﬁlter, we propose a fast sampling rate conversion and a
new pitch shifting which conserves the signal length. A
design example shows that the proposed sampling rate
conversion exhibits a much more satisfactory performance
than conventional ones, and also the eﬀectiveness of the
proposed sampling rate conversion. We have also shown an
example of the proposed pitch shifting. Future work may
include the design of H ∞ -optimal fractional delay ﬁlters
for second or higher order low-pass ﬁlters.

(b) Phase vocoder

Fig. 12. Reconstruction error
REFERENCES
Ellis, D.P.W. (2002).

A phase vocoder in Matlab.

http://www.ee.columbia.edu/~dpwe/resources/matlab/pvoc/.

French, R.M. (2009). Engineering the Guitar. Springer.
Hermanowicz, E. (1992). Explicit formulas for weighting
coeﬃcients of maximally ﬂat tunable FIR delayers.
Electronics Letters, 28, 1936–1937.
Laakso, T.I., Välimäki, V., Karjalainen, M., and Laine,
U.K. (1996). Splitting the unit delay. IEEE Signal
Processing Mag., 13, 30–60.
Nagahara, M. and Yamamoto, Y. (2003). Optimal designof fractional delay ﬁlters. In Proc. of 39th Conf. on
Decision and Control, 6539–6544.
Nagahara, M. and Yamamoto, Y. (2005). Optimal designof fractional delay FIR ﬁlters without band-limiting
assumption. In IEEE ICASSP’05, 221–224.
Pei, S.C. and Wang, P.H. (2004). Closed-form design of
all-pass fractional delay ﬁlters. IEEE Signal Processing
Lett., 11, 788–791.
Portoﬀ, M.R. (1976). Implementation of the digital phase
vocoder using the fast fourier transform. IEEE Trans.
Acoust., Speech, Signal Processing, 24(3), 243–248.
Ramstad, T.A. (1984). Digital methods for conversion
between arbitrary sampling frequencies. IEEE Trans.
Acoust., Speech, Signal Processing, 32(3), 577–591.
Risset, J.C. and Wessel, D.L. (1998). Exploration of timbre
by analysis and synthesis. In D. Deutsch (ed.), The
Psychology of Music. Academic Press.
Roads, C. (1996). The Computer Music Tutorial. The
MIT Press.
Vaidyanathan, P.P. (1993). Multirate Systems and Filter
Banks. Prentice Hall.
Välimäki, V. and Laakso, T.I. (2000). Principles offractional delay ﬁlters. In IEEE ICASSP’00, 3870–3873.
Zölzer, U. (2008). Digital Audio Signal Processing. Wiley,
2nd edition.