예제 #1
0
파일: fns.py 프로젝트: ryanfmurphy/music
def ev_funcs(env, drums=False):
    debug_log("ev_funcs")
    if is_module(env):
        env = env.__dict__
    funcs = get_funcs(env).items()
    random.shuffle(funcs)
    for func_name, func in funcs:
        debug_log("  top of loop")
        debug_log("func", func)
        if coinflip():
            times = 1
        else:
            times = options(1, 2, 4)
        for x in range(times):
            if drums:
                events = midi.zipe(ev_func(func),
                                   midi.ev_drums(dur=DURATION),
                                   dont_finish={1})
            else:
                events = ev_func(func)
            for e in events:
                yield e
        debug_log("  maybe delay!")
        for e in ev_maybe_delay():
            debug_log("  yes delay!")
            yield e
예제 #2
0
파일: fns.py 프로젝트: ryanfmurphy/music
def ev_goof_around(env, drums=False, overall_drums=False):
    while True:
        if overall_drums:
            events = midi.zipe(
                ev_funcs(env, drums=drums),
                midi.ev_drums(dur=DURATION),
            )
        else:
            events = ev_funcs(env, drums=drums)
        for e in events:
            yield e
예제 #3
0
파일: fns.py 프로젝트: ryanfmurphy/music
def ev_goof_around(env, drums=True, overall_drums=False):
    while True:
        # drums to be zipped alongside/independent?
        if overall_drums:
            events = midi.zip_events(
                ev_funcs(env, drums=drums),
                midi.ev_drums(dur=DURATION),
            )
        # vs drums being tightly coupled (if present)
        else:
            events = ev_funcs(env, drums=drums)
        # go thru the events
        for e in events:
            yield e
예제 #4
0
파일: fns.py 프로젝트: ryanfmurphy/music
def ev_funcs(env, drums=False):
    if is_module(env):
        env = env.__dict__
    funcs = get_funcs(env).items()
    random.shuffle(funcs)
    for func_name,func in funcs:
        debug_log("func",func)
        if coinflip():
            times = 1
        else:
            times = options(1,2,4)
        for x in range(times):
            if drums:
                events = midi.zipe(
                    ev_func(func),
                    midi.ev_drums(dur=DURATION),
                    dont_finish={1}
                )
            else:
                events = ev_func(func)
            for e in events:
                yield e
        for e in ev_maybe_delay():
            yield e