Spaces:
Runtime error
Runtime error
aar2dee2
commited on
Commit
·
3e9b592
1
Parent(s):
12940e9
return numpy output of audio
Browse files
app.py
CHANGED
|
@@ -7,7 +7,6 @@ from vocode import getenv
|
|
| 7 |
import gradio as gr
|
| 8 |
import os
|
| 9 |
import logging
|
| 10 |
-
import sounddevice as sd
|
| 11 |
from vocode.turn_based.agent.chat_gpt_agent import ChatGPTAgent
|
| 12 |
from vocode.turn_based.synthesizer import CoquiSynthesizer
|
| 13 |
from vocode.turn_based.transcriber.whisper_transcriber import WhisperTranscriber
|
|
@@ -88,16 +87,12 @@ def convert_to_audio_segment(input_audio):
|
|
| 88 |
def send_audio(audio_segment: AudioSegment):
|
| 89 |
logger.info("now processing output")
|
| 90 |
sampling_rate = DEFAULT_SAMPLING_RATE
|
| 91 |
-
stream = sd.OutputStream(
|
| 92 |
-
channels=1,
|
| 93 |
-
samplerate=sampling_rate,
|
| 94 |
-
dtype=np.int16,
|
| 95 |
-
device=None,
|
| 96 |
-
)
|
| 97 |
raw_data = audio_segment.raw_data
|
| 98 |
if audio_segment.frame_rate != sampling_rate:
|
| 99 |
raw_data = audio_segment.set_frame_rate(sampling_rate).raw_data
|
| 100 |
-
|
|
|
|
|
|
|
| 101 |
|
| 102 |
|
| 103 |
def main(input_audio):
|
|
|
|
| 7 |
import gradio as gr
|
| 8 |
import os
|
| 9 |
import logging
|
|
|
|
| 10 |
from vocode.turn_based.agent.chat_gpt_agent import ChatGPTAgent
|
| 11 |
from vocode.turn_based.synthesizer import CoquiSynthesizer
|
| 12 |
from vocode.turn_based.transcriber.whisper_transcriber import WhisperTranscriber
|
|
|
|
| 87 |
def send_audio(audio_segment: AudioSegment):
|
| 88 |
logger.info("now processing output")
|
| 89 |
sampling_rate = DEFAULT_SAMPLING_RATE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
raw_data = audio_segment.raw_data
|
| 91 |
if audio_segment.frame_rate != sampling_rate:
|
| 92 |
raw_data = audio_segment.set_frame_rate(sampling_rate).raw_data
|
| 93 |
+
output = np.frombuffer(raw_data, dtype=np.int16)
|
| 94 |
+
|
| 95 |
+
return output
|
| 96 |
|
| 97 |
|
| 98 |
def main(input_audio):
|