1 / 61

Song Classification for Dancing

Song Classification for Dancing. Manolis Cristodoukalis, Costas Iliopoulos, M. Sohel Rahman, W.F. Smyth. 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}.

ridder
Download Presentation

Song Classification for Dancing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. 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} PSC 2006

  3. Example – Pattern matching Pattern P = AAGCTA Text T = CAAGCTAAGCTAC A A G C T A Pattern A A G C T A 1 2 3 4 5 6 7 8 9 10 11 12 13 Text C A A G C T A A G C T A C Occ(P) = {2, 7} PSC 2006

  4. Our Case • Input: • Text A musical Sequence • Pattern Rhythm • Output: • Slightly different from Classical PM • A ‘extended/modified’ notion of PM PSC 2006

  5. 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! PSC 2006

  6. 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 PSC 2006

  7. 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 PSC 2006

  8. 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… PSC 2006

  9. 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 theevents! PSC 2006

  10. Musical Sequence First Representation 0 50 100 200 250 300 350 450 500 550 50 Duration of First Event = 50 – 0 = 50 PSC 2006

  11. Musical Sequence First Representation 0 50 100 200 250 300 350 450 500 550 50 50 Duration of Second Event = 100 – 50 = 50 PSC 2006

  12. Musical Sequence First Representation 0 50 100 200 250 300 350 450 500 550 50 50 100 Duration of Second Event = 200 – 100 = 100 PSC 2006

  13. Musical Sequence First Representation 0 50 100 200 250 300 350 400 500 550 50 50 100 50 50 50 50 100 50 Alternative Representation PSC 2006

  14. 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 PSC 2006

  15. 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 PSC 2006

  16. New Notion of Match Let q = 150 1 2 3 4 5 6 7 8 9 50 50 100 50 50 50 50 100 50 Q 50+100 = 150 = q PSC 2006

  17. New Notion of Match Let q = 150 1 2 3 4 5 6 7 8 9 50 50 100 50 50 50 50 100 50 Q Q 100 + 50 = 150 = q PSC 2006

  18. New Notion of Match Let q = 150 1 2 3 4 5 6 7 8 9 50 50 100 50 50 50 50 100 50 Q Q Q Q Q Q PSC 2006

  19. New Notion of Match Let q = 100 1 2 3 4 5 6 7 8 9 50 50 100 50 50 50 50 100 50 Q Q Q Q Q Q Solid Match PSC 2006

  20. 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  i1  i’ such that • q = t[i] + t[i+1] + … + t[i1] = t[i1+1] + t[i+1] + … + t[i’] • 1  i  i’  n • So, S is either solid or a tile of 2 consecutive Q’s PSC 2006

  21. New Notion of Match Let q = 100, then S  2q = 200 1 2 3 4 5 6 7 8 9 50 50 100 50 50 50 50 100 50 S t[1] + t[2] = 100 = t[3] PSC 2006

  22. New Notion of Match Let q = 100, then S  2q = 200 1 2 3 4 5 6 7 8 9 50 50 100 50 50 50 50 100 50 S S t[4] + t[5] = 100 = t[6] + t[7] PSC 2006

  23. New Notion of Match Let q = 100, then S  2q = 200 1 2 3 4 5 6 7 8 9 50 50 100 50 50 50 50 100 50 S S S S PSC 2006

  24. New Notion of Match Let q = 100, then S  2q = 200 1 2 3 4 5 6 7 8 9 50 50 100 50 50 50 50 100 50 S S S S S Although, t[2] + t[3] + t[4] = 200 = 2q PSC 2006

  25. New Notion of Match Let q = 100, then S  2q = 200 1 2 3 4 5 6 7 8 9 50 50 100 50 50 50 50 100 50 S S S S S S PSC 2006

  26. New Notion of Match Let r = QSS and Let q = 50 1 2 3 4 5 6 7 8 9 50 50 100 50 50 50 50 100 50 Q S S r r matches t[2..5] PSC 2006

  27. New Notion of Match Let r = QSS and Let q = 50 1 2 3 4 5 6 7 8 9 Q S 50 50 100 50 50 50 50 100 50 S Q S S r r r matches t[5..8] PSC 2006

  28. New Notion of Match Let r = QSS and Let q = 50 1 2 3 4 5 6 7 8 9 Q S 50 50 100 50 50 50 50 100 50 S Q S S r r r covers t[2..8] PSC 2006

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

  30. Restriction • For each match of r, at least one S must be solid Let r = QSS and Let q = 50 1 2 3 4 5 6 7 8 9 r 50 50 100 50 50 50 50 50 100 Q S S SOLID S PSC 2006

  31. Restriction • For each match of r, at least one S must be solid Let r = QSS and Let q = 50 1 2 3 4 5 6 7 8 9 r 50 50 100 50 50 50 50 50 100 Q S S r At least one S must be Solid PSC 2006

  32. Restriction • For each match of r, at least one S must be solid Let r = QSS and Let q = 50 1 2 3 4 5 6 7 8 9 r 50 50 100 50 50 50 50 50 100 Q S SOLID S S At least one S must be Solid r PSC 2006

  33. Motivation • Our aim is to classify music according to dancing rhythm • Music seq can be considered as a series of events corresponding to music signals • Drum beats • Guiter picks • Horn hits PSC 2006

  34. Motivation • The intervals between these events characterize how the song is danced • Basically two dancing rhythms: Quick & Slow • Example: • cha-cha  SSQQSSSQQS • foxtrot  SSQQSSQQ • jive  SSQQSQQS PSC 2006

  35. Motivation • So solution to our problem can classify songs according to dancing rhythms! PSC 2006

  36. 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 consequently the cover. PSC 2006

  37. Algorithm: Stage 1 • We construct two arrays: • first[1..||]: first[] = i iff the first occurrence of symbol  appears at position i. • next[1..n]: next[i] = j iff the next occurrence of symbol at t[i] appears at t[j]. PSC 2006

  38. Algorithm: Stage 1 1 2 3 4 5 6 7 8 9 50 50 100 50 50 50 50 100 50  = {50, 100}, assume indexed alphabet PSC 2006

  39. Algorithm: Stage 1 1 2 3 4 5 6 7 8 9 50 50 100 50 50 50 50 100 50  = {50, 100}, assume indexed alphabet First occurrence of 50 first[1] = 1 PSC 2006

  40. Algorithm: Stage 1 1 2 3 4 5 6 7 8 9 50 50 100 50 50 50 50 100 50  = {50, 100}, assume indexed alphabet first[1] = 1 first[2] = 3 First occurrence of 100 PSC 2006

  41. Algorithm: Stage 1 1 2 3 4 5 6 7 8 9 50 50 100 50 50 50 50 100 50 next[1] = 2 Next occurrence of t[1] = 50 PSC 2006

  42. Algorithm: Stage 1 1 2 3 4 5 6 7 8 9 50 50 100 50 50 50 50 100 50 next[1] = 2 next[2] = 4 Next occurrence of t[2] = 50 PSC 2006

  43. Algorithm: Stage 1 1 2 3 4 5 6 7 8 9 50 50 100 50 50 50 50 100 50 next[1] = 2 next[2] = 4 next[3] = 8 Next occurrence of t[3] = 100 And so on… PSC 2006

  44. Algorithm: Stage 2 1 2 3 4 5 6 7 8 9 10 11 … 100 50 25 25 100 50 15 30 5 30 50 … S Consider an S at t[5]. PSC 2006

  45. Algorithm: Stage 2 1 2 3 4 5 6 7 8 9 10 11 … 100 50 25 25 100 50 15 30 5 30 50 … S Q PSC 2006

  46. Algorithm: Stage 2 1 2 3 4 5 6 7 8 9 10 11 … 100 50 25 25 100 50 15 30 5 30 50 … S Q Q PSC 2006

  47. Algorithm: Stage 2 1 2 3 4 5 6 7 8 9 10 11 … 100 50 25 25 100 50 15 30 5 30 50 … S 30+50 > 50 Q Q So Stop! PSC 2006

  48. Algorithm: Stage 2 1 2 3 4 5 6 7 8 9 10 11 … 100 50 25 25 100 50 15 30 5 30 50 … S Q Q Q PSC 2006

  49. Algorithm: Stage 2 1 2 3 4 5 6 7 8 9 10 11 … 100 50 25 25 100 50 15 30 5 30 50 … Q S Q Q Q So we get a new sequence t consisting of Q and S PSC 2006

  50. Algorithm: Stage 3 • Here we get t consisting of Q and S. • We first want to find the matches of r in t. • Define St  S in t, Qt  Q in t • Define Sr  S in r, Qr  Q in r PSC 2006

More Related