1
Generating Groove: Predicting Jazz Harmonization Nicholas Bien 1 ([email protected]) and Lincoln Valdez 2 ([email protected] 1 Department of Computer Science, Stanford University, 2 Department of Computer Science, Stanford University We aim to generate an appropriate jazz chord progression for a given melody. As musical minds, we wanted to see if it is possible to create a model that can make any melody sound jazzy. Classical theory is very predictable. Prior research has generated chord harmoniza@ons for classical and pop music with high accuracy. [1] Jazz theory is a lot less formulaic, so predic@ng jazz progressions seemed a lot more challenging. ß2AR Mo#va#on Dataset and Feature Mapping Our dataset was a set of 149 “Jazz Standards” encoded in Lilypond musical transcrip@on format. Each song in the dataset consisted of a melody line with accompanying chord symbols. We transposed each song to the key of C major / A minor. For each chord symbol, we count the number of @mes each of the 12 notes in the chroma@c scale occurs to obtain our features. There were 246 chord types in our dataset. To facilitate classifica@on, we explored methods for grouping chords into similar clusters. Clustering Algorithms Combining the results of the two algorithms, we observed that chords where notes were stacked on top of the 7 th were clustered together, and that 7 th chords had similar func@ons to their respec@ve triads and 6 th s. Our clustering efforts brought the number of chord classes down from 246 to 85. Classifica#on Algorithms Algorithm % Accuracy Baseline 17.6% Naïve Bayes 26.2% Support Vector Classifier 28.3% Support Vector Classifier w/ HMM 27.4% Naïve Bayes For our first chord predic@on algorithm, we implemented a one-off Laplace-smoothed Naïve Bayes classifier. The posterior likelihood of each class was calculated: The results were promising: though the accuracy wasn’t that high, it was above baseline, and the actual chords predicted for a given melody were realis@c. K-means and Brown Clustering Support Vector Classifier Our second method was a mul@-class support vector classifier. Input vectors were 12-dimensional note counts. We used a radial bias func@on kernel: The SVC outperformed Naïve Bayes and seemed to capture the harmonic content of the melody, especially when many notes were present in a feature vector. Hidden Markov Model Lastly, we tried incorpora@ng a hidden Markov model with our SVC to capture rela@onships between chords. [2] For this task, we augmented the dataset with START and END tokens. Transi@on probabili@es were calculated from bigrams in the training set. We used SVC outputs as noisy es@mators of the ground truth chord to obtain emission probabili@es. We then used the Viterbi algorithm to obtain the maximum likelihood sequence of hidden states (chords classes) given the observed states (SVC predic@ons). Future Direc#ons What we learned from this project is that the problem we were trying to tackle is a lot more difficult than we ini@ally thought. We likely could have achieved much higher accuracy with the same approach on classical music, since jazz music is far too expansive given the limited data set we had access to. Possible future approaches could be: Expanding research into the neural network realm [3] Obtaining/crea@ng more data Trying the experiment first on classical theory, tuning, refining and then extrapola@ng to jazz References [1] Simon, Ian, Dan Morris, and Sumit Basu. "MySong: Automa@c Accompaniment Genera@on for Vocal Melodies." CHI Proceedings. 2008. [2] Cunha, Uraquitan Sidney and Geber Ramalho. "An Intelligent Hybrid Model for Chord Predic@on." Organised Sound 4(2), pp. 115-119. 1999. [3] Gang, Dan, Daniel Lehmann, and Naoali Wagner. "Tuning a Neural Network for Harmonizing Melodies in Real-Time." 1998. [4] Paiement, Jean-François, Douglas Eck, and Samy Bengio. "Probabilis@c Melodic Harmoniza@on." LNAI 4013, pp. 218-229. 2006. We first tried using K-means clustering with the normalized note counts as features and seeing which chords centered around the ini@alized centroids. Our second method was Brown clustering, which is normally used for the seman@cs of words in sentences based on their context. Instead, we used it on sequences of chords. Results Clustering Results PCA of aggregated note features aoer chord clustering For tes@ng, we used 80/20 cross valida@on (split by song). Depending on the run, this amounted to ~6200 chords in the training set and ~1500 chords in the test set. All algorithms easily outperformed the baseline. While the numbers could certainly be improved by reducing the number of classes even further, we were pleased with the aesthe@c quality of the harmoniza@ons produced. In par@cular, incorpora@ng a Hidden Markov Model with the SVM lowered overall accuracy slightly but produced more canonical jazz progressions, even for non-jazz music.

Generating Groove: Predicting Jazz Harmonizationcs229.stanford.edu/proj2017/final-posters/5148557.pdf · Our dataset was a set of 149 “Jazz Standards” encoded in Lilypond musical

Embed Size (px)

Citation preview

Generating Groove: Predicting Jazz Harmonization Nicholas Bien1 ([email protected]) and Lincoln Valdez2 ([email protected]

1 Department of Computer Science, Stanford University, 2 Department of Computer Science, Stanford University

Weaimtogenerateanappropriatejazzchordprogressionforagivenmelody.Asmusicalminds,wewantedtoseeifitispossibletocreateamodelthatcanmakeanymelodysoundjazzy.Classicaltheoryisverypredictable.Priorresearchhasgeneratedchordharmoniza@onsforclassicalandpopmusicwithhighaccuracy.[1]Jazztheoryisalotlessformulaic,sopredic@ngjazzprogressionsseemedalotmorechallenging.

ß2AR

Mo#va#on

DatasetandFeatureMappingOurdatasetwasasetof149“JazzStandards”encodedinLilypondmusicaltranscrip@onformat.Eachsonginthedatasetconsistedofamelodylinewithaccompanyingchordsymbols.WetransposedeachsongtothekeyofCmajor/Aminor.Foreachchordsymbol,wecountthenumberof@meseachofthe12notesinthechroma@cscaleoccurstoobtainourfeatures.

Therewere246chordtypesinourdataset.Tofacilitateclassifica@on,weexploredmethodsforgroupingchordsintosimilarclusters.

ClusteringAlgorithms

Combiningtheresultsofthetwoalgorithms,weobservedthatchordswherenoteswerestackedontopofthe7thwereclusteredtogether,andthat7thchordshadsimilarfunc@onstotheirrespec@vetriadsand6ths.Ourclusteringeffortsbroughtthenumberofchordclassesdownfrom246to85.

Classifica#onAlgorithmsAlgorithm %AccuracyBaseline 17.6%NaïveBayes 26.2%SupportVectorClassifier 28.3%

SupportVectorClassifierw/HMM 27.4%

NaïveBayesForourfirstchordpredic@onalgorithm,weimplementedaone-offLaplace-smoothedNaïveBayesclassifier.Theposteriorlikelihoodofeachclasswascalculated:Theresultswerepromising:thoughtheaccuracywasn’tthathigh,itwasabovebaseline,andtheactualchordspredictedforagivenmelodywererealis@c.

K-meansandBrownClustering

SupportVectorClassifierOursecondmethodwasamul@-classsupportvectorclassifier.Inputvectorswere12-dimensionalnotecounts.Weusedaradialbiasfunc@onkernel:TheSVCoutperformedNaïveBayesandseemedtocapturetheharmoniccontentofthemelody,especiallywhenmanynoteswerepresentinafeaturevector.

HiddenMarkovModel

Lastly,wetriedincorpora@ngahiddenMarkovmodelwithourSVCtocapturerela@onshipsbetweenchords.[2]Forthistask,weaugmentedthedatasetwithSTARTandENDtokens.Transi@onprobabili@eswerecalculatedfrombigramsinthetrainingset.WeusedSVCoutputsasnoisyes@matorsofthegroundtruthchordtoobtainemissionprobabili@es.WethenusedtheViterbialgorithmtoobtainthemaximumlikelihoodsequenceofhiddenstates(chordsclasses)giventheobservedstates(SVCpredic@ons).

FutureDirec#onsWhatwelearnedfromthisprojectisthattheproblemweweretryingtotackleisalotmoredifficultthanweini@allythought.Welikelycouldhaveachievedmuchhigheraccuracywiththesameapproachonclassicalmusic,sincejazzmusicisfartooexpansivegiventhelimiteddatasetwehadaccessto.Possiblefutureapproachescouldbe:•  Expandingresearchintotheneuralnetworkrealm[3]•  Obtaining/crea@ngmoredata•  Tryingtheexperimentfirstonclassicaltheory,tuning,refining

andthenextrapola@ngtojazz

References[1]Simon,Ian,DanMorris,andSumitBasu."MySong:Automa@cAccompanimentGenera@onforVocalMelodies."CHIProceedings.2008.[2]Cunha,UraquitanSidneyandGeberRamalho."AnIntelligentHybridModelforChordPredic@on."OrganisedSound4(2),pp.115-119.1999.[3]Gang,Dan,DanielLehmann,andNaoaliWagner."TuningaNeuralNetworkforHarmonizingMelodiesinReal-Time."1998.[4]Paiement,Jean-François,DouglasEck,andSamyBengio."Probabilis@cMelodicHarmoniza@on."LNAI4013,pp.218-229.2006.

WefirsttriedusingK-meansclusteringwiththenormalizednotecountsasfeaturesandseeingwhichchordscenteredaroundtheini@alizedcentroids.OursecondmethodwasBrownclustering,whichisnormallyusedfortheseman@csofwordsinsentencesbasedontheircontext.Instead,weuseditonsequencesofchords.

ResultsClusteringResults

PCAofaggregatednotefeaturesaoerchordclustering

Fortes@ng,weused80/20crossvalida@on(splitbysong).Dependingontherun,thisamountedto~6200chordsinthetrainingsetand~1500chordsinthetestset.

Allalgorithmseasilyoutperformedthebaseline.Whilethenumberscouldcertainlybeimprovedbyreducingthenumberofclassesevenfurther,wewerepleasedwiththeaesthe@[email protected]@cular,incorpora@ngaHiddenMarkovModelwiththeSVMloweredoverallaccuracyslightlybutproducedmorecanonicaljazzprogressions,evenfornon-jazzmusic.