How to use the musictheory.listNotes 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 / mikezario.py View on Github external
def printInsts(insts):
    print("Selected instruments:")
    for inst in insts:
        notes = musictheory.listNotes(inst)
        bot = min(notes)
        top = max(notes)
        print(inst._name)
        print(inst._type)
        print(bot, "-", top)
        print()
    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
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()
github joaoperfig / mikezart / source / mikezart2.py View on Github external
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
github joaoperfig / mikezart / source / mikezart2.py View on Github external
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:
github joaoperfig / mikezart / source / mikezario.py View on Github external
print("Aa - Preview Audio")
        print("Ff - Fast Preview (Xx - Short Preview)")
        print("Dd - Display Theme Properties") 
        print("Ii - Scale Info") 
        print("Qq - Quit")
        inp =  usrinp()
        if inp in "Vv":
            print(path + " > Voice Creation")
            print("Choose the type of the voice you are going to create:")
            typ = requestTypeMenu() 
            if typ == None:
                print("Returning")
            else:
                print(path + " > "+typ+" Voice Creation")
                inst = chooseInstMenu() 
                centre = chooseCentreMenu(musictheory.listNotes(inst))
                mtype = typ
                print("Creating Voice")
                print("...")
                voic = musictheory.voice(inst, centre, theme._scale, mtype)
                voic.autoProg(theme._cprog, theme._progc, theme._csize, 0, None, None)
                print("Your Voice,", voic, ", was created, are you sure you want to add it? Yy Nn")
                while True:
                    inp = usrinp()
                    if inp in "Yy":
                        print("Adding voice")
                        theme.addVoiceAsIs(voic)
                        print("Voice Added")
                        print("Last Voice in its category")
                        print("Last Voice in sorting")
                        break
                    elif inp in "Nn":
github joaoperfig / mikezart / source / mikezart2.py View on Github external
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)
github joaoperfig / mikezart / source / mikezart2.py View on Github external
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: