Presentation is loading. Please wait.

Presentation is loading. Please wait.

28 Aug, 2006PSC 20061 Song Classification for Dancing Manolis Cristodoukalis, Costas Iliopoulos, M. Sohel Rahman, W.F. Smyth.

Similar presentations


Presentation on theme: "28 Aug, 2006PSC 20061 Song Classification for Dancing Manolis Cristodoukalis, Costas Iliopoulos, M. Sohel Rahman, W.F. Smyth."— Presentation transcript:

1 28 Aug, 2006PSC 20061 Song Classification for Dancing Manolis Cristodoukalis, Costas Iliopoulos, M. Sohel Rahman, W.F. Smyth

2 28 Aug, 2006PSC 20062 Classical Pattern Matching Input: A text T = T[1..n], A Pattern P = P[1..m], both over the alphabet . Output: Whether P occurs in T If yes, then the set occ(P) = {i | T[i..i+m-1 ] = P}

3 28 Aug, 2006PSC 20063 Example – Pattern matching 11091123456781213 AAGCTA Pattern Text Pattern P = AAGCTA Text T = CAAGCTAAGCTAC CCGTAAGCTAAAC AAGCTA Occ(P) = {2, 7}

4 28 Aug, 2006PSC 20064 Our Case Input: TextA musical Sequence PatternRhythm Output: Slightly different from Classical PM A ‘extended/modified’ notion of PM

5 28 Aug, 2006PSC 20065 Musical Sequence A string t = t[1]t[2]…t[n] t[i]   N + Example: [0,50,100,200,250,300,350,400,500,550] Significance: Sequence of events!

6 28 Aug, 2006PSC 20066 Musical Sequence A string t = t[1]t[2]…t[n] t[i]   N + Example: [0,50,100,200,250,300,350,400,500,550] Some (musical) event occurs at 0 ms

7 28 Aug, 2006PSC 20067 Musical Sequence A string t = t[1]t[2]…t[n] t[i]   N + Example: [0,50,100,200,250,300,350,400,500,550] Some (musical) event occurs at 0 ms Some (musical) event occurs at 50 ms

8 28 Aug, 2006PSC 20068 Musical Sequence A string t = t[1]t[2]…t[n] t[i]   N + Example: [0,50,100,200,250,300,350,400,500,550] Some (musical) event occurs at 0 ms Some (musical) event occurs at 50 ms Some (musical) event occurs at 100 ms And so on…

9 28 Aug, 2006PSC 20069 Musical Sequence [0,50,100,200,250,300,350,400,500,550] Alternative Representation (We use) [50,50,100,50,50,50,50,100,50] Significance: Sequence of “duration” of the events!

10 28 Aug, 2006PSC 200610 Musical Sequence 050100200250300350450500550 First Representation Duration of First Event = 50 – 0 = 50 50

11 28 Aug, 2006PSC 200611 Musical Sequence 050100200250300350450500550 First Representation Duration of Second Event = 100 – 50 = 50 50

12 28 Aug, 2006PSC 200612 Musical Sequence 050100200250300350450500550 First Representation Duration of Second Event = 200 – 100 = 100 50 100

13 28 Aug, 2006PSC 200613 Musical Sequence 050100200250300350400500550 First Representation 50 10050 10050 Alternative Representation

14 28 Aug, 2006PSC 200614 Rhythm A string r = r[1]r[2]…r[m] r[j]  {Q, S} Q means a quick(er) event S means a slow(er) event S is double the length (duration) of Q Exact length of Q or S is not a priori known

15 28 Aug, 2006PSC 200615 New Notion of Match Let Q  q  N + Then S  2  q Q matches t[i..i’] iff q = t[i] + t[i+1] + … + t[i’] 1  i  i’  n If i = i’ then the match is SOLID

16 28 Aug, 2006PSC 200616 New Notion of Match 50 10050 10050 Let q = 150 50+100 = 150 = q 123456789 Q

17 28 Aug, 2006PSC 200617 New Notion of Match 50 10050 10050 Let q = 150 100 + 50 = 150 = q 123456789 Q Q

18 28 Aug, 2006PSC 200618 New Notion of Match 50 10050 10050 Let q = 150 123456789 Q Q Q Q Q Q

19 28 Aug, 2006PSC 200619 New Notion of Match 50 10050 10050 Let q = 100 123456789 Q Q Q Q Q Q Solid Match

20 28 Aug, 2006PSC 200620 New Notion of Match S  2  q S matches t[i..i’] iff either of following is true: i = i’ and t[i] = 2q (SOLID) i  i’ and there exists i  i 1  i’ such that q = t[i] + t[i+1] + … + t[i 1 ] = t[i 1 +1] + t[i+1] + … + t[i’] 1  i  i’  n So, S is either solid or a tile of 2 consec utive Q’s

21 28 Aug, 2006PSC 200621 New Notion of Match 50 10050 10050 Let q = 100, then S  2q = 200 t[1] + t[2] = 100 = t[3] 123456789 S

22 28 Aug, 2006PSC 200622 New Notion of Match 50 10050 10050 Let q = 100, then S  2q = 200 t[4] + t[5] = 100 = t[6] + t[7] 123456789 S S

23 28 Aug, 2006PSC 200623 New Notion of Match 50 10050 10050 Let q = 100, then S  2q = 200 123456789 S S S S

24 28 Aug, 2006PSC 200624 New Notion of Match 50 10050 10050 Let q = 100, then S  2q = 200 123456789 S S SS Although, t[2] + t[3] + t[4] = 200 = 2q S

25 28 Aug, 2006PSC 200625 New Notion of Match 50 10050 10050 Let q = 100, then S  2q = 200 123456789 S S S S S S

26 28 Aug, 2006PSC 200626 New Notion of Match 50 10050 10050 Let r = QSS and Let q = 50 123456789 Q S S r r matches t[2..5]

27 28 Aug, 2006PSC 200627 New Notion of Match 50 10050 10050 Let r = QSS and Let q = 50 123456789 Q S S r r Q S S r matches t[5..8]

28 28 Aug, 2006PSC 200628 New Notion of Match 50 10050 10050 Let r = QSS and Let q = 50 123456789 Q S S r r r covers t[2..8] Q S S

29 28 Aug, 2006PSC 200629 Our Problem Input: A musical Sequence t A rhythm r Output: The longest substring t[i..i’] that is covered by r

30 28 Aug, 2006PSC 200630 Restriction For each match of r, at least one S mus t be solid 50 10050 100 Let r = QSS and Let q = 50 123456789 Q S r S SOLID S

31 28 Aug, 2006PSC 200631 Restriction For each match of r, at least one S mus t be solid 50 10050 100 Let r = QSS and Let q = 50 123456789 r Q S r S At least one S must be Solid

32 28 Aug, 2006PSC 200632 Restriction For each match of r, at least one S mus t be solid 50 10050 100 Let r = QSS and Let q = 50 123456789 r Q S r S At least one S must be Solid SOLID S

33 28 Aug, 2006PSC 200633 Motivation Our aim is to classify music according to dancing rhythm Music seq can be considered as a series of events corresponding to music signal s Drum beats Guiter picks Horn hits

34 28 Aug, 2006PSC 200634 Motivation The intervals between these events cha racterize how the song is danced Basically two dancing rhythms: Quick & Slow Example: cha-cha  SSQQSSSQQS foxtrot  SSQQSSQQ jive  SSQQSQQS

35 28 Aug, 2006PSC 200635 Motivation So solution to our problem can classify songs according to dancing rhythms!

36 28 Aug, 2006PSC 200636 Algorithm Stage 1: Find all occurrences of S for a chosen value    such that  /2  . Stage 2: Transform areas around each S into sequences of Q. Stage 3: Find the matches of r and cons equently the cover.

37 28 Aug, 2006PSC 200637 Algorithm: Stage 1 We construct two arrays: first[1..|  |]: first[  ] = i iff the first occurre nce of symbol  appears at position i. next[1..n]: next[i] = j iff the next occurren ce of symbol at t[i] appears at t[j].

38 28 Aug, 2006PSC 200638 Algorithm: Stage 1 50 10050 10050 123456789  = {50, 100}, assume indexed alphabet

39 28 Aug, 2006PSC 200639 Algorithm: Stage 1 50 10050 10050 123456789  = {50, 100}, assume indexed alphabet first[1] = 1 First occurrence of 50

40 28 Aug, 2006PSC 200640 Algorithm: Stage 1 50 10050 10050 123456789  = {50, 100}, assume indexed alphabet first[1] = 1 first[2] = 3First occurrence of 100

41 28 Aug, 2006PSC 200641 Algorithm: Stage 1 50 10050 10050 123456789 next[1] = 2Next occurrence of t[1] = 50

42 28 Aug, 2006PSC 200642 Algorithm: Stage 1 50 10050 10050 123456789 next[1] = 2next[2] = 4Next occurrence of t[2] = 50

43 28 Aug, 2006PSC 200643 Algorithm: Stage 1 50 10050 10050 123456789 next[1] = 2 next[3] = 8 next[2] = 4 Next occurrence of t[3] = 100 And so on …

44 28 Aug, 2006PSC 200644 Algorithm: Stage 2 1005025 1005015305 123456789 50 … 1011 … S Consider an S at t[5].

45 28 Aug, 2006PSC 200645 Algorithm: Stage 2 1005025 1005015305 123456789 50 … 1011 … S Q

46 28 Aug, 2006PSC 200646 Algorithm: Stage 2 1005025 1005015305 123456789 50 … 1011 … S Q Q

47 28 Aug, 2006PSC 200647 Algorithm: Stage 2 1005025 1005015305 123456789 50 … 1011 … S Q Q 30+50 > 50 So Stop!

48 28 Aug, 2006PSC 200648 Algorithm: Stage 2 1005025 1005015305 123456789 50 … 1011 … S Q Q Q

49 28 Aug, 2006PSC 200649 Algorithm: Stage 2 1005025 1005015305 123456789 50 … 1011 … S Q Q Q Q So we get a new sequence t consisting of Q and S

50 28 Aug, 2006PSC 200650 Algorithm: Stage 3 Here we get t consisting of Q and S. We first want to find the matches of r in t. Define S t  S in t, Q t  Q in t Define S r  S in r, Q r  Q in r

51 28 Aug, 2006PSC 200651 Algorithm: Stage 3 Construct t  as follows: S t = 01, Q t = 1 Construct Invalid set I where I contains the position of 1 due to S t. QQSQQ 11 0 1 1 1

52 28 Aug, 2006PSC 200652 Algorithm: Stage 3 Construct t  as follows: S t = 01, Q t = 1 Construct Invalid set I where I contains the position of 1 due to S t. QQSQQ 110111 123564 No match can occur at position 4 because it is not a ‘ real ’ position in t I = {4} 12354

53 28 Aug, 2006PSC 200653 Algorithm: Stage 3 Construct r as follows: S r = 10, Q r = 0 SQ 1 0 0

54 28 Aug, 2006PSC 200654 Algorithm: Stage 3 Construct r as follows: S r = 10, Q r = 0 SQ 100 123

55 28 Aug, 2006PSC 200655 Algorithm: Stage 3 Find matches of r’ in t’’. Perform bitwise or at each position. If the result is all 1 and the position is not i n invalid set then a match Otherwise no match

56 28 Aug, 2006PSC 200656 Algorithm: Stage 3 Find matches of r’ in t’’. 110111 123564 100 Bitwise Or 110 No Match!!! I = {4}

57 28 Aug, 2006PSC 200657 Algorithm: Stage 3 Find matches of r’ in t’’. 110111 123564 100 Bitwise Or 100 No Match!!! I = {4}

58 28 Aug, 2006PSC 200658 Algorithm: Stage 3 Find matches of r’ in t’’. 110111 123564 100 Bitwise Or 111 All 1 ’ s!!! And 3  I. So a MATCH!!! I = {4}

59 28 Aug, 2006PSC 200659 Algorithm: Stage 3 Find matches of r’ in t’’. 110111 123564 100 Bitwise Or 111 All 1 ’ s!!! But, 4  I. So NO MATCH!!! I = {4}

60 28 Aug, 2006PSC 200660 Algortihm In this way we can find the matches & then we can easily compute the cover

61 28 Aug, 2006PSC 200661 Conclusion In practical cases size of the rhuthm is 10  13. So we have assumed m to be constant. It would be interesting, however, to remove t he dependency on m It would be interesting to remove the restricti on of one S being Solid Applying another restriction on the number of additions in the numeric text may turn out to be useful


Download ppt "28 Aug, 2006PSC 20061 Song Classification for Dancing Manolis Cristodoukalis, Costas Iliopoulos, M. Sohel Rahman, W.F. Smyth."

Similar presentations


Ads by Google