Tag: 1.16

Intermediate commits (oldest → newest):
- moving api key to netrc
- New stuff incoming
- Manual external audition
- Let's get this effin party started
- test mic
- tst
- Test
- Test
- fix
- fx
- test
- Refactoring step one
- Deploy script for after refactor
- Fix and upgrade
- bg fx
- fx
- fx
- fx
- Main refactoring
- Deploy script refactor
- fx
- fx2
- bgfx
This commit is contained in:
2025-10-30 16:59:12 +01:00
parent af29b857b1
commit b8df466e6f
32 changed files with 3056 additions and 2151 deletions
+30 -25
View File
@@ -6,57 +6,62 @@
#
# Note: Some macOS users might need to use `pip3` instead of `pip`.
import pyaudio
import assemblyai as aai
import pyaudio
aai.settings.api_key = "aa9962f0088a449a9c4ab2361e96cc08"
def on_open(session_opened: aai.RealtimeSessionOpened):
"This function is called when the connection has been established."
print("Session ID:", session_opened.session_id)
def on_open(session_opened: aai.RealtimeSessionOpened):
"This function is called when the connection has been established."
print("Session ID:", session_opened.session_id)
def on_data(transcript: aai.RealtimeTranscript):
"This function is called when a new transcript has been received."
"This function is called when a new transcript has been received."
if not transcript.text:
return
if not transcript.text:
return
if isinstance(transcript, aai.RealtimeFinalTranscript):
print(transcript.text, end="\r\n")
else:
print(transcript.text, end="\r")
if isinstance(transcript, aai.RealtimeFinalTranscript):
print(transcript.text, end="\r\n")
else:
print(transcript.text, end="\r")
def on_error(error: aai.RealtimeError):
"This function is called when the connection has been closed."
"This function is called when the connection has been closed."
print("An error occured:", error)
print("An error occured:", error)
def on_close():
"This function is called when the connection has been closed."
"This function is called when the connection has been closed."
print("Closing Session")
print("Closing Session")
transcriber = aai.RealtimeTranscriber(
on_data=on_data,
on_error=on_error,
sample_rate=44_100,
on_open=on_open, # optional
on_close=on_close, # optional
on_data=on_data,
on_error=on_error,
sample_rate=44_100,
on_open=on_open, # optional
on_close=on_close, # optional
)
pa = pyaudio.PyAudio()
for i in range(pa.get_device_count()):
print (pa.get_device_info_by_index(i))
print(pa.get_device_info_by_index(i))
# Start the connection
#transcriber.connect()
# transcriber.connect()
# Open a microphone stream
#microphone_stream = aai.extras.MicrophoneStream()
# microphone_stream = aai.extras.MicrophoneStream()
# Press CTRL+C to abort
#transcriber.stream(microphone_stream)
# transcriber.stream(microphone_stream)
#transcriber.close()
# transcriber.close()