예제 #1
0
def pitchQuarterLengthUsage3D(show=True):
    
    from music21 import converter, graph
    from music21.musicxml import testFiles as xml
    from music21.humdrum import testFiles as kern

    mozartStream = music21.parse(
        xml.mozartTrioK581Excerpt)
    g = graph.Plot3DBarsPitchSpaceQuarterLength(
        mozartStream.flat.stripTies(), colors=['r'])
    g.process()
    
    chopinStream = music21.parse(kern.mazurka6)
    g = graph.Plot3DBarsPitchSpaceQuarterLength(
        chopinStream.flat.stripTies(), colors=['b']) 
    g.process()
예제 #2
0
def simple4d():
    # question 11: Assemble syllables into words for some vocal text.

    import webbrowser
    from music21 import converter
    from music21 import text
        
    for part in music21.parse('d:/web/eclipse/music21misc/musicxmlLib/Binchois.xml'):
        lyrics = text.assembleLyrics(part)
        if 'exultavit' in lyrics:
            print(lyrics)
            webbrowser.open('http://www.google.com/search?&q=' + lyrics)
예제 #3
0
파일: song.py 프로젝트: kroger/uirapuru
def make_songs_from_path(path, extension="xml"):
    filenames = glob.glob(os.path.join(path, "*/*.{0}".format(extension)))
    result = []

    # We need to catch the kern files that music21 doesn't know how to
    # read (usually the ones with complex rhythm)
    for filename in filenames:
        print filename
        try:
            score = music21.parse(filename)
            result.append(make_song(score, filename))
        except ValueError as error:
            print "ERROR: not reading file: ", filename, error
    return result
예제 #4
0
def simple4d():
    '''
    question 11: Assemble syllables into words for some vocal text.
    
    music21 extension: then Google the lyrics if they contain the word exultavit
    '''
    import webbrowser
    from music21 import converter
    from music21 import text
        
    for part in music21.parse('d:/web/eclipse/music21misc/musicxmlLib/Binchois.xml'):
        lyrics = text.assembleLyrics(part)
        if 'exultavit' in lyrics:
            print(lyrics)
            webbrowser.open('http://www.google.com/search?&q=' + lyrics)
예제 #5
0
파일: phasing.py 프로젝트: msampaio/music21
def pitchedPhase(cycles=None, show=False):
    '''
    Creates a phase composition in the style of 
    1970s minimalism, but bitonally.
    
    The source code describes how this works.
    
    >>> from music21 import *
    >>> #_DOCS_SHOW composition.phasing.pitchedPhase(cycles = 4, show = True)
    
    .. image:: images/phasingDemo.*
            :width: 576

    '''

    sSrc = music21.parse("""E16 F# B c# d F# E c# B F# d c# 
                              E16 F# B c# d F# E c# B F# d c#""", '12/16')
    sPost = stream.Score()
    sPost.title = 'phasing experiment'
    sPost.insert(0, stream.Part())
    sPost.insert(0, stream.Part())

    durationToShift = duration.Duration('64th')
    increment = durationToShift.quarterLength
    if cycles == None:
        cycles = int(round(1/increment)) + 1

    for i in range(cycles):
        sPost.parts[0].append(copy.deepcopy(sSrc))
        sMod = copy.deepcopy(sSrc)
        # increment last note
        sMod.notesAndRests[-1].quarterLength += increment
        
        randInterval = random.randint(-12,12)
        #sMod.transpose(randInterval, inPlace=True)
        sPost.parts[1].append(sMod)


    if show:
        sPost.show('midi')
        sPost.show()
    else: # get musicxml
        post = sPost.musicxml
예제 #6
0
파일: fugues.py 프로젝트: kroger/fugues
def parse_fugue(fuga_number, volume=1, ext='xml'):
    filename = 'wtc-{v}/wtc{v}f{n:02}.{ext}'.format(n=fuga_number, v=volume, ext=ext)
    return music21.parse(filename)
예제 #7
0
파일: fugues.py 프로젝트: kroger/fugues
def parse_answer(fugue_number, volume=1):
    answer_file = "answer/wtc-{v}-{n:02}.xml".format(n=fugue_number, v=volume)
    return music21.parse(answer_file)
예제 #8
0
파일: song.py 프로젝트: kroger/uirapuru
 def show(self):
     music21.parse(self.full_filename).show()