def hand_pose(model,move_text):
	#Camera and font initialization
	cap=cv2.VideoCapture(1)
	array=[]
	array1=[]
	#The main event loop
	while(cap.isOpened()):
		move=''
		_,img=cap.read()
		gray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
		ret,th1 = cv2.threshold(gray.copy(),100,255,cv2.THRESH_TOZERO)
		_,contours,hierarchy = cv2.findContours(th1.copy(),cv2.RETR_EXTERNAL, 2)
		cnt=ut.getMaxContour(contours,4000)
		if cnt!=None:
			gesture,res=ut.getGestureImg(cnt,img,th1,model)
			cv2.imshow('PredictedGesture',gesture)
			move=move_text[res]
			array.append(move)
			if len(array)==30:
				array1.append(move)
				print move
				if len(array1)>=5:
					a=''.join(array1)
					tts.TTS(a)
					array1=[]
				array=[]  
		cv2.imshow('Frame',img)
		k = 0xFF & cv2.waitKey(10)
		if k == 27:
			break
	cap.release()
	cv2.destroyAllWindows()
Exemplo n.º 2
0
random.seed(0)
filenm = random.randint(0,100000)
filenm="files\\"+str(filenm)+".srt"
print filenm
fff = open(filenm,'w')
fff.write(subs)
subs = pysrt.open(filenm)
main_audio = GenSilence(1/100000)
cntr=0
print len(subs)
cntr=0
last=0
for x in subs:
	audio_file = "files\\"+str(random.randint(101,100000000))+".mp3"
	if len(x.text)>0:
		tts.TTS(x.text, audio_file)
		aud = AudioSegment.from_mp3(audio_file)
		#print aud.duration_seconds
		duration = 60*(x.end.minutes-x.start.minutes)+(x.end.seconds-x.start.seconds+1)
		rate = aud.duration_seconds/duration
		rate*=2

		if rate<0.55 or rate>3:
			print "f**k u"

		rate = max(rate,0.55)
		rate = min(rate,3)
		#print duration
		#print rate
		aud.speedup(playback_speed=rate)
		#print aud.duration_seconds
Exemplo n.º 3
0
import STT
import requests
from bs4 import BeautifulSoup
import tts
query = STT.stt()
#query = 'Google'
print("Serching from Wikipedia for " + query + " .....")

url = "https://www.wikipedia.org/wiki/" + query

#print("*****************")
response = requests.get(url)

#print(response)

soup = BeautifulSoup(response.text, "html.parser")

#print(soup)
#print("*****************************************************************")
i = 0
for p in soup.find_all("p"):
    #print("*****")
    if (i == 2):
        text = p.get_text()
        print(text)
        tts.TTS(text)
        tts.play()
    i = i + 1
Exemplo n.º 4
0
from datetime import datetime
from tkinter import simpledialog
from tkinter import messagebox as mbox

import tts
import sequiturclient
import sys
import os
import platform

sequitur_model = "dicts/de_g2p_model-6"
todo_wordlist = "todo_wordlist.txt"
output_lexicon = "output_lexicon.txt"
auto_save = True

tts_client = tts.TTS()

# you can configure key bindings here. Note that we need different ones for Mac,
# as Cmd is standard for commands (instead of CTRL) and the F1-12 keys are buggy in tkinker on a Mac :/

key_bindings_mac = {
    "backup_btn": ("<Command-b>", "⌘+B"),
    "change_g2p_textbox": ("<Command-g>", "⌘+G"),
    "add_and_next": ("<Command-Return>", "⌘+↵"),
    "number_key": ("<Command-Key-%d>", "⌘+%d"),
    "play_btn_hotkey": ("<Command-p>", "⌘+P"),
    "find_btn_hotkey": ("<Command-f>", "⌘+F")
}

key_bindings_pc = {
    "backup_btn": ("<Control-b>", "Ctrl+B"),
Exemplo n.º 5
0
def processVid(videoURL):
    subs = getEng.getShitDone(videoURL)
    print subs

    random.seed(0)
    # filenm = random.randint(0,100000)
    # filenm="files\\"+str(filenm)+".srt"
    # print filenm
    # fff = open(filenm,'w')
    # fff.write(subs)
    subs = srt.parse(subs)
    subs = list(subs)
    print subs[0].content
    main_audio = GenSilence(1 / 100000)
    cntr = 0
    cntr = 0
    last = 0
    for x in subs:
        audio_file = "/files114382.mp3"
        if len(x.content) > 0:
            tts.TTS(x.content.encode('utf-8'), audio_file)
            aud = AudioSegment.from_mp3(audio_file)
            #print aud.duration_seconds
            duration = x.end - x.start
            duration = duration.total_seconds()
            rate = aud.duration_seconds / duration
            # rate*=2
            # rate*=2

            # if rate<0.55 or rate>3:
            # 	print "f**k u"
            # rate = max(rate,0.55)
            # rate = min(rate,3)

            #print duration
            #print rate
            # aud.speedup(playback_speed=rate)
            #print aud.duration_seconds
            # dur2 = aud.duration_seconds*1000
            # curr = start.minutes*60+start.sec
            # curr=curr*1000
            # if curr<=last+minGap:
            # 	curr=last+minGap+1
            gap = 0
            # if cntr<len(subs)-2:
            # 	gap=(subs[cntr+2].start.minutes-x.end.minutes)*60 + subs[cntr+2].start.seconds-x.end.seconds
            # 	print gap
            startP = x.start
            startP = startP.total_seconds()
            gap = startP - last

            last = x.end
            last = last.total_seconds()
            # gap=0
            # print x.end.seconds
            if gap <= 0:
                main_audio = main_audio + aud
            else:
                main_audio = main_audio + GenSilence(gap) + aud
            cntr = cntr + 1
    # main_audio.speedup(playback_speed=1.5)
    last_sub_time = subs[-1].end

    dur = last_sub_time.total_seconds() * 1000
    print "ls sub time in sec"

    main_audio = main_audio[:dur]
    # main_audio.export("/static/"+videoURL+".mp3")
    main_audio.export("static/34825.mp3")
Exemplo n.º 6
0
import tkinter as tk
import tts
from multiprocessing import Process
import keyboard

myTTS = tts.TTS(250)

class Application(tk.Frame):
    def __init__(self, master=None):
        super().__init__(master)
        self.master = master
        self.pack()
        self.create_widgets()

    def create_widgets(self):
        self.instruct = tk.Text(self, height=10, width=30)
        instructions = """Highlight text and press r"""
        self.instruct.pack(side="top")
        self.instruct.insert(tk.END,instructions)
#        self.read = tk.Button(self)
#        self.read["text"] = "read"
#        self.read["command"] = lambda:check(self.runTTS())
#        self.read.pack(side="top")

        self.quit = tk.Button(self, text="QUIT", fg="red", command=self.master.destroy)
        self.quit.pack(side="bottom")

    def run_TTS(self):
        myTTS.text_to_speech(myTTS.copy_clipboard())

def run_TTS():