def main(opts): if not opts.demo: from reader import Reader global q delay = 0.001 lights = {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0} print opts if not opts.demo: reader = Reader(lights) sounder = Sounder() player = Player(sounder) songs = os.listdir("./songs/") songs = filter(lambda x: x.endswith(".js"), songs) numpy.random.shuffle(songs) print ("Loaded songs:") print (songs) for song in cycle(songs): # time.sleep(.5) q = player.song(song) while True: debug_str = "" time.sleep(delay) if not opts.demo: reader.fetch() if not q["play"].empty(): player.chord(q["play"].get_nowait()) for ch in lights: debug_str += "{}:{} ".format(ch, lights[ch]) if lights[ch] < 650 or opts.demo: sounder.start(get_str(ch)) else: sounder.stop(get_str(ch)) # print(debug_str) time.sleep(delay) if q["sig"] == "stopped": print "caught sig... stopping song" sounder.mute() break
def main(opts): if not opts.demo: from reader import Reader global q delay = .001 lights = {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0} print opts if not opts.demo: reader = Reader(lights) sounder = Sounder() player = Player(sounder) songs = ["breathe", "hotrs", "wishhere", "polly", "ripple"] for song in cycle(songs): #time.sleep(.5) q = player.song(song) while True: debug_str = "" time.sleep(delay) if not opts.demo: reader.fetch() if not q["play"].empty(): player.chord(q["play"].get_nowait()) for ch in lights: debug_str += "{}:{} ".format(ch, lights[ch]) if lights[ch] < 650 or opts.demo: sounder.start(get_str(ch)) else: sounder.stop(get_str(ch)) print(debug_str) time.sleep(delay) if q["sig"] == "stopped": print "caught sig... stopping song" sounder.mute() break
def main(opts): if not opts.demo: from reader import Reader global q delay = .001 lights = {0:0, 1:0, 2:0, 3:0, 4:0, 5:0} print opts if not opts.demo: reader = Reader(lights) sounder = Sounder() player = Player(sounder) songs = ["breathe", "hotrs", "wishhere", "polly", "ripple"] for song in cycle(songs): #time.sleep(.5) q = player.song(song) while True: debug_str = "" time.sleep(delay) if not opts.demo: reader.fetch() if not q["play"].empty(): player.chord(q["play"].get_nowait()) for ch in lights: debug_str += "{}:{} ".format(ch, lights[ch]) if lights[ch] < 650 or opts.demo: sounder.start(get_str(ch)) else: sounder.stop(get_str(ch)) print(debug_str) time.sleep(delay) if q["sig"] == "stopped": print "caught sig... stopping song" sounder.mute() break