mirror of
https://github.com/FAUSheppy/ths-speech
synced 2025-12-06 14:31:37 +01:00
Initial
This commit is contained in:
BIN
.plan.txt.swp
Normal file
BIN
.plan.txt.swp
Normal file
Binary file not shown.
15
plan.txt
Normal file
15
plan.txt
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
Smartphone:
|
||||||
|
- record
|
||||||
|
- play
|
||||||
|
- send to server
|
||||||
|
- recive text form server (?)
|
||||||
|
|
||||||
|
Server:
|
||||||
|
- revice from smartphone
|
||||||
|
- use google api for recognition
|
||||||
|
- process/format result (i.e. templating (i.e. templating))
|
||||||
|
- send resulting text
|
||||||
|
|
||||||
|
Computer/Client:
|
||||||
|
- recivce text
|
||||||
|
- place it somewhere
|
||||||
BIN
python-server/.main.py.swp
Normal file
BIN
python-server/.main.py.swp
Normal file
Binary file not shown.
8
python-server/main.py
Executable file
8
python-server/main.py
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
import s_input
|
||||||
|
import sys
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
path = sys.argv[1]
|
||||||
|
print("AudioFile: {}".format(path))
|
||||||
|
print(s_input.analyse_file_by_path(path))
|
||||||
6
python-server/s_input.py
Normal file
6
python-server/s_input.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import speech
|
||||||
|
|
||||||
|
def analyse_file_by_path(file_path):
|
||||||
|
transcript = speech.analyse(file_path)
|
||||||
|
|
||||||
|
return transcript
|
||||||
17
python-server/speech.py
Normal file
17
python-server/speech.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import speech_recognition as spr
|
||||||
|
def analyse(file_path):
|
||||||
|
''' returns the transcripted audio, or None if the analysis fails '''
|
||||||
|
recognizer = spr.Recognizer()
|
||||||
|
with sr.AudioFile(file_path) as source:
|
||||||
|
audio = r.record(source)
|
||||||
|
|
||||||
|
try:
|
||||||
|
string = r.recognize_google(audio)
|
||||||
|
except spr.UnknownValueError:
|
||||||
|
log.log("Audio file is broken or not an audio file")
|
||||||
|
return None
|
||||||
|
except spr.RequestError as e:
|
||||||
|
log.log("Could not connect to google API: {}".format(e))
|
||||||
|
return None
|
||||||
|
|
||||||
|
return string
|
||||||
5
setup.sh
Normal file
5
setup.sh
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
apt-get install python python-all-dev python-pip build-essential swig git libpulse-dev libasound2-dev
|
||||||
|
pip3 install wheel
|
||||||
|
pip3 install google-cloud-speech
|
||||||
|
pip3 install pocketsphin
|
||||||
|
pip3 install SpeechRecognition
|
||||||
BIN
test-data/das_ist_ein_test.wav
Normal file
BIN
test-data/das_ist_ein_test.wav
Normal file
Binary file not shown.
Reference in New Issue
Block a user