-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimpt_obsolete_snippets.py
30 lines (23 loc) · 991 Bytes
/
impt_obsolete_snippets.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# DEEPGRAM_URL = "https://api.deepgram.com/v1/speak?model=aura-orpheus-en"
# def save_response_as_audio(response):
# print("Dexter: " + response)
# payload = {
# "text": response
# }
# headers = {
# "Authorization": f"Token {DEEPGRAM_API_KEY}",
# "Content-Type": "application/json"
# }
# audio_file_path = "output_TTS.wav" # Path to save the audio file
# with open(audio_file_path, 'wb') as file_stream:
# response = requests.post(DEEPGRAM_URL, headers=headers, json=payload, stream=True)
# for chunk in response.iter_content(chunk_size=1024):
# if chunk:
# file_stream.write(chunk) # Write each chunk of audio data to the file
# print("Audio download complete")
# # Play the audio file
# audio = AudioSegment.from_file(audio_file_path)
# play(audio)
# # Delete the audio file after playback
# os.remove(audio_file_path)
# print("Audio file deleted")