Пример #1
0
def voiceiden(fname, mname):
    db = GMMVoiceDB('models')
    fname = fname.strip('.wav')
    print fname
    db.add_model(str(fname), str(mname))
    out.insertHtml(QString("<font color=\"black\">%1</font>"))
    out.insertPlainText("\nModel " + mname +
                        " Successfully added to database\n")
Пример #2
0
def segment_input(wavfile, dbpath='./voicedb'):
	db = GMMVoiceDB(dbpath)
	v = Voiceid(db, wavfile)
	v.extract_speakers()
	
	speaker_clusters={}
	
	for c in v.get_clusters():
		cluster = v.get_cluster(c)
		print cluster
		cluster.print_segments()
		print
Пример #3
0
 def __init__(self, test_mode=None):
     self.voiceid = None
     #self.db = GMMVoiceDB('/home/michela/SpeakerRecognition/voiceid/scripts/test_db/')
     self.db = GMMVoiceDB(os.path.expanduser('~/.voiceid/gmm_db/'))
     #self._cluster = None
     #self._partial_record_time = 5
     self.test_mode = test_mode
     self.queue_processes = []
     self._observers = []
     self._processing_thread = None
     self._queue_thread = []
     self.thrd_n = 2
     self._scores = {}
     self.threshold = -32.160
Пример #4
0
def voicerec(fname):
    db = GMMVoiceDB('models')
    v = Voiceid(db, fname)
    v.extract_speakers()
    txt = ''
    for c in v.get_clusters():
        cl = v.get_cluster(c)
        cluster = str(cl)
        cluster = cluster.split(' ')
        cluster = cluster[1]
        cluster = cluster.strip('(')
        cluster = cluster.strip(')')
        txt = txt + 'Speaker : ' + cluster
        seg = str(cl.print_segments())
        txt = txt + '\n' + seg
    out.insertPlainText(txt + "\n")
Пример #5
0
        }
        requests.post('http://129.236.234.21:8080/message',
                      data=json.dumps(payload),
                      headers=HEADERS)
        client.publish("ais/recognize/result/" + device_id + "/" + voice_path,
                       speaker)
        os.remove(voice.get_file_basename() + '.seg')
        os.remove(voice.get_file_basename() + '.g.seg')
        os.remove(voice.get_file_basename() + '.s.seg')
        w = voice.get_file_basename() + '.wav'
        if voice.get_filename() != w:
            os.remove(w)
        shutil.rmtree(voice.get_file_basename())
    except IOError:
        print "voice file doesn't exist"
        # voice_db_lock.release()


client = mqtt.Client()
client.on_connect = on_connect
client.on_message = on_message
# set_maxthreads(trd)
db = GMMVoiceDB("voiceDB")

voice_db_lock = threading.Lock()
# client.connect("127.0.0.1", 1883, 60)
client.connect("iot.eclipse.org", 1883, 60)

# https://eclipse.org/paho/clients/python/docs/#network-loop
client.loop_forever()
Пример #6
0
 def __init__(self):
     """ Init voice model """
     self._config = ConfigParser.ConfigParser()
     self._config.read("config.ini")
     dbPath = os.getcwd() + "/" + self._config.get("Paths", "voiceDir")
     self._db = GMMVoiceDB(dbPath)
Пример #7
0
def showsp():
    db = GMMVoiceDB('models')
    spk = str(db.get_speakers())
    out.insertHtml(QString("<font color=\"black\">%1</font>").arg(spk))
Пример #8
0
#Using voiceid(google opensource project) for voice recognisation using python
from voiceid.sr import Voiceid          
from voiceid.db import GMMVoiceDB
db = GMMVoiceDB('mydir')                #creating database/directory of registered voices
db.add_model('C:\Users\raman\Documents\raman.wma', 'Raman','M')
db.add_model('C:\Users\raman\Documents\lalit.wma', 'Lalit','M')
db.add_model('C:\Users\raman\Documents\aneesha.wma', 'Aneesha','F')
db.add_model('C:\Users\raman\Documents\priyanka.wma', 'Priyanka','F')
db.get_speakers()  # this will get all the speakers in the database/directory
if(db.matchvoice('C:\Users\raman\Documents\lalit.wma', 'Lalit'))   #the matchvoice function will compare the voices
{
  print "Lalit is present" }
  else print "Lalit is absent"

v = Voiceid(db)
v.extract_speakers()
for c in v.get_clusters():
   cluster = v.get_cluster(c)
   print cluster 
cluster.print_segments()
Пример #9
0
HOST_NAME = ''
#Porta do servidor
PORT_NUMBER = 9000
# A configuração: /dev/ttyACM0 é referente a porta USB que o Arduino esta ligado
ser = serial.Serial("/dev/ttyACM0", 9600)
ledLigado = "L".encode()
ledMais = "M".encode()
ledMenos = "m".encode()
fechadura = "F".encode()
tomada1 = "T".encode()
tomada2 = "t".encode()

#Configuracoes do banco de dados da API de voz
caminhoDB = '/home/smarthome/Banco/'
caminhoVoz = '/var/www/html/Voices/'
db = GMMVoiceDB(caminhoDB)


class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler):
    def do_HEAD(s):
        s.send_response(200)
        s.send_header("Content-type", "text/html")
        s.end_headers()

    def do_GET(s):
        s.send_response(200)
        s.send_header("Content-type", "text/html")
        s.end_headers()
        path = s.path
        if '-' in path:
            acao, nome, pessoa = path.split('-')