Skip to content

Commit 5ac397b

Browse files
committed
feat(genai): Add test files
1 parent f030839 commit 5ac397b

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed
95.4 KB
Binary file not shown.

genai/live/live_websocket_audiogen_with_txt.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ async def generate_content() -> str:
3838
import numpy as np
3939

4040
from websockets.asyncio.client import connect
41-
from scipy.io.wavfile import write as save_audio
41+
from scipy.io import wavfile
4242

4343
# Configuration Constants
4444
PROJECT_ID = os.getenv("GOOGLE_SAMPLES_PROJECT")
@@ -133,7 +133,7 @@ async def generate_content() -> str:
133133

134134
# Save audio to a file
135135
if aggregated_response_parts:
136-
save_audio("output.wav", 24000, np.concatenate(aggregated_response_parts))
136+
wavfile.write("output.wav", 24000, np.concatenate(aggregated_response_parts))
137137
# Example response:
138138
# Setup Response: {'setupComplete': {}}
139139
# Input: Hello? Gemini are you there?

genai/live/live_websocket_audiotranscript_with_txt.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ async def generate_content() -> str:
3838
import numpy as np
3939

4040
from websockets.asyncio.client import connect
41-
from scipy.io.wavfile import write as save_audio
41+
from scipy.io import wavfile
4242

4343
# Configuration Constants
4444
PROJECT_ID = os.getenv("GOOGLE_SAMPLES_PROJECT")
@@ -146,7 +146,7 @@ async def generate_content() -> str:
146146

147147
# Save audio to a file
148148
final_response_audio = np.concatenate(aggregated_response_parts)
149-
save_audio("output.wav", 24000, final_response_audio)
149+
wavfile.write("output.wav", 24000, final_response_audio)
150150
print(f"Input transcriptions: {''.join(input_transcriptions_parts)}")
151151
print(f"Output transcriptions: {''.join(output_transcriptions_parts)}")
152152
# Example response:

0 commit comments

Comments
 (0)