Learn how to transcribe streaming audio in Go.
go get
.main.go
that imports the AssemblyAI Go module.YOUR_API_KEY
with your copied API key.WithSampleRate
option.8_000
(8 kHz)16_000
(16 kHz)48_000
(48 kHz)client.Connect()
.
recorder.go
with the following code:main.go
, open a microphone stream. The sampleRate
must be the same value as the one you passed to RealTimeClient
(16_000
by default).client.Send()
.Ctrl+C
, use client.Disconnect()
. Disconnect()
accepts a boolean parameter that allows you to wait for any remaining transcriptions before closing the connection.