mirror of
https://github.com/FAUSheppy/ths-speech
synced 2025-12-09 10:28:33 +01:00
working google recog
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import base64
|
||||
import os.path
|
||||
from pydub import AudioSegment
|
||||
import audiosegment_wrapper as AudioSegment
|
||||
|
||||
def save_audio(filename, base64_string):
|
||||
decoded = None
|
||||
@@ -15,7 +15,9 @@ def save_audio(filename, base64_string):
|
||||
# return b"ERROR_FILE_EXISTS"
|
||||
with open(orig_filename,"wb") as f:
|
||||
f.write(decoded)
|
||||
AudioSegment.from_file(orig_filename).export(filename,format="wav")
|
||||
seg = AudioSegment.from_file(orig_filename)
|
||||
seg = seg.resample(sample_rate_Hz=32000, sample_width=2, channels=1)
|
||||
seg.export(filename,format="wav")
|
||||
return b"SUCCESS"
|
||||
|
||||
def save_audio_chain(file_str_tupels):
|
||||
@@ -37,6 +39,7 @@ def save_audio_chain(file_str_tupels):
|
||||
if not completeAudio:
|
||||
return b"ERROR_AUDIO_CONCAT_FAILED"
|
||||
else:
|
||||
completeAudio = completeAudio.resample(sample_rate_Hz=32000, sample_width=2, channels=1)
|
||||
completeAudio.export(file_str_tupels[0][0],format="wav")
|
||||
return b"SUCCESS"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user