This action might not be possible to undo. Are you sure you want to continue?

Welcome to Scribd! Start your free trial and access books, documents and more.Find out more

Seminar Report Submitted in partial fulﬁllment of the degree of Master of Technology by

Pankaj E. Gulhane 03329007 Kanwal Rekhi School of Information Technology

Under the guidance of Prof. Preeti Rao Department of Electrical Engineering and Advanced Centre for Research in Electronics Prof. Kavi Arya Department of Information Technology

Indian Institute of Technology, Powai, Mumbai

When user want to fetch some melody. Conventional keyword based methods attaches some set of keywords to a music ﬁle. and by comparing these strings. Searching a particular song in such a database. and user are suppose to pose query against these keywords. There are many pitch contour representation. various approximate string matching(ASM) algorithms and methods are surveyed. it outputs a match. The functional part of MIR is shown in ﬁgure 1. To incorporate these errors in comparison. Few are listed below • 3 Level: U/D/S indicating that pitch goes Up. Database is searched for this melody information(in standard form). While comparing these two strings. year etc. More natural way of searching would be query by humming(QBH). In Melody Information Retrieval system (MIR)[6]. and represent it in some standard form. and the nearest match is returned. Tagging each song by a singer name. doesn’t help much. 1 . System processes this query and tries to extract melody information[4]. approximate string matching should be used. Query is typically a few notes sung or hummed by user. Variation of pitches can characterise melody.Abstract Today music database is growing very fast. some errors are allowed. there is a melody database and a mechanism to query this database. In this paper. by humming a fragment of a song. Current QBH methods represent a song and a query in some string format. Melody is sequence of variation of pitches and duration. This variation in pitches is called pitch contour[10] and it is invariant to key transposition. 1 Introduction Today user can access large music data.1 Pitch detection The pitch is one of the fundamental attribute of music. and a similarity calculating function. Some dynamic programming algorithms are explained. Down or remain Same. We want some method which will enable user to pose search bsed on contents of a music ﬁle and the most natural way to search in a song database would be. 1. So the major modules over here are extraction of melody information. • 5 Level: U/u/S/d/D levels are more ﬁne grained than above. So it is strongly required to provide users with the ability to search music by content. which bring complexity of ASM from qudratic time to sublinear expected time. is no longer a trivial task. (s)he ﬁres a query.

2 Problem We are given a music string and a query string. User query will be compared with these entries and match will be returned.e. Approximate string matching module is very important. This can be very well done by using approximate string matching. a string associated with some song(i. It will also discuss about some implemented methods and other promissing methods. these issues need to be taken care of. TaNSEN [7] got 5 levels) Using above representation we can get a melody string associated with some music. as it is going to decide accuracy and eﬃciency of system. Here user may not hum or sing exactly. This paper will try to present some algorithms. Now the only job remaining is. while comparing two strings. Music string means. He/She may add/delete/replace some notes. similarly we can get user query in this string format.Acoustic query Midrophone and sound card Melody database Pitch detection Search engine (Uses approximate string matching) Contour Note segmentation Ranked listing Figure 1: Basic blocks of melody retrieving system These levels decides accuracy of search(eg. It has to response faster when working with large databases. 1.2 String Matching The database of songs is indexed by melody strings. which will reduce runtime complexity of approximate string matching. string representing music information 2 . ﬁnding the closest match between a query and a melody string.

There are various distance functions. user can make some mistakes(like insertion. deletion. • Hamming distance: allows only substitutions. that 3 .. delete.present in that song). 2. Here we take characters in account. without bothering about distance between two characters.(k diﬀerences). be simple and fast. whereas query string is a string generated by user query. So algorithm should 1. cost is independent of characters which are being replaced. Number of diﬀerent operations that we have to do.e. which can be changed. but same alphabet size.1 Notations Now onward query string will be called as pattern P 1. In MIR context. characters are compared exactly. how many operations we have to perform so as to convert one string into another. Every insert. k will be the maximum allowed error..y) will be the edit distance between string x and string y.. allow us to change weights associated with operations. If characters found unequal. Possible operations may be insertion.n . But most of the times importance is given to number of operations. Whereas this is not the case with melody string comparision.. i. 2. ed(x. to convert from one string to another is called as distance between two strings. How is it diﬀerent from general ASM? In normal ASM. deletions and substitutions. or substitution. few of them are listed below[9]. These strings can have any. so edit distance would be better choice. deletion.(k mismatches) • Episode distance: allows only insertions • Longest common subsequence distance: allows only insertions and deletions. we have to ﬁnd out. For TaNSEN it is ﬁve.m and music string as text T1. then character is replaced with another. Same operation on two diﬀerent pair of characters may result in diﬀerent cost. • Levenshtein or edit distance: allows insertions. 3 Approximate string matching(ASM) Given two strings. substitution of note). and replace operation is associated with some cost. while querying.

2. when it works on bits. 4 . This method is not vary much eﬃcient. Filter algorithms discard areas of the text. Automaton In this method.1 Taxonomy of algorithms [9] Approximate string matching problem can be attacked in various ways 1. But it is most ﬂexible in adapting various distance function. and will be discussed at length in this paper. Many algorithms from these category are modiﬁed implementation of DP algorithms. we model the problem as nondeterministic ﬁnite automaton(NFA). we will assume that all operations cost 1. To simplify analysis. delete. Strict string matching algorithms are faster than approximate string matching algorithms. that a text position does not match. Bit-parallelism These algorithms exploite parallelism of computer. 3. Dynamic programming This is the oldest method for ﬁnding edit distance. that cannot contain match.we have to perform in converting one string to another. 4 Dynamic programming(DP) This is the oldest method for calculating edit distance. Filters Filtering is based on the fact that it may be easier to tell. 3. and substitute changes state of system. Operations like insert. That’s why lot of methods assign equal weights to all operations. These algorithms also use strict string matching. In this area. 4. Good worst case time algorithms are generally diﬃcult to implement. unless and untill it is speciﬁed. one having good average case time and good worst case time complexities. Good avgerage case time algorithms are simple and mostly work out pretty well.1 The General Method [9] This is the most common method for ﬁnding similarity between two strings. 4. there are two ﬂavours of algorithms.

y) Di. B) denotes distance between two strings.i into y1. Clearly i (respectively j ) deletions are needed on the nonempty string. A) D(A..0 and D0. β) represent cost of transformation. Here we can see that to calculate whole matrix we need |x||y| operations..i to T1. For two nonempty strings of length i and j . Di−1. First.j−1 ) (1) The rationale behind formula1 is as follows. B) ≥ 0 D(A.. Given text string is duddddu and pattern string dudddU . 0 1 2 3 4 5 6 d 0 0 1 2 3 4 5 u 0 1 0 1 2 3 4 d 0 0 1 0 1 2 3 d 0 0 1 1 0 1 2 d 0 0 1 1 1 0 1 d 0 0 1 1 1 1 1 u 0 1 0 1 2 2 2 d u d d d U Table 1: Dynamic programming 5 . Here D should have following properties[6].e.j .j .j represent minimum number of operations needed to match P1.j = 0 Di..Computing edit distance Let w(α. Let D(A.. Lets deﬁne D|x|..j−1 else 1 + min(Di−1. we assume inductively that all the edit distances between shorter strings have already been computed.j−1 ..j . i.. Example Lets assume that all cost of all operations are same and equal to one.|y| = ed(x.j = if (xi = yj ) then Di−1. Di. C) + D(C. A and B.0 = i D−1. D(A. and try to convert x1. B) The matrix Di. D i. cost of opearation to transform from α to β. B) = D(B.j represent the edit distance between a string of length i or j and the empty string. Space complexity can be reduced to O(m) as we need only one column at a time. B) ≤ D(A.

Time complexity Space complexity O(mn) O(m) 4. Ld+1.e−1 .e +d 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: for 0 ≤ d ≤ n + 1 do Set Ld. we have to calculate those many terms. that error along diagonal of matrix is monotonically nondecreasing.e−1 + 1.T 6 .e and any text substring ending at TLd.e. Suﬃx tree can be used to calculate this[11]. concat P. As there are m ∗ n entries in table.|d−1| = |d − 1| end for for e = 0 to k do for d = −e to n do Set maxRow = max (Ld−1.n = e. only left column is used for calculation of new column. that complexity is O(kn). Diagonal transition algorithms are based on the fact. Let Diagonal matrix be L and Normal matrix be D.2 Landau and Vishkin(LV) [5] This is diagonal transition algorithm. Internal nodes represent common substring under that node. We will construct diagonal di against number of diﬀerences as matrix L. and d is diagonal index and e is an error(number of diﬀerences).e end for if Ld. Ld.|d−2| = −∞ Set Ld. Suﬃx tree is a datastructre.m end if end for Figure 2: Landau Vishkin Algorithm From ﬁgure 2 we can infer.The complexity of algorithm can be calculated by looking at table1. Assign this length to Ld. In this tree.e = m then Match found at td. This gives us space complexity of O(m). provided length of diagonal can be calculated in constant time.e−1 + 1) Calculate length of diagonal having constant error e. L d. This method computes edit distance(D) matrix using diagonals. which represents string in a tree format.e denotes the largest row such that Dm.T (i.−1 = −1 end for for −(k + B1) ≤ d ≤ −1 do Set Ld. Leaf node represent suﬃx of the string. Here we will calculate suﬃx tree for P. out degree of any internal node is more than one. This represents number of diﬀerences between P 1···Ld. After looking at equation 1 we can ﬁnd out that.

e−insertCost .e−deleteCost + 1) Time complexity Space complexity O(kn) O(n) 4. 1: Set S1 = 1 {Sj denotes beginning of j th common subsequence} 2: for Each j > 0 do 3: Sj+1 = Sj + M (T. 2.P ) i can be calculated using suﬃx tree. P )Sj + 1 {The (j + 1)st start position is calculated by 4: if Sj+k+2 − Sj ≥ m − k then 5: Apply Landau-Vishkin algorithm to T [Sj · · · Sj+k+2 − 1] 6: end if 7: end for (2) taking maximum jump at Sj plus one more letter } Figure 3: Linear expected time algorithm Next we have to show that probability of having to work at S j is small. maxRow = max(Ld−1. and length of common substring could be found in constant time. which runs in O(n) expected time. T is uniformly distrubuted random string of length n over a ﬁnite alphabet. beginning at position i of text T . provided 1.strings. and b is alphabet size Let us say that M (T. Diﬀerent weights can be assinged to each operation by changing the way we calculate Ld. M (T.e−replaceCost + 1. Lemma For some chosen c1 and c2 .1 Extension to LV algorithm[Chang and Lawler] [1] Linear expected time algorithm Here is an algorithm(Figure 3). c2 are constants.e .3. Doing this will put all common substring in internal nodes.). P [Sk∗ +3 − S1 ≥ m − k ∗ ] ≤ 1/m3 7 . P )i . denotes length of longest substring of pattern P . Ld. k is smaller than k ∗ = m/(logb m + c1 ) − c2 where c1 .3 4. Ld+1.

d. will give slightly smaller ci ). k ∗ +2 ∗ +3 − S1 = Sk j=1 Xj .Proof For this proof. Let T [p. Note that the Xj ’s are i. 2 for c2 > 3 k∗ For any c2 > 2 (4) (5) P [X1 + X2 + · · · + Xk+2 > m − k ∗ ] = P [Y1 + Y2 + · · · + Yk+2 ≥ 0] ≤ E[etY1 ]k ∗ +2 (6) For any d ≥ 0 P [Yi = lg(m) + d + (m − k ∗ )/(k ∗ + 2)] < 2−d 8 . Let Xj be the random variable Sj+1 − Sj . E[D] < 2 as P [D = d] < 2−d . Let D be the random variable taking value d For all d > 0 P [X1 = lg(m) + d] < 2−d E[X1 ] = E[lg(m) + D] = lg(m) ∗ 1 + E[D] < lg(m) + 2 In equation 3. · · · . Let us deﬁne Yi = X i − m +2 m + c2 m − k∗ k∗ + 2 (3) k∗ > Yi = X i − < Xi − lg(m) − 2 This implies that E[Yi ] < 0 m k∗ + ∗ k ∗ + c2 k + c2 m +1 < Xi − ∗ k + c2 < Xi − lg(m) − c2 + 1 from Eq.i. p + d − 1] matches with pattern P . Now we will derive P[X1 + · · · + Xk∗ +2 > m − k ∗ ]. There are m diﬀerent words of length lgm+d out of m2 d diﬀerent possible strings. we will assume that b = 2( b > 2.

1 Other DP Algorithms Hariharan : a simpler faster algorithm [2] This is good worst case time algorithm and the fastest algorithm till date. From this we can infer that. value of equation will be less than 1/m3 . If p is beyond that R then use LV algorithm to a stretch beginning (m + 3k)/2 letters to the left of region and ednding at position p. This is applicable to all Sj s. then it has to contain one complete region. This algorithm can give better performance for longer pattern lenght (> 5k 3 ). 5 5. It uses ﬁltering approach. If position of p is within same region R then there can be no match. but for smaller pattern length it’s better to use LV algorithm.E[e tY1 ] < ∞ d=0 etlg(m)+td−t(m−k ∗ )/(k ∗ +2) 2−d < e Now select t = loge 2 2 Y1 tlg(m)−t(m−k ∗ )/(k ∗ +2) ∞ d=0 etd . provided k < k ∗ /2 − 3. If pattern matches with substring of text. ending at some point p. The only problem is that. Hence total work done will be O(n).6−c1 )(k (7) if we put c1 = 4. 4. we will calculate k + 1 jumps(S k+1 ). c2 = 8 in equation(7).6. Expected time of this algorithm can be calculated by dividing (m − k ∗ ) and (k ∗ + 2) by 2 everywhere in above proof. Time Complexity O((n/m)klogb m) expected time.2−d < 2 E[e ] Y1 k ∗ +2 ∗ 1 (m− m−k 2 k∗ +2 ) 2−d/2 < 2 d=0 ((k ∗ +2)m−(m−k ∗ )+3.2 SubLinear expected time algorithm [1] We can get sublinear expected time.2−d E[e ] < e t(lg(m)−(m−k ∗ )/(k ∗ +2)) ∞ ∞ d=0 ed/2∗loge 2 . Starting from left of each region R.6(k ∗ +2))/2 ∗ +2)−(c 2 −2)(c1 +lg(m))/2 < 2(4. 9 .3. We will be partitioning text into regions of (m−k)/2. And if pattern is periodic and non-periodic then it has got diﬀerent complexities. expected work done at start position S 1 is O(1). it is complex with many restrictions.

Each algorithm is discarding some unimportant information. Σ = 5. when strings are small in length and we want to experiment with weights assigned to operations.6. Here we have improved average case time. Lindau-Vishkin algorithm is a major break-through in ﬁeld of dynamic programming. In these algorithms operation costs are ﬁxed and can’t be changed easily. and works in time O(kn). 5. 10 . If both halfs are absent then there is no way that we can get a match with one error. as most of pattern will be of this length.0.2 5. But if pattern length is less than this(example size=32). but worst case time remain same. k = 3. Levenshtein distance is the most basic and more ﬂexible in term of assigning weights. System having more alphabets needs lesser value of m. This algorithm will be very useful in long pattern matching. Now the obvious thing is that we lost the ﬂexibility of assigning any ramdom weight to any operation.2 Bit-Parallism [11][6] These algorithms exploite power of processor to process bits in parallel. then we can search for either half part of pattern string. Filtering method reduces search space by discarding substrings where we can’t get a match.5. Expected linear time algorithms will be useful only when pattern size is large enough.1 Other promising methods Filtering Method [9] Filtering is based on the fact that. so time complexity reduces drastically. e.2.2. Restriction on pattern length is not a problem as such.g. But if we are sticking to same operation cost for every operation then these algorithms are certainly better and faster than their DP equivalent algorithms. and we can skip that region. as that of LV algorithm(O(kn)). so it may not be useful while comparing long melody and query strings. c2 = 8. It is faster than previous one. we need pattern length to be more than 32 characters. Deciding right value of k is very important in this algorithm. The time complexity of this algorithm is O(mn). for c1 = 4. It works on monotonically non-decreasing errorlevel along diagonal. For example if we have to ﬁnd a match with one error. Most ﬁltering method takes advantage of exact string matching algorithms as those are faster than approximate string matching. it may be easier to tell that strings do not match than to tell strings matches. 6 Conclusion We saw three major algorithms. This algorithm is surely better. this algorithm will boil down to LV.

University of Helsinki. Approximate string matching in sublinear time. Society for Industrial and Applied Mathematics. Computer science division. lawler. U. Department of Electrical Engineering. and Ronald L. Anand Raju and Preeti Rao. A guided tour to approximate string matching. Technical report. pages 463–472. IIT. Approximate string matching: a simpler faster algorithm. 2001. Journal of the ACM (JACM). [2] Richard Cole and Ramesh Hariharan. 46(3):395–415. Landau Uzi Vishkin. Journal of Algorithms. 2002. Department of Electrical Engineering. Landau and U. Vishkin. Tansen: A query-byhumming based music retrieval system. [9] Gonzalo Navarro. [10] Anand Raju and Preeti Rao. [7] Bharat Sundaram M. Technical report. Strand. A fast bit-vector algorithm for approximate string matching based on dynamic programming. King s College London. Monophonic transcription with autocorrelation. 1986. Technical report. Department of Electronic Engineering. 1999. Lemstr¨m.L. 11 . [6] K. [4] Mark Sandler Giuliano Monti. PhD o thesis.References [1] Willam Chang and E. Leiserson. Department of Computer Science. [3] Thomas H. Cambridge. M.Berkeley. 1989. Technical report. Bombay. In Proceedings of the ninth annual ACMSIAM symposium on Discrete algorithms. London WC2R 2LS.C. Introduction to Algorithms. Faculty of Science. 2000. Charles E. Cormen. Fast parallel and serial approximate string matching. [11] Gad M. Building a melody retrieval system. 1999. [8] Gene Myers. String Matching Techniques for Music Retrieval. 1990. [5] G. ACM Computing Surveys (CSUR). 2003. 10(2):157–169. 1997. 33(1):31–88. Tel Aviv University. Technical report. Rivest. The MIT press. IIT. UK. Bombay. Massachusetts. 1998. Introducing eﬃcient parallelism into approximate string matching and a new serial algorithm.

- 1022.pdf
- CONTENT BASED INDEXING OF MUSIC OBJECTS USING APPROXIMATE SEQUENTIAL PATTERNS
- A Music Recommendation System Based on Semantic Audio Segments Similarity
- Music Theory Performance Analysis
- 10.1.1.2
- Rumblesan Patch-A-Day - Data Structures
- KSP Reference Manual
- Thoughts on Parallel Computing for Music
- An Efficient Approach to Solve Sudoku Problem by Harmony Search Algorithm
- React Able
- Williams Interactionparticipation
- Hyper Cyclic Userguide
- Skanner XT Manual English
- Synthix User Manual
- Sample Mapping
- Groove_Agent_SE.pdf
- Addictive Drums 2 Manual
- Fracture User Guide
- AIR Virtual Instruments
- Nexus 2 Manual English
- Vminion v1 0 Manual
- Intro to Max5b
- Phrazor
- 241027152
- Chord Geometries
- 6690____gseng0100

Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

We've moved you to where you read on your other device.

Get the full title to continue

Get the full title to continue listening from where you left off, or restart the preview.

scribd