In the context of an educational software tool that can generate novel jazz solos using a probabilistic grammar (Keller 2007), this article describes the automated learning of such grammars. Learning takes place from a corpus of transcriptions, typically from a single performer, and our methods attempt to improvise solos representative of such a style. In order to capture idiomatic gestures of a specific soloist, we extend an earlier grammar representation (Keller and Morrison 2007) with a technique for representing melodic contour. Representative contours are extracted from a corpus using clustering, and sequencing among contours is done using Markov chains that are encoded into the grammar. This article first defines the basic building blocks for contours of typical jazz solos, which we call slopes, then shows how these slopes may be incorporated into a grammar wherein the notes are chosen according to tonal categories relevant to jazz playing. We show that melodic contours can be accurately portrayed using slopes learned from a corpus. Experimental results, including blind comparisons of solos generated from grammars based on several corpora, are reported.