How to use the musictheory.sidePlay 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 previewbpm(bpm):
    c = musictheory.chunk(5)
    ins = filezart.getInstrument("Drum_Snare")
    for i in c.wholes():
        c.add(i, mnote.fromName("C0"))
    sidePlay(c.getAudio(ins, bpm))
github joaoperfig / mikezart / source / mikezario.py View on Github external
def previewscale(scale):
    sidePlay(scale.sample())
github joaoperfig / mikezart / source / mikezario.py View on Github external
def previewThemeAudioMenu(theme, pal, tag): 
    try:
        print("Please specify parameters:")
        print("Input intensity [0-1]")
        intensity=eval(usrinp())
        print("Input size [0-1]")
        size=eval(usrinp())
        print("Input general lines overlay [0-1]")
        gen=eval(usrinp())
        print("Input chorus lines overlay [0-1]")
        cho=eval(usrinp())
        part = markovzart2.Part(tag, intensity, size, gen, cho)
        sidePlay(part.getAudio(pal, pal._bpm))
    except Exception as e:
        print("Something went very wrong")
        print("Your exception:", e)
        print("...\nReturning\n...")
github joaoperfig / mikezart / source / mikezario.py View on Github external
print("Returning")
            else:
                try:
                    pan = eval(inp)
                    voice._pan = pan
                except:
                    print("Bad input, returning")            
                
         
        elif inp in "Tt":
            print(voice.toTab()+"\n")
            
        elif inp in "Pp":
            sidePlay(voice.getAudio(pal._bpm))
        elif inp in "Ss":
            sidePlay(voice.partialAudio(0.01, pal._bpm))
            
        elif inp in "Cc":
            try:
                part = markovzart2.Part(tag, 1, 1, 0, 0)
                sidePlay(part.getAudio(pal, pal._bpm))
            except:
                "Something went wrong with playing your audio"      
        elif inp in "Xx":
            try:
                part = markovzart2.Part(tag, 1, 0.01, 0, 0)
                sidePlay(part.getAudio(pal, pal._bpm))
            except:
                "Something went wrong with playing your audio"                  
            
        elif inp in "Uu":
            print("Reverting to previous state...")
github joaoperfig / mikezart / source / mikezario.py View on Github external
def previewChord(chord):
    sidePlay(chord.sampleAudio())
github joaoperfig / mikezart / source / mikezario.py View on Github external
def previewProg(prog):
    audiolen = (1000*len(prog))+3000
    audio = AudioSegment.silent(audiolen)
    for i in range(len(prog)):
        try:
            audio = audio.overlay(prog[i].sampleAudio(), i*1000)
        except:
            print("Error: non chord in progression!")
    sidePlay(audio)
github joaoperfig / mikezart / source / mikezario.py View on Github external
if vid == None:
                            break
                        if vid >= len(theme._voices[typ]):
                            print("ID out of range")
                        else:
                            editVoiceMenu(theme._voices[typ][vid], theme, pal, path, tag)
                            break
                    break
        elif inp in "Ss":
            editSortingMenu(theme, pal, tag, path)
        elif inp in "Aa":
            previewThemeAudioMenu(theme, pal, tag)
        elif inp in "Ff":
            try:
                part = markovzart2.Part(tag, 1, 1, 0, 0)
                sidePlay(part.getAudio(pal, pal._bpm))
            except:
                "Something went wrong with playing your audio"
        elif inp in "Xx":
            try:
                part = markovzart2.Part(tag, 1, 0.01, 0, 0)
                sidePlay(part.getAudio(pal, pal._bpm))
            except:
                "Something went wrong with playing your audio"
        elif inp in "Dd":
            print("Theme",tag,"properties:")
            print("Scale:", theme._scale)
            print("Progression:", theme._cprog)
            print("Csize:", theme._csize)
            print("Voices:")
            for vt in list(theme._voices):
                print("    "+vt+":")