コード例 #1
0
ファイル: ismir2010.py プロジェクト: vpadilla/music21
def  pitchDensity(show=True):

    #from music21 import corpus, graph
    
    beethovenScore = corpus.parseWork('opus133.xml')
    celloPart = beethovenScore.getElementById('Cello')
    
    #First, we take a "flat" view of the Stream, which removes nested containers such as Measures. Second, we combine tied notes into single notes with summed durations.
    
    notes = celloPart.flat.stripTies()
    g = graph.PlotScatterPitchClassOffset(notes, 
        title='Beethoven Opus 133, Cello', alpha=.2)
    g.process()
コード例 #2
0
ファイル: smt2010.py プロジェクト: musescore/randomsheetmusic
def ex04(show=True, *arguments, **keywords):

    # This example, by graphing pitch class over note offset, shows the usage of pitch classes in the violoncello part over the duration of the composition. While the display is coarse, it is clear that the part gets less chromatic towards the end of the work.

    if 'op133' in keywords.keys():
        sStream = keywords['op133']
    else:
        sStream = corpus.parse('opus133.xml')  # load a MusicXML file

    # note: measure numbers are not being shown correcntly
    # need to investigate
    part = sStream[3]

    g = graph.PlotScatterPitchClassOffset(part.flat,
                                          title=part.getInstrument().partName)
    if show:
        g.process()