Example #1
0
def analize(text):
    # valid command list

    commandset = commands.givecommands()
    sounder = Sounder(commandset)
    index = sounder.search(text.lower().split())
    command = " ".join(commandset[index])
    return command
Example #2
0
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
Example #3
0
 def __init__(self):
     self.sounder = Sounder()
Example #4
0
dprint("\nProbabilities:")
if DEBUG:
    for b in B:
        dprint("{0} \nwith e={1} and d={2}".format(b, e_p[b.i], d_p[b.i],
                                                   sum(e_p[b.i].values()),
                                                   sum(d_p[b.i].values())))

# print "\nSafety check:"
# print accent_p(B[7],S[1])
# print duration_p(B[7],S[0])

# Two emission functions
# xpath = viterbi.viterbi(S,B,T,start_p,accent_p,duration_p)
# One emission function
xpath = viterbi.viterbi(S, B, T, start_p, accent_p)

print "\nAnd they said, in great unison, that The Path shalt be:"

sounder = Sounder(5)
sendlist = [(-1, 1, b) for b in range(0, 5)]
for x in xpath:
    print x
    # print "Hidden state, transition values ",T[x.i]
    sendlist[x.origin] = (ra.randint(60, 80), x.duration, x.origin)

print sendlist
sounder.set_notes(sendlist)
sounder.send_notes()
sounder.close()
Example #5
0
print("Kindly input your command.")

print("\n")

user_string = input()

print("\n")

print("Your command: %s" % user_string)

key_words_array = []
for a in dataset:
    key_words_array.append(a[1])

s = Sounder(key_words_array)


def get_user_words_array(user_string):
    user_array = user_string.split()
    for user_word in user_array:
        if user_word in s.get_reserved_sub_words():
            user_array.remove(user_word)
    return user_array


user_keywords = get_user_words_array(user_string)

print("\n")

index = s.search(user_keywords)
Example #6
0
 def __init__(self):
     self.modules = self.get_modules()
     self.chances = []
     self.searcher = Sounder()