An Efficient Implementation of the Music Algorithm for Frequency Estimation of Approximately Periodic Signals
Total Page:16
File Type:pdf, Size:1020Kb
Proceedings of the 21st International Conference on Digital Audio Effects (DAFx-18), Aveiro, Portugal, September 4–8, 2018 FAST MUSIC – AN EFFICIENT IMPLEMENTATION OF THE MUSIC ALGORITHM FOR FREQUENCY ESTIMATION OF APPROXIMATELY PERIODIC SIGNALS Orchisama Das, Jonathan S. Abel, Julius O. Smith III Center for Computer Research in Music and Acoustics, Stanford University Stanford, USA [orchi|abel|jos]@ccrma.stanford.edu ABSTRACT with poles and zeros. It is said to have better resolution than MU- Noise subspace methods are popular for estimating the parame- SIC at low SNRs. Similarly, another popular algorithm, ESPRIT ters of complex sinusoids in the presence of uncorrelated noise [7], was invented by Roy et al. which makes use of the underly- and has applications in musical instrument modeling and micro- ing rotational invariance of the signal subspace. The generalized phone array processing. One such algorithm, MUSIC (Multiple eigenvalues of the matrix pencil formed by an auto-covariance ma- Signal Classification) has been popular for its ability to resolve trix and a cross-covariance matrix gives the unknown frequencies. closely spaced sinusoids. However, the computational efficiency ESPRIT performs better than MUSIC, especially when the sig- of MUSIC is relatively low, since it requires an explicit eigenvalue nal is sampled nonuniformly. More recently, another enhancement decomposition of an autocorrelation matrix, followed by a linear to MUSIC, gold-MUSIC [8] has been proposed which uses two search over a large space. In this paper, we discuss methods for and stages for coarse and fine search, respectively. the benefits of converting the Toeplitz structure of the autocorrela- One of the disadvantages of the MUSIC algorithm is its com- tion matrix to circulant form, so that the eigenvalue decomposition putational complexity. Typical eigenvalue decomposition algo- can be replaced by a Fast Fourier Transform (FFT) of one row of rithms are of the order O(N 3) [9]. In this paper, we use the the matrix. This transformation requires modeling the signal as at fact that, for periodic signals, the autocorrelation matrix is circu- least approximately periodic over some duration. Moreover, we lant when it spans an integer multiple of the signal’s period. In derive a closed-form expression for finding spectral peaks, yield- this case, looking for the eigenvalues with largest magnitude is ing large savings in computation time. We test our algorithm to equivalent to looking for magnitude peaks in the FFT. We know in resolve closely spaced piano partials and observe that it can work the circulant case that our noise eigenvectors are DFT sinusoids, with a much shorter data window than a regular FFT. and hence we can derive a closed-form solution when we project our search space onto the noise subspace, thereby reducing further 1. INTRODUCTION the calculations required to find the pseudospectrum. Replacing eigenvalue decomposition in MUSIC with efficient Fourier trans- Sinusoidal parameter estimation is a classical problem with appli- form based methods has been previously studied in [10] where cations in radar, sonar, music, and speech, among others. When the eigenvectors are derived to be some linear combinations of the the frequencies of sinusoids are well resolved, looking for spectral data vectors, while maintaining the orthonormality constraint. In peaks is adequate. It is shown in [1] that the maximum likelihood this paper, we take a different approach by utilizing the circulancy (ML) frequency estimate for a single sinusoid in Gaussian white of autocorrelation matrices. noise is given by the frequency of the magnitude peak in the peri- We test our algorithm to resolve closely spaced partials of the odogram. The ML approach is extended and Cramer-Rao bounds A3 note played on a piano. It is a well known fact that the strings are derived for multiple sinusoids in noise in a follow-on paper by corresponding to a particular piano key are slightly mistuned. Cou- the same authors [2]. Some other estimators are covered in [3]. pled motion of piano strings has been studied in detail by Weinre- For closely spaced sinusoidal frequencies, however, other ap- ich in [11, 12]. There is a slight difference in frequency of the proaches have been developed. Noise subspace methods are a individual strings, giving rise to closely spaced peaks in the spec- class of sinusoidal parameter estimators that utilize the fact that tra. A very long window of data is needed to resolve these peaks the noise subspace of the measured signal is orthogonal to the sig- with the FFT. We show that FAST MUSIC can resolve two closely nal subspace. Pisarenko Harmonic Decomposition [4] makes use spaced peaks with a much shorter window of data than a regular of the eigenvector associated with the minimum eigenvalue of the FFT, and much faster than MUSIC. estimated autocorrelation matrix to find frequencies. However, it The rest of this paper is organized as follows : Section 2 gives has been found to exhibit relatively poor accuracy [3]. Schmidt an outline of the MUSIC algorithm, Section 3 derives the FAST [5] improved over Pisarenko with the MUSIC (MUltiple SIgnal MUSIC algorithm, Section 4 describes the experimental results on Classification) algorithm which could estimate the frequencies of a) an artificially synthesized signal containing two sinusoids with multiple closely spaced signals more accurately in the presence of additive white noise and b) a partial of the A3 note played on the noise. In MUSIC, a pseudospectrum is generated by projecting piano which contains beating frequencies. We conclude the paper a complex sinusoid onto all of the noise subspace eigenvectors, in Section 5 and delineate the scope for future work. Estimation of defining peaks where this projection magnitude is minimum. This real-valued sine wave frequencies with MUSIC has been studied method is shown to be asymptotically unbiased. An enhancement in [13]. For all derivations in this paper, we work with real signals, to MUSIC, root-MUSIC, was proposed in [6]. It uses the proper- because we are interested in audio applications. This saves some ties of the signal-space eigenvectors to define a rational spectrum time in computing the pseudospectrum since we know it will be DAFX-1 Proceedings of the 21st International Conference on Digital Audio Effects (DAFx-18), Aveiro, Portugal, September 4–8, 2018 symmetric. Our derivations can be easily extended to complex 3. FAST MUSIC signals. Under conditions to be specified, it is possible to replace the eigen- 2. MUSIC value decomposition required in MUSIC by a Fast Fourier Trans- form (FFT). In this section, we derive the structure and order of 2.1. Model the autocorrelation matrix for which it is circulant instead of only Toeplitz. We also derive a closed-form expression for finding the We wish to estimate the parameters of a signal composed of ad- pseudospectrum. ditive sinusoids from noisy observations. Let y(n) be the noisy signal, composed of a deterministic part, x(n), made of r real sinu- 3.1. Deriving the autocorrelation matrix soids and random noise, w(n). We assume that w(n) ∼ N(0; σ2), M and that w(n) and x(n) are uncorrelated. The sinusoidal phases In vector form, y 2 R can be written as: φi’s are assumed to be i.i.d. and uniformly distributed φi ∼ U(−π; π). y = Sa + w r 2 (3) X w ∼ N(0; σ I) y(n) = Ai cos (!in + φi) + w(n) i=1 y(n) = x(n) + w(n) 2 y(n) 3 2 1 0 ··· 3 In vector notation, the signal y 2 M can be characterized 6 y(n − 1) 7 6 cos(!1) sin(!1) ··· 7 R 6 7 = 6 7 T 6 . 7 6 . 7 by the M × M autocorrelation matrix Ky = E(yy ). For a 4 . 5 4 . ::: 5 zero-mean signal, the autocorrelation matrix coincides with the y(n − M + 1) cos[(M − 1)!1] sin[(M − 1)!1] ··· covariance matrix. Since this matrix is Toeplitz and symmetric 2 3 2 3 positive-definite, its eigenvalues are real and nonnegative (and pos- A1 cos(!1n + φ1) w(n) itive when σ > 0). We can perform an eigenvalue decomposition 6A1 sin(!1n + φ2)7 6 w(n − 1) 7 × 6 7 + 6 7 on this matrix to get a diagonal matrix Λ consisting of the eigen- 6 . 7 6 . 7 4 . 5 4 . 5 Q 2r values, and an eigenvector matrix . The eigenvectors cor- A sin(! n + φ ) w(n − M + 1) responding to the 2r largest eigenvalues, Q , contain signal plus r r r x (4) noise information, whereas the remaining M-2r eigenvectors, Qw, only represent the noise subspace. Thus, we have the following Since y is zero-mean, its covariance matrix is relationships: T T 2 2 Ky = (yy ) = SKaS + σ I: (5) Ky = Kx + Kw = Kx + σ I E K = QΛQH We now want to get K in terms of K . We have assumed φ ∼ y (1) y a i 0 H U(−π; π) (uniformly identically distributed random phase). We Λ 0 Qx Ky = Qx Qw 2 H observe that every term of Ka is of the form Ka(i; j) = E[Ai cos(!i 0 σ IM−2r Qw n + φi) Aj cos(!j n + φj )], or E[Ai sin(!in + φi)Aj sin(!j n + φj )], or E[Ai sin(!in+φi)Aj cos(!j n+φj )], or E[Ai cos(!in+ 2.2. Pseudospectrum Estimation φi)Aj sin(!j n + φj )]. All of these terms are zero, except the first 2 2 2 Let a vector of M harmonic frequencies be denoted as b(!) = two when i = j, i.e. E[Ai cos (!in + φi) ] = E[Ai sin(!in + 2 j! 2j! (M−1)j! T 2 Ai [1; e ; e ··· e ] .