Finding Repetition Patterns in Songs BRIDGES Team SIGCSE 2019 - - PowerPoint PPT Presentation

finding repetition patterns in songs
SMART_READER_LITE
LIVE PREVIEW

Finding Repetition Patterns in Songs BRIDGES Team SIGCSE 2019 - - PowerPoint PPT Presentation

Finding Repetition Patterns in Songs BRIDGES Team SIGCSE 2019 BRIDGES (SIGCSE 2019) Song Repetitions 1 / 14 Outline Presentation of the Problem and Overview 1 A CS 1 problem 2 Variants and Reflection 3 BRIDGES (SIGCSE 2019) Song


slide-1
SLIDE 1

Finding Repetition Patterns in Songs

BRIDGES Team

SIGCSE 2019

BRIDGES (SIGCSE 2019) Song Repetitions 1 / 14

slide-2
SLIDE 2

Outline

1

Presentation of the Problem and Overview

2

A CS 1 problem

3

Variants and Reflection

BRIDGES (SIGCSE 2019) Song Repetitions 2 / 14

slide-3
SLIDE 3

Visualizing Repetition Patterns in Songs

Algorithm

Pick a song of n words If the i-th word is the same as the j-th

Paint pixel (i, j) black.

Some cases

Daft Punk Harder Faster Better Stronger Queen Radio Gaga Cardi B What a Girl Likes Lin-Manuel Miranda My Shot

BRIDGES (SIGCSE 2019) Song Repetitions 3 / 14

slide-4
SLIDE 4

What does BRIDGES do for you?

Engagement

Students can plug whatever song they want to look for repetition patterns. Something you can show your roommate.

Accessing a Song through BRIDGES (access Genius)

DataSource ds; Song s = ds.getSong(title, author);

ColorGrid usage

ColorGrid grid (10, 10); grid.set(0,0, Color(255,0,0));

BRIDGES (SIGCSE 2019) Song Repetitions 4 / 14

slide-5
SLIDE 5

Outline

1

Presentation of the Problem and Overview

2

A CS 1 problem

3

Variants and Reflection

BRIDGES (SIGCSE 2019) Song Repetitions 5 / 14

slide-6
SLIDE 6

Bird’s eye view of the Song Lyrics assignment

Getting the data

Get data from an API into the program. Topics: API Usage.

Song to Words

Transforming the song into a list of words. Topics: String processing, Tokenization.

Image Basic

Show a basic image. Topics: Understand images as a 2D set of pixels.

Building Repetition

Build a complete image based on word repetition. Topics: String comparison, for loops, if statement.

BRIDGES (SIGCSE 2019) Song Repetitions 6 / 14

slide-7
SLIDE 7

Getting the data (Topics: API Usage.)

Get a Song from an API into the program and print it.

In C++

DataSource ds; Song s = ds.getSong(title, author);

In Java

public static String[][] splitLines(String lyrics) {

In Python

so = get_song("Delicate", "Taylor Swift")

BRIDGES (SIGCSE 2019) Song Repetitions 7 / 14

slide-8
SLIDE 8

Song to Words (Topics: Tokenization, String Processing)

Transform the Song into a array of Words. (Here scaffoldded, but a good exercise in class)

In C++

auto words = lyrics_tokenize(s.getLyrics());

In Java

lyrics = lyrics.trim();

In Python

lyrics = split_lyrics(song)

BRIDGES (SIGCSE 2019) Song Repetitions 8 / 14

slide-9
SLIDE 9

Basic Color Grid (Topics: Image Representation)

Create a ColorGrid and draw anything.

In C++

ColorGrid grid (10, 10); grid.set(0,0, Color(255,0,0)); bridges.setDataStructure(&grid); bridges.visualize();

In Java

ColorGrid grid = new ColorGrid(20, 30); grid.set(12, 12, new Color(0, 0, 0)); bridges.setDataStructure(grid); bridges.visualize();

In Python

grid = ColorGrid(2, 25) grid.set(1,2, Color(255,255,255)) bridges.set_data_structure(grid) bridges.visualize()

BRIDGES (SIGCSE 2019) Song Repetitions 9 / 14

slide-10
SLIDE 10

Build a Repetition Matrix (Topics: String Test, Loops)

Make a ColorGrid of nbword × nbword. If word i and word j are the same strings, color pixel i, j black.

In C++

std::string str1 ("green apple"); std::string str2 ("red apple"); if (str1.compare(str2) == 0) std::cout << "Identical";

In Java

String str1 = "green apple"; String str2 = "red apple"; if (str1.equals(str2)) System.out.println("Identical");

In Python

str1 = "green apple" str2 = "red apple" if (str1 == str2) : print ("Identical")

BRIDGES (SIGCSE 2019) Song Repetitions 10 / 14

slide-11
SLIDE 11

Outline

1

Presentation of the Problem and Overview

2

A CS 1 problem

3

Variants and Reflection

BRIDGES (SIGCSE 2019) Song Repetitions 11 / 14

slide-12
SLIDE 12

Term Frequency-Inverse Document Frequency

Idea

Treat each line of the lyrics as a bag of word Treat a bag of word as a high dimensional vectors Compute distance between vectors

Topics

Basic NLP Data structure: Dictionaries (associative arrays) Basic Data Mining James Brown - I Feel Good

BRIDGES (SIGCSE 2019) Song Repetitions 12 / 14

slide-13
SLIDE 13

Other Image Based Assignments

Artist distance graph

Collate a few song of an artist, get a bag-of-word representation of artists Compute distance between artist Build an graph of artist based on similarity Islanding analysis

Image based problems

Droping the lyrics idea and reading ColorGrid’s back from BRIDGES: Flipping an image Blurring Edge Detection Histogram Equalization

BRIDGES (SIGCSE 2019) Song Repetitions 13 / 14

slide-14
SLIDE 14

Questions from the room?

BRIDGES (SIGCSE 2019) Song Repetitions 14 / 14