Esempio n. 1
0
def open(inp):
    dir = os.getcwd()
    dir = dir + "\shortcuts"
    print("Opening file from: " + dir)
    inp.title()
    try:
        os.startfile(dir + "\\" + inp + ".lnk")
    except:
        tts.play("Shortcut not found")
Esempio n. 2
0
import html2text
import sys

if len(sys.argv) != 3:
    print("Usage: python3 src <post count> <skip>")
    exit(1)

count = int(sys.argv[1])
skip = int(sys.argv[2])


intro = "This video was generated by the automatic video generation tool built by Evan Pratten."

## Video Start ##
tts.write(intro)
tts.play()

feed = reddit.getRss("prorevenge")["entries"][skip:]
for i in range(count):
    title = reddit.parse(feed[i])["title"]
    body = html2text.html2text(reddit.parse(feed[i])["body"])

    tts.write(title)
    output.writeTitle(title)
    tts.play()

    tts.write(body)
    tts.play()

    output.clearAll()
    time.sleep(1)
Esempio n. 3
0
            #insert historgram
            h, w = frame_grayscale.shape
            frame_grayscale[h - hist_height:frame_grayscale.shape[0],
                            w - hist_width:frame_grayscale.shape[1]] = hist_img

        cv2.imshow("video color", frame)
        cv2.imshow("video grayscale", frame_grayscale)
        cv2.waitKey(1)

    for barcode_json in barcode_data_list:
        if barcode_json["type"] == "word":
            #play_cmd = "aplay /home/pi/qrcode/pizerow/sounds/{0}.wav".format(barcode_json["sound"])
            #os.system(play_cmd)

            db.insert_obj(barcodeData)

            sound = barcode_json["sound"]
            tts.play("{}; for {}".format(sound[0].upper(), sound.capitalize()))

        elif barcode_json["type"] == "wifi-config":
            wifi_config.update(barcode_json)

    frame_ctr += 1
    bench_freq = frame_ctr / (time.time() - start_time)
    print("avg FPS: {0:.3f}".format(bench_freq))

# close the output CSV file do a bit of cleanup
print("[INFO] cleaning up...")
cv2.destroyAllWindows()
vs.stop()
Esempio n. 4
0
r = sr.Recognizer()
mic = sr.Microphone()

while True:
    with mic as source:
        print('Say something!')
        audio = r.listen(source)

    # recognize speech using Google Speech Recognition
    try:
        said = r.recognize_google(audio)
        # Recognize google audio is currently being ran with default google key
        # If used in production, change api key to non default one.
        print("Google Speech Recognition thinks you said " + said)
    except sr.UnknownValueError:
        tts.play("I don't understand. Could you repeat that?")
    except sr.RequestError as e:
        print("Could not request results from Google Speech Recognition service; {0}".format(e))

    if "hey Alex" in said:
        tts.play('Yes?')
        listening = True

    if listening:
#        if said == "what is your goal" or said == "what's your goal":
#            tts.play('World domination ha ha ha')
#
#            listening = False
        if said.startswith("call me"):
            name = said.replace("call me", '')
            tts.play("Hello, " + name)
Esempio n. 5
0
import speech_recognition as sr
import api2
import tts

sample_rate = 48000  #how often values are recorded
chunk_size = 2048   #buffer
r = sr.Recognizer()

with sr.Microphone(sample_rate = sample_rate, chunk_size = chunk_size) as source:
    r.adjust_for_ambient_noise(source)
    print("Say something now!")
    audio = r.listen(source)
    try:
        text = r.recognize_google(audio)
        t = list(text)
        t[0] = t[0].capitalize()
        text = ''.join(t)    
        print("you said: " + text)
        response = api2.checkGrammar(text)
        print(response)
        tts.play(response)

    except sr.UknownValueError:
        print("Google Speech Recognition could not understand the audio.")

    except sr.RequestError as e:
        print("Could not request results from Google Speech Recognition service; {0}".format(e))