arXiv:2008.01291v1 [cs.LG] 4 Aug 2020 · pitch), (2) a rhythm encoder Q ˝(z rhythmjx rhythm), and (3) a hierar-chical decoder P ˚(xjz pitch;z rhythm) as shown in Figure 4. 2.2.1 - [PDF Document] (2024)

arXiv:2008.01291v1 [cs.LG] 4 Aug 2020· pitch), (2) a rhythm encoder Q ˝(z rhythmjx rhythm), and (3) a hierar-chical decoder P ˚(xjz pitch;z rhythm) as shown in Figure 4. 2.2.1 - [PDF Document] (1)


Ke Chen1 Cheng-i Wang3 Taylor Berg-Kirkpatrick2 Shlomo Dubnov1

1 CREL, Music Department, 2 UC San Diego 3 Smule, Inc1,2{knutchen, tberg, sdubnov}, [emailprotected]


Drawing an analogy with automatic image completionsystems, we propose Music SketchNet, a neural networkframework that allows users to specify partial musicalideas guiding automatic music generation. We focus ongenerating the missing measures in incomplete mono-phonic musical pieces, conditioned on surrounding con-text, and optionally guided by user-specified pitch andrhythm snippets. First, we introduce SketchVAE, a novelvariational autoencoder that explicitly factorizes rhythmand pitch contour to form the basis of our proposedmodel. Then we introduce two discriminative architec-tures, SketchInpainter and SketchConnector, that in con-junction perform the guided music completion, filling inrepresentations for the missing measures conditioned onsurrounding context and user-specified snippets. We eval-uate SketchNet on a standard dataset of Irish folk musicand compare with models from recent works. When usedfor music completion, our approach outperforms the state-of-the-art both in terms of objective metrics and subjectivelistening tests. Finally, we demonstrate that our model cansuccessfully incorporate user-specified snippets during thegeneration process.


As a research area, automatic music generation has along history of studying and expanding human expres-sion/creativity [1]. The use of neural network techniquesin automatic music generation tasks has shown promisingresults in recent years [2]. In this paper, we focus on aspecific facet of the automatic music generation problemon how to allow users to flexibly and intuitively controlthe outcome of automatic music generation. Prior worksupports various forms of conditional music generation.MuseGan [3] allows users to condition generated resultson full-length multi-track music. DeepBach [4] provides aconstraint mechanism that allows users to limit the gen-erated results to match composer styles. Music Trans-

c© Ke Chen, Cheng-i Wang, Taylor Berg-Kirkpatrick,Shlomo Dubnov. Licensed under a Creative Commons Attribution 4.0International License (CC BY 4.0). Attribution: Ke Chen, Cheng-i Wang, Taylor Berg-Kirkpatrick, Shlomo Dubnov, “Music SketchNet:Controllable Music Generation via Factorized Representations of Pitchand Rhythm”, in Proc. of the 21st Int. Society for Music InformationRetrieval Conf., Montréal, Canada, 2020.






PastContext FutureContext




























Figure 1. The music sketch scenario. The model is de-signed to fill the missing part based on the known contextand user’s own specification.

former [5] supports a accompaniment arrangement froman existing melody track in classical music. However, allthese approaches require the user preference to be definedin terms of complete musical tracks.

Inspired by the sketching and patching work from com-puter vision [6–10], we propose Music SketchNet 1 whichallows users to specify partial musical ideas in terms ofincomplete and distinct pitch and rhythm representations.More specifically, we generalize the concept of sketchingand patching – wherein a user roughly sketches contentfor a missing portion of an image – to music, as depictedin Figure 1. The proposed framework will complete themissing parts given the known context and user input. Tothe best of our knowledge, there has been limited work onsketching in music generation. Some work [4,11] has usedMarkov Chain Monte Carlo (MCMC) to generate musicwith given contexts or generate music conditioned on sim-ple starting and ending notes [12]. The most related task ismusic inpainting: completing a musical piece by generat-ing a sequence of missing measures given the surroundingcontext, but without conditioning on any form of user pref-erences. Music InpaintNet, [13] completes musical piecesby predicting vector representations for missing measures,then the vector representations are decoded to output sym-bolic music through the use of a variational autoencoder(VAE) [14].

Our proposed music sketching scenario takes music in-









] 4



arXiv:2008.01291v1 [cs.LG] 4 Aug 2020· pitch), (2) a rhythm encoder Q ˝(z rhythmjx rhythm), and (3) a hierar-chical decoder P ˚(xjz pitch;z rhythm) as shown in Figure 4. 2.2.1 - [PDF Document] (2)









Figure 2. The Music SketchNet pipeline. The color pat-terns inside Inpainter and Connector correspond to the la-tent space transform and completion process in Figure 1.

painting a step further. We let users specify musical ideasby controlling pitch contours or rhythm patterns, not bycomplete musical tracks. The user input is optional: userscan choose to specify musical ideas, or let the system fillin predictions without conditioning on user preferences.

Music SketchNet consists of three component, as de-picted in Figure 2: (1) SketchVAE is a novel variationalautoencoder that converts music measures into high dimen-sional latent variables. By the use of a factorized infer-ence network, SketchVAE decouples latent variables intotwo parts: pitch contour and rhythm, which serve as thecontrol parameters for users. (2) SketchInpainter containsstacked recurrent networks to handle the element-level in-painting prediction in the latent space. (3) SketchConnec-tor receives users’ sketches of pitch, rhythm, or both, com-bines them with the prediction from SketchInpainter, andfinalizes the generation.

In this paper, we show that the proposed Sketch-VAE is capable of factorizing music input into la-tent variables meaningfully, and the proposed SketchIn-painter/SketchConnector allows users to control the gen-erative process. The novel training and evaluation method-ologies of the SketchConnector are also presented.


We formalize the music sketching task as solving the fol-lowing three problems: (1) how to represent music ideas orelements, (2) how to generate new materials given the pastand future musical context and (3) how to process users’input and integrate it with the system. A visualization ofthe sketching scenario is depicted in Figure 1.

We propose three neural network components to tacklethe three problems. The SketchVAE encodes/decodes themusic between external music measures and the learnedfactorized latent representations. The SketchInpainter pre-dicts musical ideas in the form of the latent variables givenknown context. And the SketchConnector combines thepredictions from SketchInpainter and users’ sketching togenerate the final latent variables which are sent into theSketchVAE decoder to generate music output. A diagram

showing the proposed pipeline is shown in Figure 2.

2.1 Problem Definition

More formally, the proposed sketch framework can be de-scribed as a joint probability model of the missing musi-cal content, Xm, conditioned on the past, future, and usersketching input. The joint probability breaks down into aproduct of conditional probabilities corresponding to sub-components of the framework:

Pφ,ε,γ,θ,τ (Xm, Z, S|Xp, Xf , C) =

Pφ(Xm|Zm) (SketchVAE Decoder)

∗ Pε(Zm|Sm, C) (SketchConnector)

∗ Pγ(Smpitch|Zppitch, Z

fpitch) (SketchInpainter)

∗ Pγ(Smrhythm|Zprhythm, Z

frhythm) (SketchInpainter)

∗Qθ(Zppitch, Zfpitch|X

ppitch, X


∗Qτ (Zprhythm, Zfrhythm|X

prhythm, X


(SketchVAE Encoders)

X indicates the input/output music sequence, Z is the se-quence for {z} the latent variable , S is the SketchIn-painter’s predicted sequence, C is users’ sketching input.The superscripts, p, m, f indicate the past, missing andfuture context. The subscripts, pitch and rhythm indi-cate the pitch and rhythm latent variables. Qθ, Qτ , Pφare the SketchVAE pitch/rhythm encoders and decoder pa-rameters, Pγ represents the SketchInpainter, and Pε is theSketchConnector.

2.2 SketchVAE for Representation

MusicVAE [15] is one of the first works applying the vari-ational auto-encoder [14] to music. MeasureVAE [13] fur-ther focuses on representing isolated measures and utilizesa hierarchical decoder to handle ticks and beats. EC2-VAE [16] factorizes music measures with separate vectorsrepresenting pitch and rhythm by a single encoder and twodecoders. Our proposed SketchVAE aims to factorize rep-resentations by introducing a factorized encoder that con-siders pitch and rhythm information separately in the en-coder channels. Different from EC2-VAE, it could al-low users to enter parts of the information (rhythm and/orpitch) optionally.

SketchVAE aims to represent a single music measureas a latent variable z that encodes rhythm and pitch con-tour information in separate dimensions (zpitch, zrhythm).It contains (1) a pitch encoder Qθ(zpitch|xpitch), (2) arhythm encoder Qτ (zrhythm|xrhythm), and (3) a hierar-chical decoder Pφ(x|zpitch, zrhythm) as shown in Figure4.

2.2.1 Music Score Encoding

Similar to [15], we encode the monophonic midi melodyby using [0, 127] for the note onsets, 128 for holding state,and 129 for the rest state. We cut each measure into 24frames to correctly quantize eighth-note triplets like [13],and encode the midi as described in the previous sentence.

arXiv:2008.01291v1 [cs.LG] 4 Aug 2020· pitch), (2) a rhythm encoder Q ˝(z rhythmjx rhythm), and (3) a hierar-chical decoder P ˚(xjz pitch;z rhythm) as shown in Figure 4. 2.2.1 - [PDF Document] (3)

D5 _ _ E5 _ _ A4 _ _ _ _ _ _ _ _ G4 _ _ A4 _ _ _ _ _

74 128 128 76 128 128 69 128 128 128 128 128 128 128 128 67 128 128 69 128 128 128 128 128

74 76 69 67 69 ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● O _ _ O _ _ O _ _ _ _ _ _ _ _ O _ _ O _ _ _ _ _

Music Melody Tokens

Pitch Tokens (with padding●) Rhythm Tokens

Figure 3. An example of the encoding of a monophonicmelody.

As Figure 3 shows, we further process the encoded 24-frame sequence x into xpitch and xrhythm, the pitch andrhythm token sequences respectively. The pitch token se-quence xpitch is obtained by picking all note onsets in xwith padding (shown by "•" in Figure 3) to fill 24 frames.The rhythm token sequence xrhythm is obtained by replac-ing all pitch onsets with the same token (shown by "O"and "_" in Figure 3). A similar splitting strategy is alsoused in [17]. Our motivation is to provide users with twointuitive music dimensions to control, and to help enforcebetter factorization in the latent representation for later pre-diction and control.

2.2.2 The Pitch Encoder and Rhythm Encoder

After pre-processing x, xpitch only contains the note valuesequence, while xrhythm only has the duration and onsetinformation. xpitch and xrhythm are then fed into twodifferent GRU [18] encoders for variational approxima-tion. The outputs of each encoder are concatenated intoz = [zpitch, zrhythm].

2.2.3 The Hierarchical Decoder

After we obtain the latent variable z, we feed it into the hi-erarchical decoder. This decoder is similar to the decoderused in MeasureVAE [13]. As shown in the bottom part inFigure 4, it contains an upper "beat" GRU layer and a lower"tick" GRU layer. This division’s motivation is to decode zinto n beats first and then decode each beat into t ticks. Asa result, the note information in each measure will be de-coded in a musically intuitive way. For the tick GRU, weuse the teacher forcing [19, 20] and auto-regressive tech-niques to train the network efficiently. The output is condi-tioned frame-by-frame not only on the beat token but alsoon the last tick token.

2.2.4 Encoding the Past, Missing and Future MusicalContext

The latent variable sequences Zp, Zm, and Zf are then ob-tained by processing the music input in measure sequencesXp, Xm, and Xf . Both Xm and Zm are masked duringtraining. This encoding part is shown in the left block ofFigure 5.

2.3 SketchInpainter for Initial Prediction

Next, we describe the model component that performs themusic inpainting to predict latent representations for themissing measures. The SketchInpainter accepts Zpitchand Zrhythm as two independent inputs from SketchVAE.




D5A4A4A4B4C5G4-------------------- O__O__O__OOO______O__

PitchTokens RhythmTokens








μConcat zrhythmZ



b1 b2 ... bn-1 bn


c1 c2 ... cn-1 cnh1 h2 ... hn-1 hn



x1x2... xt xt+1xt+2... x2t xnt




PitchEncoder RhythmEncoder




Figure 4. SketchVAE structure: pitch encoder, rhythm en-coder and hierarchical decoder. Rhythm tokens: the upperdashes denote the onsets of note, and the bottom dashesdenote the hold/duration state. We use pitch symbols torepresent the tokens numbers for better illustration.

Then only the past and future Zpitch and Zrhythm are fedinto the pitch/rhythm GRU groups respectively. The out-put from each GRU group is the hidden state h, as shownin the middle of Figure 5.

Then we combine the past/future hidden states h fromboth the pitch and rhythm GRU groups and use them as theinitial states for the pitch/rhythm generation GRUs. Thegeneration GRUs then predict the missing latent variablesby Sm = (Spitch, Srhythm), as shown in the green box inFigure 5. Each generation GRU is trained with the teachforcing and auto-regressive techniques.

Each output vector sm from Sm has the same dimensionas the latent variable z from Z. We first build a model withonly SketchVAE and SketchInpainter that directly predictsthe missing music material,Xm. As the right block of Fig-ure 5 shows, Sm is sent into the SketchVAE decoder andwe compute the cross entropy loss between the predictedmusic output and the ground truth. This is the stage I train-ing in our model, detailed in Section 3.3.

2.4 SketchConnector for Finalization

The predicted Sm from SketchInpainter can already serveas a good latent representation for the missing partXm. We continue by devising the SketchConnector,Pε(Z

m|Sm, C), to modify the prediction with user con-trol. To make up for the lack of correlation betweenpitch and rhythm in current predictions, we introduce theSketchConnector as a way to intervene/control the genera-tive process, that also leads to a wider musical expressivityof the proposed system.

arXiv:2008.01291v1 [cs.LG] 4 Aug 2020· pitch), (2) a rhythm encoder Q ˝(z rhythmjx rhythm), and (3) a hierar-chical decoder P ˚(xjz pitch;z rhythm) as shown in Figure 4. 2.2.1 - [PDF Document] (4)


zpitchseq zpitchseq zpitchseq

zrhythmseq zrhythmseq zrhythmseq


past missing future






















np nm nf

Figure 5. SketchInpainter structure. We feed the music tokens into the SketchVAE and obtain the latent variable sequences.And we feed the sequences into the pitch GRU and the rhythm GRU groups to generate the initial prediction S.

2.4.1 Random Unmasking

With Sm obtained from SketchInpainter, we concatenate itwith Zp and Zf again. However, before we feed it backinto the network, we randomly unmask some of the miss-ing parts to be the ground-truth (simulating user providingpartial musical context). The masked Sm are shown by thered boxes in Figure 6. We replace some s from Sm to bethe real answer in Zm, denoted as C. We observe that thisoptimization is very similar to BERT [21] training. Thedifference is that BERT randomly masks the ground truthlabels to be unknown, but SketchConnector randomly un-masks the predictions to be truths. The unmasking rate isset to 0.3.

Intuitively, this allows the model to learn a more closerelation among current rhythm, pitch tokens, and the near-est neighbour tokens. In the sketch inference scenario, therandomly unmasked measures will be replaced by the usersketching information, which allows a natural transitionbetween the training and testing process.

2.4.2 Transformer-based Connector

Then with Sm and the random unmasking data C, we feedthem into a transformer encoder with absolute positionalencoding. In contrast to [5], we do not use relative posi-tional encoding because our inputs are vectors represent-ing individual measures, whose length is far shorter thanmidi-event sequences.

The output of the SketchConnector, Zm, will be the fi-nal prediction for the missing part. We feed it into theSketchVAE decoder, and compute the cross entropy lossof the output with the ground-truth.


3.1 Dataset and Baseline

To evaluate the SketchVAE independently, we compareour model with two related systems: MeasureVAE [13]and EC2-VAE [16]. For SketchNet, we compare ourgeneration results with Music InpaintNet [13], which hasshown better results than the earlier baseline [12]. Similarto [13], we use the Irish and Scottish monophonic music

Zp(past) Zf(future)

Re-concat Re-concat

s1 s2 ... st-1 st


















1... zmpitch





1 srhythm

t-1 srhythm




Figure 6. The SketchConnector: the output of SketchIn-painter is randomly unmasked and fed into a transformerencoder to get the final output.

Dataset [22] and select the melodies with a 4/4 time signa-ture. About 16000 melodies are used for training and 2000melodies for testing.

3.2 SketchVAE Measurements

3.2.1 Reconstruction

For SketchVAE, MeasureVAE and EC2-VAE, the dimen-sion of latent variable |z| is set to 256, half for the pitchcontour, and the other half for the rhythm. We set the learn-ing rate to 1e-4 and use Adam Optimization with β1 = 0.9and β2 = 0.998. Three models achieve the accuracy (thereconstruction rate of melodies) 98.8%, 98.7%, 99.0% re-spectively. We can clearly conclude that all VAE modelsare capable of converting melodies to latent variables byachieving the accuracy around 99%. SketchVAE is capa-ble of encoding/decoding musical materials in SketchNet.

arXiv:2008.01291v1 [cs.LG] 4 Aug 2020· pitch), (2) a rhythm encoder Q ˝(z rhythmjx rhythm), and (3) a hierar-chical decoder P ˚(xjz pitch;z rhythm) as shown in Figure 4. 2.2.1 - [PDF Document] (5)

Irish-Test Irish-Test-R Irish-Test-NR

Model loss ↓ pAcc ↑ rAcc ↑ loss ↓ pAcc ↑ rAcc ↑ loss ↓ pAcc ↑ rAcc ↑

Music InpaintNet 0.662 0.511 0.972 0.312 0.636 0.975 0.997 0.354 0.959

SketchVAE + InpaintRNN 0.714 0.510 0.975 0.473 0.619 0.981 1.075 0.374 0.964

SketchVAE + SketchInpainter 0.693 0.552 0.985 0.295 0.692 0.991 1.002 0.389 0.977

SketchNet 0.516 0.651 0.985 0.206 0.799 0.991 0.783 0.461 0.977

Table 1. The generation performance of different models in Irish and Scottish monophonic music dataset. The InpaintRNNis the generative network in Music InpaintNet.

Model Complexity↑ Structure↑ Musicality↑

Original 3.22 3.47 3.56

InpaintNet 2.98 3.01 3.09

SketchNet 3.04 3.29 3.26

Table 2. Results of the subjective listening test.

3.2.2 Comparison with EC2-VAE

EC2-VAE [16] is also capable of decoupling the la-tent variable into rhythm and pitch contour dimensions.However, SketchVAE’s encoders can accept pitch con-tour/rhythm inputs separately. Rhythm and pitch controlscan be manipulated independently in the sketching sce-nario where the user might not specify an entire musicalmeasure (e.g., just a rhythm pattern). By contrast, EC2-VAE requires a completed measure before encoding. Ifusers want to specify either rhythm or pitch controls, themodel must first fill in the other half part before inputtingit, which prohibits the possibility of the separate control.

3.3 Generation Performance

3.3.1 Training Results

The SketchNet’s training is separated into stage I and II. Instage I, after training the SketchVAE, we freeze its param-eters and train the SketchInpainter as shown in the rightblock of Figure 5. In stage II, with the trained Sketch-VAE and SketchInpainter, we freeze both, concatenate Sm

with the past/future latent variables, and feed them to theSketchConnector for training.

We compare four models by using 6 measures of pastand future contexts to predict 4 measures in the middle ( = nf = 6, and nm = 4 ). Music InpaintNet [13] isused as the baseline, along with several variations. Earlystopping is used for all systems.

We compute three metrics: loss, pitch accuracy, andrhythm accuracy to evaluate the model’s performance.The pitch accuracy is calculated by comparing only thepitch tokens between each generation and the ground truth(whether the model generates the correct pitch in the cor-rect position). And the rhythm accuracy is calculatedby comparing the duration and onset (regardless of whatpitches it generates). The overall accuracy and loss are

negatively correlated.For this part of the experiment, we also use two special

test subsets. We compute the similarities between the pastand future contexts of each song in the Irish test set, pickthe top 10% similar pairs (past and future contexts are al-most the same) and bottom 10% pairs (almost different),and create the Irish-Test-R (repetition) and Irish-Test-NR(non-repetition) subsets.

From Table 1, we can see that SketchNet beats all othermodels for all test sets. The performance improved morefor pitch then for rhythm. The accuracy is almost the samebetween the 1st and 2nd model. Accuracy is slightly bet-ter if we use SketchInpainter to treat rhythm and pitch in-dependently during generation. Lastly, with the power oftransformer encoder and random unmasking process donein SketchConnector, we can achieve the best performanceby using SketchNet (bottom row in Table 1). We furtherfollow [23] to use the Bootstrap significance test to ver-ify the difference between each pair’s overall accuracy formodels in the whole Irish-Test set (Four models, i.e. sixpairs in total). The sample time is set to 10000. Aftercalculation, all p-values except the fist and second modelpair (p-value = 0.402) are less than 0.05, which proves thatSketchNet is different from the left three models.

In the repetition test subsets, the loss of Music Inpaint-Net is 0.312, which is lower enough to capture repetitionsin the musical context and fill in the missing part by copy-ing. In most cases, copying is the correct behaviour be-cause the original melody has repetitive pattern structures.The loss is a measurement to evaluate if the model canlearn the repetitive pattern and copy mechanism from thedata. the SketchNet slightly outperforms InpaintNet.

3.3.2 Subjective Listening Test

However, the more interesting result is the generation withnon-repetition subset. In this case, models cannot merelycopy because original melodies do not repeat its content.We see higher losses in all models in this subset comparedto the repetition subset. Intuitively, it means that repetitivepatterns are essential to the reconstruction task, not nec-essarily the expressivity of the generated output would beless.

To further evaluate the proposed SketchNet, we con-duct an online subjective listening test to let subjects judgethe generated melodies from the non-repetition subset.Each subject will listen to three 32-second piano-rendered

arXiv:2008.01291v1 [cs.LG] 4 Aug 2020· pitch), (2) a rhythm encoder Q ˝(z rhythmjx rhythm), and (3) a hierar-chical decoder P ˚(xjz pitch;z rhythm) as shown in Figure 4. 2.2.1 - [PDF Document] (6)

PastContext FutureContextGeneration

{Ab5,Db6,Eb6,Gb6} {C6,Eb6,Db6,F6,Db6} {F6,Gb6,Ab6,Ab6,F6} {Db6,F6,Ab6,Bb6,Db6}







Figure 7. An example of sketch generation. From top to bottom: original, pitch/rhythm/mixture control. The blue pitchtexts denote pitch controls, and the pink segments denote rhythm controls.

Control Info. Rhythm PitchPitch Acc. 0.189 0.881

Rhythm Acc. 0.973 0.848

Table 3. The accuracy of the virtual control experiment.

melodies: the original, the Music InpaintNet’s genera-tion, and the SketchNet’s generation. Songs are randomlypicked from the Irish-Test-NR set. The beginning and end-ing (past & future) are the same for the three melodies.Since the subjective feeling of music is complicated toquantify, we chose three criteria: the number of notes(complexity), the repetitiveness between musical struc-tures (structure), and the degree of harmony of the music(overall musicality). In this way, subjects with differentlevels of music skills can all give reasonable answers.

Before rating the songs, subjects will see three criteriadescriptions as we introduced below. The rating is rangedfrom 1.0 to 5.0 with a 0.5 step. We collected 318 sur-veyed results from 106 subjects (each subject listens tothree groups, nine melodies in total). The average rating ofeach criteria for all models are shown in Table 2. The sub-jective evaluations of all three criteria in SketchNet are bet-ter for those of Music InpaintNet. Similar to section 3.3.1,we also conduct a pairwise significance test via Bootstrapin three criteria. All p-values except the <complexity: In-paintNet, SketchNet> (p-value = 0.364) are less than 0.05.It proves that three models (including original songs) aresignificantly different in structure and overall musicality(subjective feeling to a person). As for the complexity, webelieve that the results generated by the two models aresimilar in terms of the richness of notes, and our modeldoes not significantly increase the number of notes gener-ated.

3.4 Sketch Scenario Usage

The contribution of Music SketchNet is not only shown inthe performance of the generation in section 3.3, but canalso be shown in the interactive scenario where users cancontrol the generated output by specifying the rhythm orpitch contour in each measure.

Figure 7 shows an example of a non-repetition subsetmelody, where the first and last two measures are given,and the middle parts is generated. The first track is the

original melody, the second track is generated with thepitch contour control, the third track is generated with therhythm control, and the fourth track is controlled with bothpitch and rhythm. We can see that each generated melodyfollows the control from users and develops music phrasesaccordingly in the missing part. Moreover, each measureis in line with the past and future measures even in the caseof scale shift.

We also provide a "virtual control experiment" to statis-tically show that users’ control did influence the model’sgeneration process. We randomly collect 3000 samplepairs (A, B) from the Irish-Test set. And we use thepitch/rhythm of Sample B to be the sketch informationin the same missing position of Sample A. Then we letthe model make the generation. We then compute thepitch/rhythm accuracy 2 in the missing position betweenthe generation and Song B. From 3 we can see if we sketchsong B’s rhythm into the model, the generation will followthe rhythm with 97.3% accuracy but has different (18.9%)pitches. However, when we sketch pitches, the pitchesin the generation will be highly (88.1%) in line with thesketching. This proves that the user’s control has a rela-tively high guiding effect on the result of the model gener-ated at the specified position.


In this paper, we propose a new framework to explore de-coupling latent variables in music generation. We furtherconvert this decoupling into controllable parameters thatcan be specified by the user. The proposed Music Sketch-Net achieves the best results in the objective and subjectiveevaluations. Practically, we show the framework’s applica-tion for the music sketching scenario where users can con-trol the pitch contour and/or rhythm of the generated re-sults. There are several possible extensions for this work.Music elements other than pitch and rhythm can be appliedinto the music sketching scenario by the latent variable de-coupling. Also, how to represent a polyphonic music piecein the latent space is another pressing issue. Both are fu-ture works that can generalize this model to more appliedscenarios.

2 The metric to calculate the pitch accuracy is different from section3.3.1, because the generated pitches in the new song might have differentonset positions. We leverage the Longest Common Sequence to calculatethe accuracy. The implementation is presented in the code archive.

arXiv:2008.01291v1 [cs.LG] 4 Aug 2020· pitch), (2) a rhythm encoder Q ˝(z rhythmjx rhythm), and (3) a hierar-chical decoder P ˚(xjz pitch;z rhythm) as shown in Figure 4. 2.2.1 - [PDF Document] (7)


We would like to thank Cygames for the partial support ofthis research.


[1] G. Loy, Composing with Computers - a Survey of SomeCompositional Formalisms and Music ProgrammingLanguages. MIT Press, 1990.

[2] J. Briot, G. Hadjeres, and F. Pachet, Deep LearningTechniques for Music Generation. Springer, 2020.

[3] H. Dong, W. Hsiao, L. Yang, and Y. Yang, “Musegan:Multi-track sequential generative adversarial networksfor symbolic music generation and accompaniment,” inProceedings of the Thirty-Second AAAI Conference onArtificial Intelligence. AAAI Press, 2018, pp. 34–41.

[4] G. Hadjeres, F. Pachet, and F. Nielsen, “Deepbach: asteerable model for bach chorales generation,” in Pro-ceedings of the 34th International Conference on Ma-chine Learning, ICML, 2017, pp. 1362–1371.

[5] C. A. Huang, A. Vaswani, J. Uszkoreit, I. Simon,C. Hawthorne, N. Shazeer, A. M. Dai, M. D. Hoffman,M. Dinculescu, and D. Eck, “Music transformer: Gen-erating music with long-term structure,” in 7th Interna-tional Conference on Learning Representations, ICLR,New Orleans, LA, USA.

[6] C. Barnes, E. Shechtman, A. Finkelstein, and D. B.Goldman, “Patchmatch: a randomized correspondencealgorithm for structural image editing,” ACM Trans.Graph., vol. 28, no. 3, p. 24, 2009.

[7] Y. Güçlütürk, U. Güçlü, R. van Lier, and M. A. J.van Gerven, “Convolutional sketch inversion,” in Com-puter Vision ECCV Workshops. Amsterdam, TheNetherlands: Springer, 2016, pp. 810–824.

[8] P. Sangkloy, J. Lu, C. Fang, F. Yu, and J. Hays, “Scrib-bler: Controlling deep image synthesis with sketch andcolor,” in 2017 IEEE Conference on Computer Visionand Pattern Recognition, CVPR. Honolulu, HI, USA:IEEE Computer Society, 2017, pp. 6836–6845.

[9] Q. Yu, F. Liu, Y. Song, T. Xiang, T. M. Hospedales,and C. C. Loy, “Sketch me that shoe,” in 2016 IEEEConference on Computer Vision and Pattern Recogni-tion, CVPR. Las Vegas, NV, USA: IEEE ComputerSociety, 2016, pp. 799–807.

[10] K. Xu, K. Chen, H. Fu, W. Sun, and S. Hu,“Sketch2scene: sketch-based co-retrieval and co-placement of 3d models,” ACM Trans. Graph., 2013.

[11] J. Sakellariou, , F. Tria, L. Vittorio, and F. Pachet,“Maximum entropy model for melodic patterns,” inICML Workshop on Constructive Machine Learning,2015.

[12] G. Hadjeres and F. Nielsen, “Anticipation-rnn: enforc-ing unary constraints in sequence generation, with ap-plication to interactive music generation,” Neural Com-puting and Applications, 2018.

[13] A. Pati, A. Lerch, and G. Hadjeres, “Learning to tra-verse latent spaces for musical score inpainting,” inProceedings of the 20th International Society for Mu-sic Information Retrieval Conference, ISMIR, Delft,The Netherlands, 2019, pp. 343–351.

[14] D. P. Kingma and M. Welling, “Auto-encoding vari-ational bayes,” in 2nd International Conference onLearning Representations, ICLR, Banff, AB, Canada,2014.

[15] A. Roberts, J. H. Engel, C. Raffel, C. Hawthorne, andD. Eck, “A hierarchical latent vector model for learn-ing long-term structure in music,” in Proceedings ofthe 35th International Conference on Machine Learn-ing, ICML. Stockholm, Sweden: PMLR, 2018, pp.4361–4370.

[16] R. Yang, D. Wang, Z. Wang, T. Chen, J. Jiang, andG. Xia, “Deep music analogy via latent representationdisentanglement,” in Proceedings of the 20th Interna-tional Society for Music Information Retrieval Confer-ence, ISMIR, Delft, The Netherlands, 2019, pp. 596–603.

[17] B. Genchel, A. Pati, and A. Lerch, “Explicitly condi-tioned melody generation: A case study with interde-pendent rnns,” in Proceedings of the 7th InternationalWorkshop on Musical Meta-creation, MUME, 2019.

[18] K. Cho, B. van Merrienboer, Ç. Gülçehre, D. Bah-danau, F. Bougares, H. Schwenk, and Y. Bengio,“Learning phrase representations using RNN encoder-decoder for statistical machine translation,” in Pro-ceedings of the 2014 Conference on Empirical Meth-ods in Natural Language Processing, EMNLP. Doha,Qatar: ACL, 2014, pp. 1724–1734.

[19] S. Bengio, O. Vinyals, N. Jaitly, and N. Shazeer,“Scheduled sampling for sequence prediction with re-current neural networks,” in Advances in Neural In-formation Processing Systems 28: Annual Conferenceon Neural Information Processing Systems, Montreal,Quebec, Canada, 2015, pp. 1171–1179.

[20] A. Goyal, A. Lamb, Y. Zhang, S. Zhang, A. C.Courville, and Y. Bengio, “Professor forcing: A newalgorithm for training recurrent networks,” in Advancesin Neural Information Processing Systems 29: An-nual Conference on Neural Information ProcessingSystems, Barcelona, Spain, 2016, pp. 4601–4609.

[21] J. Devlin, M. Chang, K. Lee, and K. Toutanova,“BERT: pre-training of deep bidirectional transform-ers for language understanding,” in Proceedings of the2019 Conference of the North American Chapter ofthe Association for Computational Linguistics: Human

arXiv:2008.01291v1 [cs.LG] 4 Aug 2020· pitch), (2) a rhythm encoder Q ˝(z rhythmjx rhythm), and (3) a hierar-chical decoder P ˚(xjz pitch;z rhythm) as shown in Figure 4. 2.2.1 - [PDF Document] (8)

Language Technologies, NAACL-HLT. Minneapolis,MN, USA: Association for Computational Linguistics,2019, pp. 4171–4186.

[22] B. L. Sturm, J. F. Santos, O. Ben-Tal, and I. Kor-shunova, “Music transcription modelling and composi-tion using deep learning,” in Conference on ComputerSimulation of Musical Creativity, CSMC, 2016.

[23] T. Berg-Kirkpatrick, D. Burkett, and D. Klein, “An em-pirical investigation of statistical significance in NLP,”in Proceedings of the 2012 Joint Conference on Em-pirical Methods in Natural Language Processing andComputational Natural Language Learning, EMNLP-CoNLL. ACL, 2012, pp. 995–1005.

arXiv:2008.01291v1 [cs.LG] 4 Aug 2020 · pitch), (2) a rhythm encoder Q ˝(z rhythmjx rhythm), and (3) a hierar-chical decoder P ˚(xjz pitch;z rhythm) as shown in Figure 4. 2.2.1 - [PDF Document] (2024)


Top Articles
Latest Posts
Article information

Author: Reed Wilderman

Last Updated:

Views: 5289

Rating: 4.1 / 5 (72 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Reed Wilderman

Birthday: 1992-06-14

Address: 998 Estell Village, Lake Oscarberg, SD 48713-6877

Phone: +21813267449721

Job: Technology Engineer

Hobby: Swimming, Do it yourself, Beekeeping, Lapidary, Cosplaying, Hiking, Graffiti

Introduction: My name is Reed Wilderman, I am a faithful, bright, lucky, adventurous, lively, rich, vast person who loves writing and wants to share my knowledge and understanding with you.