AMATH 482 Homework 4 Music Classification solved

Original price was: $30.00.Current price is: $25.00.



5/5 - (1 vote)

Music Classification

Music genres are instantly recognizable to us, wether it be jazz, classical, blues, rap, rock, etc. One
can always ask how the brain classifies such information and how it makes a decision based upon
hearing a new piece of music.

The objective of this homework is to attempt to write a code that can
classify a given piece of music by sampling a 5 second clip.
As an example, consider Fig. 1. Four classic pieces of music are demonstrated spanning genres
of rap, jazz, classic rock and classical.

Specifically, a 3-second sample is given of Dr. Dre’s Nuthin’
but a ’G’ thang (The Chronic), John Coltrane’s A Love Supreme (A Love Supreme), Led Zeppelin’s
Over The Hills and Far Away (Houses of the Holy), and Mozart’s Kyrie (Requiem).

Each has a
different signature, thus begging the question wether a computer could distinguish between genres
based upon such a characterization of the music.
2 2.5 3 3.5 4 4.5 5
2 2.5 3 3.5 4 4.5 5

2 2.5 3 3.5 4 4.5 5
2 2.5 3 3.5 4 4.5 5
time (seconds)

Figure 1: Instantly recognizable, these four pieces of music are (in order of top to bottom): Dr.
Dre’s Nuthin’ but a ’G’ thang (The Chronic), John Coltrane’s A Love Supreme (A Love Supreme),
Led Zeppelin’s Over The Hills and Far Away (Houses of the Holy), and Mozart’s Kyrie (Requiem).
Illustrated is a 3-second clip from time 2 seconds to 5 seconds of each of these songs.

• (test 1) Band Classification: Consider three different bands of your choosing and of different
genres. For instance, one could pick Michael Jackson, Soundgarden, and Beethoven. By taking
5-second clips from a variety of each of their music, i.e. building training sets, see if you can
build a statistical testing algorithm capable of accurately identifying “new” 5-second clips of
music, i.e. a test set, from the three chosen bands. Report your accuracy (success rate) on the
test set.

• (test 2) The Case for Seattle: Repeat the above experiment, but with three bands from
within the same genre. This makes the testing and separation much more challenging. For
instance, one could focus on the late 90s Seattle grunge bands: Soundgarden, Alice in Chains,
and Pearl Jam. What is your accuracy in correctly classifying a 5-second sound clip? Compare
this with the first experiment with bands of different genres.

• (test 3) Genre Classification: One could also use the above algorithms to broadly classify
songs as jazz, rock, classical etc. Choose three genres and build a classifier. In this case, the
training sets should be various bands within each genre. For instance, classic rock bands could
be classified using sounds clips from Led Zepellin, AC/DC, Pink Floyd, etc. while classical
could be classified using Mozart, Beethoven, Bach, etc.


• You will probably want to SVD the spectrogram of songs versus the songs themselves. Interestingly, this will give you the dominant spectrogram modes associated with a given band.
• You may want to re-sample your data (i.e. take every other point or every third or fourth point)
in order to keep the data sizes more manageable. Regardless, you will need lots of processing

• Feel free to collaborate with other students on getting the music for the training/test sets. I’d
encourage you to form groups and split up the work of forming five second clips from different
artists and genres. You can use the Piazza discussion board for forming groups and/or sharing

• As usual, the rest of the assignment should be done individually. You should compute your
own spectrograms and SVDs and build your own algorithm.
• Do NOT post any copyrighted music in publicly available places online (i.e. Github).
• Do NOT illegally download or copy music.

• The following are some ways you might find downloadable music that is free:
– The Youtube audio library has a lot of music that is free.
– There is a lot of music that can be downloaded from Sound Cloud. You may want to try
searching for “Creative Commons.”

– There is also a lot of free music on Free Music Archive. It can even be sorted by genre.
When you click a download link on this website, it brings you to a download page. You can
load the song directly into MATLAB (without downloading the file onto your computer)
by copying the url of the download page and using the MATLAB command
[y,Fs] = webread(‘url’)

– The above sources mostly contain music that has a Creative Commons copyright license.
You can find a lot more music by searching for “Creative Commons License music” in
Google or Youtube.