{"word_count": 607, "character_count": 6587}
Last week, I've been going through my CD collection, trying to find records I haven't been listing for a while. And I got the feeling that music I listen to nowadays is slower than the one I was listening to in my 20's. I was wondering if that was an age issue, or it was simply the fact that music in the 90s was "faster" than the one released in 2015. So I tried to scrap the BPM database to get a more appropriate answer about this "feeling" I have. I did extract two information: the BPM (beat per minute) and the year (of release).Here is a function to extract information from the website,&#62; library(XML)&#62; extractbpm = function(VBP,P){+ url=paste("https://www.bpmdatabase.com/music/search/?artist=&#38;title=&#38;bpm=",VBP,"&#38;genre=&#38;page=",P,sep="")+ download.file(url,destfile = "page.html")+ tables=readHTMLTable("page.html")+ return(tables)}For instance&#62; extractbpm(115,13)$`track-table`Artist                                  Title1  Eros Ramazzotti y Claudio Guidetti                            Dimelo A Mi2                           Everclear               Volvo Driving Soccer Mom3                           Evils Toy                               Dear God4                              Expose                         In Walked Love5               Fabolous ft. 2 Chainz                    When I Feel Like It6               Fabolous ft. 2 Chainz                    When I Feel Like It7               Fabolous ft. 2 Chainz                    When I Feel Like It8                            Fanny Lu                              Fanfarron9                         Featurecast                         Ain't My Style10                          Fem 2 Fem                              Obsession11                 Fernando Villalona                              Mi Delito12                          Fever Ray                         Triangle Walks13                          Firstlove                                 Freaky14                        Fito Blanko                     Pegadito Suavecito15                 Flechazo Del Norte                   Mariposa Traicionera16                              Fluke                          Switch/Twitch17                            Flyleaf                       Something Better18                          FM Static                     The Next Big Thing19                            Fonseca                          Eres Mi Sueno20         Fonseca ft. Maffio &#38; Nayer                          Eres Mi Sueno21              Francesca Battistelli Have Yourself A Merry Little Christmas22                    Frankie Ballard                          Young &#38; Crazy23                         Frankie J.                        More Than Words24                      Frank Sinatra                         The Hucklebuck25                    Franz Ferdinand                The Dark Of The MatinéeMix BPM          Genre                           Label Year1                      — 115              —                            Sony 20092                      — 115              —                 Capitol Records 20033                      — 115              —                               —    —4                      — 115              —                  Arista Records 19945               Explicit 115          Urban          Def Jam/Island Def Jam 20136                      — 115          Urban          Def Jam/Island Def Jam 20137             Radio Edit 115          Urban          Def Jam/Island Def Jam 20138                      — 115      Latin Pop                Universal Latino 20119        Psychemagik Dub 115              —                        Jalapeno 201210                     — 115              —                Critique Records 199311                     — 115              — Mt&#38;vi Records/caminante Records 200112     Rex The Dog Remix 115              —               Little Idiot/Mute 201213                     — 115              —                       Jwp Music 200014                     — 115 Merengue Mambo                   Crown Loyalty 201215                     — 115              —                        Hacienda 201016         Album Version 115              —       One Little Indian Records 200417                     — 115    Alternative                      A&#38;M/Octone 201318                     — 115              —            Tooth &#38; Nail Records 200719                     — 115 Merengue Mambo                              10 201220         Urban Version 115              —                              10 201221                     — 115              —        Word/Fervent/Warner Bros 200922                     — 115        Country                     Warner Bros 201523 Mynt Rocks Radio Edit 115              —                        Columbia 200524                     — 115           Jazz                        Columbia 195025                     — 115       New Wave                               — 2004We have here one of the few old songs, a 1950 tune by Frank Sinatra. If we scrap the website, with a simple loop (where the bpm is from 40 to 200). Start with BASE=NULL&#62; vbp=40&#62; p=1and then, a loop based on&#62; while(vbp&#60;=2017){+ F=extractbmp(vbp,p)+ if(length(F)==1){+ BASE=rbind(BASE,F[[1]][,c("Artist","Title","BPM","Year")])+ p=p+1}+ if(length(F)==0){+  vbp=vbp+1+  p=1}}Then we should clean the datasetBASE=BASE[-duplicated(BASE),]BASE=BASE[-which(BASE$Year=="—"),]BASE$y=as.numeric(as.character(BASE$Year))BASE$bpm=as.numeric(as.character(BASE$BPM))BASE=BASE[BASE$y&#62;=1940,]and we end up with almost 50,000 tunes.boxplot(BASE$bpm~as.factor(BASE$y),col="light blue")Over the past 20 years, it looks like speed of tunes has declined (let us forget tunes of 2017, clearly we have a problem here...)library(mgcv)plot(BASE$y,BASE$bpm)reg=gam(bpm~s(y),data=BASE)B=data.frame(y=1950:2017)p=predict(reg,newdata=B)lines(B$y,p,lwd=3,col="red")which is confirmed with a (smoothed) regressionp2=predict(reg,newdata=B,se.fit=TRUE)plot(B$y,p2$fit,lwd=3,col="red",type="l",ylim=c(90,140))lines(B$y,p2$fit+p2$se.fit)lines(B$y,p2$fit-p2$se.fit)even when incorporating the confidence band. Bumps are probably related to smoothing parameters, but indeed, it looks like the average speed of music tune has decreased, from 110-115 in the 90's to less than 100 nowadays. Now to be honest, I would love to have access to personal information from itunes, deezer or spotify, to get a better understanding (eg when in the week, in the day, do we like to listen to faster music for instance). But so far, I could not have access to such data. Too bad...