In this final version, this project aims to visualize and define similarities between Turkish Pop music. Also, a Shiny web app wil be provided. Since, the initial versions of the code are shared in the previous Rmd file. The same, API related parts, will not be shared again.

Conclusions For The Final Version

The key for hit pop songs: It is observed that Turkish people loves the artists with their variated songs. Musical attributes differ for each of their songs. A title with love works well. Remixes also have a chance. Energy, danceability and valence is common between the hits. G minor and C# Minor is the most common tones for the songs, they may be a good choice. Also, the despair and uneasiness is common as a theme.

The libraries:

For this analysis, the libraries that will be used is documented below:

knitr::opts_chunk$set(echo = TRUE)

options(stringsAsFactors=FALSE)
library(tidyverse)
library(lubridate)
library(ggplot2)
library(spotifyr)
library(ggjoy)
library(reshape)
library(treemap)
library(fmsb)
library(vcd)
library(wordcloud)
library(SnowballC)
library(RColorBrewer)
library(tm)
library(reshape2)

load(file ="C:\\Users\\minas\\OneDrive\\Masaüstü\\shinydata.RData")

Explanation of The Data Set - Data Exploration

In this project, we will be using a dataset that includes 193 rows which are the best 20 Turkish Pop Artists’ best 10 songs. The expected dataframe length is 200. Since all of the artists do not have 10 songs the the expected length couldn’t be reached. The table below represents a small set of data with 20 lines.

The data is gathered from Spotify API.

The data includes:

Extras: (The musical attributes that we have received from Spotify ranges from 0-1 in its original version. For ease of use in plots it is rearranged between 0-100)

top20Artist_songFeatures <-
  top20_info$top_tracks %>% left_join(.,top20_info$artist_info,by="artist_id") %>%
  select(artist_name, album_name, track_name, everything()) %>%
  mutate_at(vars(danceability,energy,speechiness,acousticness,instrumentalness,liveness,valence),list(~.*100)) %>%
  tbl_df()

knitr:: kable(top20Artist_songFeatures %>% slice(1:20))
artist_name album_name track_name artist_id track_id track_popularity album_id duration_ms danceability energy key loudness mode speechiness acousticness instrumentalness liveness valence tempo artist_popularity artist_followers
Tarkan Ölürüm Sana Simarik 2yMN0IP20GOaN6q0p0zL5k 6vEL7E8TGzrxuxbrgdlkLL 61 6ebdbUXZn5AURKeRNXqiay 235218 77.5 81.8 7 -8.687 1 16.40 5.180 0.000000 11.40 82.6 97.060 66 1481877
Tarkan Her Şey Fani (Mahmut Orhan Remix) Her Şey Fani - Mahmut Orhan Remix 2yMN0IP20GOaN6q0p0zL5k 0JHarUsJHcMWbmmIK8i4mw 58 6D7tNjcwXdmaJgFKrYpIuA 310606 69.0 67.9 7 -7.461 0 3.31 28.100 0.000430 17.00 22.9 113.019 66 1481877
Tarkan Karma Ay 2yMN0IP20GOaN6q0p0zL5k 0oVnsgyHclNnGeEb4hRoYO 55 11KfFiHZxXiBoEq52HAsJi 260713 68.5 76.3 11 -6.540 0 8.39 0.443 0.016400 21.70 41.8 90.010 66 1481877
Tarkan Karma Kuzu Kuzu 2yMN0IP20GOaN6q0p0zL5k 3ajYmPDtB3P7JTPQ64Dr7P 55 11KfFiHZxXiBoEq52HAsJi 233639 70.5 88.3 4 -8.351 0 5.08 2.230 0.834000 5.26 73.0 93.909 66 1481877
Tarkan Aacayipsin Kış Güneşi 2yMN0IP20GOaN6q0p0zL5k 1tiIKelgeYVi1KcylVnZdq 54 06EBiLh3V0q2dOUdXnic7e 235171 65.2 70.6 11 -13.407 0 4.36 1.580 0.000000 8.43 89.2 91.024 66 1481877
Tarkan Ölürüm Sana Ölürüm Sana 2yMN0IP20GOaN6q0p0zL5k 6nAgxB5x7vlGVVIoWpCwaM 54 6ebdbUXZn5AURKeRNXqiay 246456 75.3 92.6 9 -8.485 1 10.30 0.718 0.000228 4.07 79.0 92.015 66 1481877
Tarkan 10 Kedi Gibi 2yMN0IP20GOaN6q0p0zL5k 1BfpV5h16V1Gtr41GEF9cO 53 4fJzakARJP2UfOjSj5Q9s1 249006 69.9 89.7 7 -4.477 1 5.85 1.450 0.000405 23.90 56.8 98.028 66 1481877
Tarkan Karma Sen Başkasın 2yMN0IP20GOaN6q0p0zL5k 0ZJKPGKFJQM9riXJ8TOyiO 50 11KfFiHZxXiBoEq52HAsJi 256069 72.9 78.8 10 -8.301 0 7.14 3.520 0.003150 9.69 72.2 91.923 66 1481877
Tarkan Ölürüm Sana Salina Salina Sinsice 2yMN0IP20GOaN6q0p0zL5k 4PGsEvmwfJwNJJcsw9aaav 50 6ebdbUXZn5AURKeRNXqiay 236054 64.9 80.7 3 -9.757 0 13.50 6.130 0.000505 6.48 76.1 171.997 66 1481877
Tarkan 10 Yolla 2yMN0IP20GOaN6q0p0zL5k 1vZAYNFTcxzrnooQUw5zKD 49 4fJzakARJP2UfOjSj5Q9s1 285856 67.6 91.3 7 -5.251 1 5.37 0.422 0.000225 7.52 65.8 120.003 66 1481877
Sezen Aksu Bahane Şanıma İnanma 64d1rUxfizSAOE9UbMnUZd 2aKHw8ukPHrJTwllQBIZSY 56 3bxl6Vvb6z122wXPyvcdmN 235773 70.9 80.0 5 -6.198 0 5.78 28.800 0.000462 14.80 82.8 95.993 68 1998899
Sezen Aksu Düş Bahçeleri Kaçın Kurası 64d1rUxfizSAOE9UbMnUZd 3Qaj6EzdVTzysN50rg2u4p 56 3pCSt4dgNRTTDVI1XO6nqZ 225693 60.9 73.1 0 -6.495 0 32.90 45.500 0.038000 29.30 80.8 158.284 68 1998899
Sezen Aksu Gülümse Her Şeyi Yak 64d1rUxfizSAOE9UbMnUZd 6JTrpXQBPdEII6C0SbXBYo 56 1m07iv4leo4aoqFs60vHCK 314146 57.0 36.6 2 -8.898 0 3.33 82.400 0.001570 29.60 45.4 106.900 68 1998899
Sezen Aksu Düş Bahçeleri Seni Yerler 64d1rUxfizSAOE9UbMnUZd 0seHKl9cX6sRrgO5Ql28b4 55 3pCSt4dgNRTTDVI1XO6nqZ 250306 75.2 81.4 8 -6.787 0 10.30 3.150 0.000264 8.58 76.2 119.026 68 1998899
Sezen Aksu Sen Ağlama Tükeneceğiz 64d1rUxfizSAOE9UbMnUZd 2rP7pI2WpMWcUraYAX2xiT 55 13JKU1RyLFS73hDvWnTHr1 259360 39.5 67.5 1 -5.881 0 4.72 64.900 0.000000 9.63 49.6 177.053 68 1998899
Sezen Aksu Gülümse Vazgeçtim 64d1rUxfizSAOE9UbMnUZd 6Fov2wtS1YVTS3o4sqhgVM 54 1m07iv4leo4aoqFs60vHCK 309906 48.0 21.7 0 -11.520 0 3.80 78.400 0.076900 11.20 18.8 140.601 68 1998899
Sezen Aksu DEMO Begonvil 64d1rUxfizSAOE9UbMnUZd 1JYxCgv4Jlx2X4SYNtXgkB 54 6yYVJKYaBp37t9zJic1dA2 245835 45.0 27.6 8 -5.900 0 4.01 89.200 0.000000 12.90 35.0 89.297 68 1998899
Sezen Aksu Öptüm Vay 64d1rUxfizSAOE9UbMnUZd 64wJJQ7wFtopVHVU3QWVxk 53 1hOFeE5hZYxIO72UKhnrWS 237540 40.4 42.7 11 -9.561 0 3.89 65.900 0.000000 11.30 44.0 120.172 68 1998899
Sezen Aksu Gülümse Seni Kimler Aldı 64d1rUxfizSAOE9UbMnUZd 0o2xtLCzHseeiUMYMGFDcC 53 1m07iv4leo4aoqFs60vHCK 208546 27.2 36.5 9 -8.257 0 2.89 77.400 0.000000 10.90 16.3 92.035 68 1998899
Sezen Aksu DEMO Anlasana 64d1rUxfizSAOE9UbMnUZd 48nXZHMaiXLQP9KTVoh9Bj 52 6yYVJKYaBp37t9zJic1dA2 197879 70.3 64.6 10 -7.965 0 13.60 1.660 0.007570 26.30 59.9 110.952 68 1998899

We had fun :)

We looked for the most positive songs in the top20 artists’ best songs. And it was “Karabiberim” from Serdar Ortac which is also our favorite!!!

Musical_Positivity <-
  top20Artist_songFeatures %>%
  arrange(desc(valence)) %>% 
  select(artist_name,track_name, valence) %>% 
  head(10)

Musical_Positivity %>%
  knitr::kable()
artist_name track_name valence
Serdar Ortaç Karabiberim 96.8
Hande Yener Aşkın Ateşi 96.1
Hande Yener Mor 96.1
Sıla Kafa 96.0
Buray Tac Mahal 95.2
Hande Yener Kırmızı 94.5
Gülşen Yukardan Ayarlı 94.3
Serdar Ortaç Gamzelim 94.2
Mustafa Sandal Jest Oldu 93.5
Demet Akalın Afedersin 92.6

Joyplot for Musical Positivity (Valence)

The plot below represents the visualization of the artists in top20 accordingly with their songs’ valence. Valence is considered as a key parameter that determines whether the music has positive vibes or not.

ggplot(top20Artist_songFeatures, aes(x = valence, y = artist_name)) + 
  geom_joy() + 
  theme_joy() +
  ggtitle("Joyplot of Top Artists' Musical Positivity", subtitle = "Based on valence / measurement of positivity")

The Top 10 Turkish Pop Songs - How Their Attributes Match?

The bar graph below represents the musical attributes for the best 10 songs accordingly with their track popularity.

knitr::kable(Top10_songs)
artist_name album_name track_name artist_id track_id track_popularity album_id duration_ms danceability energy key loudness mode speechiness acousticness instrumentalness liveness valence tempo artist_popularity artist_followers
Aleyna Tilki Nasılsın Aşkta? Nasılsın Aşkta? 4ckLjJztj53Ifid7WHweBn 4Am7XgKpt84IDRCv3PyXW8 70 545QgjpFzjjmCTpuj7zcAZ 171080 71.0 78.2 8 -6.703 0 4.66 11.800 0.000192 10.60 21.6 139.932 62 416575
Gülşen Bir İhtimal Biliyorum Bir İhtimal Biliyorum 1F2v33FQTavJyaD7ZsyhdA 24mpJgP2YZUBif9NvmYyh4 67 2CICALHFSoebVWZqi9hvUo 210232 69.2 51.8 1 -9.391 1 4.07 1.830 0.000000 28.40 32.6 98.020 62 619329
Mustafa Sandal Gel Bana Gel Bana 0mkH5jj3goQ51JtPKVodTo 3AXScNtH6Ywywwma6u8h95 65 2yRDMGRoahDlyRWfmhGT2Q 183337 86.7 58.3 4 -8.782 0 35.90 18.000 0.005050 14.70 45.1 90.017 62 213921
Yalın Deva Bize Sevişler Deva Bize Sevişler 46zuW8tHxwahYn7VNMgYTa 7l8e7Pe8qndxhCU245rIve 65 4L1PIFhDNf4qc1K2yBQqOh 218740 52.8 81.1 8 -7.147 0 6.51 30.400 0.002210 5.65 74.8 166.022 64 415726
Buray Kehanet Kabahat Bende 1qZ684TB9E1BjH58btdtYd 3UgBLWFgadLahNGxTDYG2d 65 54fUFXduCOTJEksa3bUU89 206700 57.2 71.8 11 -5.771 0 5.56 41.300 0.000000 11.20 87.7 79.839 63 466051
Hande Yener Beni Sev Beni Sev 08mjMUUjyTchMHCW7evc3R 0bE8X3KwUifITMaibVR9eD 63 2xUTDtK1rGCdFmEqUKFCLw 259093 58.5 76.6 2 -4.750 0 3.29 0.678 0.001360 42.20 36.3 110.006 61 418609
Simge Ben Bazen Öpücem 4StjyzjcmZ7a9QncHVf0pu 1pq9w58vpi5nnEllpgl1tF 62 7JkYuwCd3THEGv2YZYgSDE 255150 74.6 80.2 8 -6.590 0 5.75 6.070 0.000929 14.30 81.6 132.010 61 311886
Tarkan Ölürüm Sana Simarik 2yMN0IP20GOaN6q0p0zL5k 6vEL7E8TGzrxuxbrgdlkLL 61 6ebdbUXZn5AURKeRNXqiay 235218 77.5 81.8 7 -8.687 1 16.40 5.180 0.000000 11.40 82.6 97.060 66 1481877
Sıla Acı Sabır 5gFPi3KWXEwA9bLEO47Ow0 6I6gNA8Slf7kdSQZ9kObe3 61 33FUvw367XssYPX3LcWiFd 195886 74.9 89.3 9 -5.612 0 8.55 52.500 0.000000 13.00 77.9 120.021 62 1127473
Demet Akalın Ateş N’apıyorsan Yap 1U449OOb70EZlElNjLMwCM 7w8XcjYxuykXdg9PTDTjBR 60 0WAS8LZqjH2yhUbFyEkDtI 173000 72.1 74.8 5 -8.564 0 13.20 2.180 0.000000 7.07 62.5 170.054 64 690833
ggplot(Top10_songs_v1.long, aes(x=variable, y=value))+geom_bar(aes(y=value, fill=track_name),stat="identity", alpha=0.8 , position="dodge")+ ylab("Value")+ xlab("Features")+coord_flip()+ggtitle("Top 10 Turkish Pop Songs in Spotify 2019")

Who knows best to be in the Top50 :)

It is observed that the most popular artist “Sezen Aksu” has the most songs in the list. Interestingly, even Aleyna Tilki has only 3 songs that are available in the market, she has achieved the success to be in the top 50 with 2 of them. Also, Emrah Karaduman has songs with her and his most popular songs with Aleyna Tilki.

As a keypoint, if you want to be in the hits, be like Aleyna Tilki

Top50%>%count(artist_name,sort=TRUE)
## # A tibble: 15 x 2
##    artist_name         n
##    <chr>           <int>
##  1 Sezen Aksu          7
##  2 Tarkan              6
##  3 maNga               5
##  4 Teoman              5
##  5 Buray               4
##  6 Emrah Karaduman     4
##  7 Yalın               4
##  8 Demet Akalın        3
##  9 Simge               3
## 10 Aleyna Tilki        2
## 11 Deeperise           2
## 12 Sıla                2
## 13 Gülşen              1
## 14 Hande Yener         1
## 15 Mustafa Sandal      1

What about statistics?

We have searched for correlation between the musical attributes of the 193 tracks and observed that there is no correlation between the musical attributes. Sadly, we are not able to come up with a conclusion like: “If the song is energetic, you will be dancing”.

correl_values=top20Artist_songFeatures %>%
  select(danceability,energy,speechiness,acousticness,instrumentalness,liveness,valence)

correl_values <- cor(correl_values)

correl_values %>%
  knitr::kable()
danceability energy speechiness acousticness instrumentalness liveness valence
danceability 1.0000000 0.3821162 0.1682726 -0.4695240 -0.0317080 -0.1061904 0.4622876
energy 0.3821162 1.0000000 0.2182280 -0.6810877 -0.3933557 0.0836172 0.5809970
speechiness 0.1682726 0.2182280 1.0000000 -0.1714036 -0.1308977 0.0633878 0.1661581
acousticness -0.4695240 -0.6810877 -0.1714036 1.0000000 0.2210678 -0.0526673 -0.3319874
instrumentalness -0.0317080 -0.3933557 -0.1308977 0.2210678 1.0000000 -0.1296594 -0.2418518
liveness -0.1061904 0.0836172 0.0633878 -0.0526673 -0.1296594 1.0000000 -0.1250374
valence 0.4622876 0.5809970 0.1661581 -0.3319874 -0.2418518 -0.1250374 1.0000000

Snapshot for Track Attributes for the Most Listed Artists

plotArtistRadar(theArtist = "Sezen Aksu",Top50)

plotArtistRadar(theArtist = "Tarkan",Top50)

plotArtistRadar(theArtist = "maNga",Top50)

plotArtistRadar(theArtist = "Teoman",Top50)

plotArtistRadar(theArtist = "Buray",Top50)

# Curiosity:
plotArtistRadar(theArtist = "Aleyna Tilki",Top50)

plotArtistRadar(theArtist = "Emrah Karaduman",Top50)

What about emotions, what does Turkish people love listening to?

Key Characteristics and Mood Link

According to the top 50 songs mode and key distribution, we have observed that Turkish people loves songs with the content of “Discontent, Uneasiness” followed by “Despair, Wailing and Weeping”

Top50$tone <- ifelse(Top50$mode==0, "minor", "major")

Top50$scale <-

                      ifelse (Top50$key==0, "C",
                      ifelse(Top50$key==1, "C#",
                      ifelse(Top50$key==2, "D",
                      ifelse(Top50$key==3,"D#" ,
                      ifelse(Top50$key==4, "E",
                      ifelse(Top50$key==5, "E#",
                      ifelse(Top50$key==6,"F",
                      ifelse(Top50$key==7, "F#",
                      ifelse(Top50$key==8, "G",
                      ifelse(Top50$key==9,"G#",
                      ifelse(Top50$key==10,"A","A#"))))))))))) 


Top50$keys <- paste(Top50$scale, Top50$tone, sep= " ")


tone1 <- group_by(Top50, keys)
tone2 <- dplyr::summarise(tone1,  count=n())
tone2 <- arrange(tone2, desc(count))

# Tonality treemap
treemap(tone2, index="keys", vSize="count", type="index", 
        palette="Pastel1", title="Top 50 Songs Key characteristics", fontsize.title=12)

# major vs Minor
major <- group_by(Top50, tone)
major2 <-dplyr::summarise(major, count=n())

# Major treemap
treemap(major2, index="tone", vSize="count", type="index", 
        palette="Pastel2", title="Top 50 Songs Major vs Minor", fontsize.title=12)

Turkish Pop Hits’ Names!

names <- gsub("remix", "", names, ignore.case = TRUE, perl = FALSE,
    fixed = FALSE, useBytes = FALSE)
wordcloud(names, max.words=20 ,random.order=FALSE,rot.per=0.35,colors=brewer.pal(5, "Dark2"), main="Title")

# A total match as a subset of Turkish pop tagged artist with also the rock tag
collectionAll_filtered %>%
  filter(Genre=="turkish rock")
## # A tibble: 70 x 22
##    artist_name album_name track_name artist_id track_id track_popularity
##    <chr>       <chr>      <chr>      <chr>     <chr>               <int>
##  1 Tarkan      Ölürüm Sa~ Simarik    2yMN0IP2~ 6vEL7E8~               61
##  2 Tarkan      Her Şey F~ Her Şey F~ 2yMN0IP2~ 0JHarUs~               58
##  3 Tarkan      Karma      Ay         2yMN0IP2~ 0oVnsgy~               55
##  4 Tarkan      Karma      Kuzu Kuzu  2yMN0IP2~ 3ajYmPD~               55
##  5 Tarkan      Aacayipsin Kış Güneşi 2yMN0IP2~ 1tiIKel~               54
##  6 Tarkan      Ölürüm Sa~ Ölürüm Sa~ 2yMN0IP2~ 6nAgxB5~               54
##  7 Tarkan      10         Kedi Gibi  2yMN0IP2~ 1BfpV5h~               53
##  8 Tarkan      Karma      Sen Başka~ 2yMN0IP2~ 0ZJKPGK~               50
##  9 Tarkan      Ölürüm Sa~ Salina Sa~ 2yMN0IP2~ 4PGsEvm~               50
## 10 Tarkan      10         Yolla      2yMN0IP2~ 1vZAYNF~               49
## # ... with 60 more rows, and 16 more variables: album_id <chr>,
## #   duration_ms <int>, danceability <dbl>, energy <dbl>, key <int>,
## #   loudness <dbl>, mode <int>, speechiness <dbl>, acousticness <dbl>,
## #   instrumentalness <dbl>, liveness <dbl>, valence <dbl>, tempo <dbl>,
## #   artist_popularity <int>, artist_followers <int>, Genre <chr>