How to use the musictheory.palette function in musictheory

To help you get started, we’ve selected a few musictheory examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github joaoperfig / mikezart / source / mikezart2.py View on Github external
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())
github joaoperfig / mikezart / source / mikezario.py View on Github external
def paletteMenu():
    while True:
        print("Starting Palette creation:")
        bpm = bpmMenu()
        csize = csizeMenu()
        progsize = psizeMenu()
        progcount = progcMenu()
        scale = scaleMenu()
        pal = musictheory.palette(scale, progsize, progcount, csize)
        pal._bpm = bpm
        while True:
            print("Palette created, Accept? Yy Nn(redo) Qq(quit):")
            inp = usrinp()
            if inp in "Yy":
                name = nameMenu()
                paletteEdit(pal, name)
                return
            elif inp in "Nn":
                print("Retrying:")
                break
            elif inp in "Qq":
                return
github joaoperfig / mikezart / source / mikezart2.py View on Github external
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))
github joaoperfig / mikezart / source / mikezart2.py View on Github external
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))
github joaoperfig / mikezart / source / mikezart2.py View on Github external
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)