コード例 #1
0
ファイル: mikezart2.py プロジェクト: gisforgirard/mikezart
def mtest():
    inst = rselect(ipack("churchpiano"))
    scale = musictheory.scale7()
    progsize = rselect((2,3,4,5,6))
    progcount = rselect((1,2,3,4,5))
    csize = wselect({2:5, 3:10, 4:20, 5:10, 6:5})
    bpm = wselect({80:5, 100:10, 120:20, 140:10, 160:5, 180:5})   
    palett = musictheory.palette(scale, progsize, progcount, csize)
    palett._bpm = bpm
    palett.autoProgs()    
    centre = rselect(musictheory.listNotes(inst))
    ncount = wselect(musictheory.chordicCWeights())
    palett._n1.addVoice(inst, centre, "chordic", ncount)  
    
    inst = rselect(ipack("guitars"))
    centre = rselect(musictheory.listNotes(inst))
    ncount = wselect(musictheory.chordicCWeights())
    voic = musictheory.voice(inst, centre, scale, "chordic", 0, 0)
    voic.mimic(palett._n1._voices["chordic"][0])
    palett._n1.addVoiceAsIs(voic)      
    
    inst = rselect(ipack("cellopack"))
    centre = rselect(musictheory.listNotes(inst))
    ncount = wselect(musictheory.chordicCWeights())    
    palett._n1.addVoice(inst, centre, "chordic", ncount)  
    
    play(palett._n1.previewAudio(bpm))    
    print(palett._n1._voices["chordic"][0]._cent)
    print(palett._n1._voices["chordic"][1]._cent)
コード例 #2
0
ファイル: mikezart2.py プロジェクト: gisforgirard/mikezart
def palFromInsts(cinsts, sminsts, lminsts, pinsts, ginsts, name=None):
    if name == None:
        name = naming.name()
    scale = musictheory.scale7()
    progsize = rselect((2,3,4,5,6))
    progcount = rselect((1,2,3,4,5))
    csize = wselect({2:5, 3:10, 4:20, 5:10, 6:5})
    bpm = wselect({80:5, 100:10, 120:20, 140:10, 160:5, 180:5})
    print("making",name)
    
    palett = musictheory.palette(scale, progsize, progcount, csize)
    palett._bpm = bpm
    palett.autoProgs()
    themes = (palett._n1, palett._n2, palett._bg, palett._ch, palett._ge)
    
    for inst in cinsts:
        for them in themes:
            centre = rselect(musictheory.listNotes(inst))
            ncount = wselect(musictheory.chordicCWeights())
            them.addVoice(inst, centre, "chordic", ncount)
            
    for inst in sminsts:
        for them in themes:
            centre = rselect(musictheory.listNotes(inst))
            ncount = wselect(musictheory.smelodicCWeights())
            them.addVoice(inst, centre, "smelodic", ncount)
            
    for inst in lminsts:
        for them in themes:
            centre = rselect(musictheory.listNotes(inst))
            ncount = wselect(musictheory.lmelodicCWeights())
            them.addVoice(inst, centre, "lmelodic", ncount)
            
    for inst in pinsts:
        for them in themes:
            centre = rselect(musictheory.listNotes(inst))
            ncount = wselect(musictheory.percussionCWeights())
            them.addVoice(inst, centre, "percussion", ncount)
            
    for inst in ginsts:
        for them in themes:
            centre = rselect(musictheory.listNotes(inst))
            ncount = wselect(musictheory.genericCWeights())
            them.addVoice(inst, centre, "generic", ncount)    
            
    for t in themes:
        t.shuffleSort()
            
    filezart.makeFolder("../exports/song_" + name)
    palett.infoToFolder(bpm, "../exports/song_" + name)
    
    #play(palett._n1.previewAudio(bpm))
    #play(palett._n2.previewAudio(bpm))
    #play(palett._bg.previewAudio(bpm))
    #play(palett._ch.previewAudio(bpm))
    
    print("done with", name)
            
    return palett
コード例 #3
0
ファイル: mikezart2.py プロジェクト: gisforgirard/mikezart
def adjustTest(pack = None, splay=True):
    if pack == None:
        pack = filezart.getInfo()
    else:
        pack = filezart.getPack(pack)
    for i in pack:
        clip = musictheory.getNote(i, musictheory.listNotes(i)[len(musictheory.listNotes(i))//2])
        dest = -30
        if splay:
            play(clip)
        print("audio:",clip.max_dBFS)
        print("delta:",dest-clip.max_dBFS)
コード例 #4
0
ファイル: mikezart2.py プロジェクト: gisforgirard/mikezart
def palFromInstsAndMimics(cinsts, sminsts, lminsts, pinsts, ginsts, miminsts, name=None):
    if name == None:
        name = naming.name()
    scale = musictheory.scale7()
    progsize = rselect((2,3,4,5,6))
    progcount = rselect((1,2,3,4,5))
    csize = wselect({2:5, 3:10, 4:20, 5:10, 6:5})
    bpm = wselect({80:5, 100:10, 120:20, 140:10, 160:5, 180:5})
    print("making",name)
    palett = musictheory.palette(scale, progsize, progcount, csize)
    palett._bpm = bpm
    palett.autoProgs()
    themes = (palett._n1, palett._n2, palett._bg, palett._ch, palett._ge)
    for inst in cinsts:
        for them in themes:
            centre = rselect(musictheory.listNotes(inst))
            ncount = wselect(musictheory.chordicCWeights())
            them.addVoice(inst, centre, "chordic", ncount)  
    for inst in sminsts:
        for them in themes:
            centre = rselect(musictheory.listNotes(inst))
            ncount = wselect(musictheory.smelodicCWeights())
            them.addVoice(inst, centre, "smelodic", ncount)
    for inst in lminsts:
        for them in themes:
            centre = rselect(musictheory.listNotes(inst))
            ncount = wselect(musictheory.lmelodicCWeights())
            them.addVoice(inst, centre, "lmelodic", ncount)
    for inst in pinsts:
        for them in themes:
            centre = rselect(musictheory.listNotes(inst))
            ncount = wselect(musictheory.percussionCWeights())
            them.addVoice(inst, centre, "percussion", ncount)
    for inst in ginsts:
        for them in themes:
            centre = rselect(musictheory.listNotes(inst))
            ncount = wselect(musictheory.genericCWeights())
            them.addVoice(inst, centre, "generic", ncount)    
    for inst in miminsts:
        for them in themes:
            toCopy = rselect(them._voices["chordic"] + them._voices["smelodic"])
            centre = rselect(musictheory.listNotes(inst))
            ncount = wselect(musictheory.chordicCWeights())
            voic = musictheory.voice(inst, centre, scale, "chordic", 0, 0)
            try:
                voic.mimic(toCopy)
                them.addVoiceAsIs(voic)                  
            except:
                print("could not mimic!")
    for t in themes:
        t.shuffleSort()
            
    filezart.makeFolder("../exports/song_" + name)
    palett.infoToFolder(bpm, "../exports/song_" + name)

    print("done with", name)
            
    return palett    
コード例 #5
0
ファイル: mikezart2.py プロジェクト: gisforgirard/mikezart
def testInst(name):
    inst = filezart.getInstrument(name)
    scale = musictheory.scale7()
    progsize = rselect((2,3,4,5,6))
    progcount = rselect((1,2,3,4,5))
    csize = wselect({2:5, 3:10, 4:20, 5:10, 6:5})
    bpm = wselect({80:5, 100:10, 120:20, 140:10, 160:5, 180:5})   
    palett = musictheory.palette(scale, progsize, progcount, csize)
    palett._bpm = bpm
    palett.autoProgs()    
    for i in range(2):
        centre = rselect(musictheory.listNotes(inst))
        ncount = wselect(musictheory.chordicCWeights())
        palett._n1.addVoice(inst, centre, "chordic", ncount)    
    play(palett._n1.previewAudio(bpm))
コード例 #6
0
ファイル: tester.py プロジェクト: gisforgirard/mikezart
import musictheory as mt
import filezart as fz
import markovzart2

scale = mt.scale7()
cprog = (mt.chord3.fromScale(scale), mt.chord3.fromScale(scale),
         mt.chord3.fromScale(scale), mt.chord3.fromScale(scale))
progcount = 4
csize = 4

t = mt.theme(scale, cprog, progcount, csize)

inst = fz.getInfo()[0]
centre = mt.rselect(mt.listNotes(inst))
mtype = "chordic"

t.addVoice(inst, centre, mtype)
t.addVoice(inst, centre, mtype)

print(t.sortingString())

markovzart2.pooptest()