How to do Speech-To-Text with Go
This article shows how Speech Recognition can be integrated into your Go application in only a few lines of code.



Do you want to do Automatic Speech Recognition, or ASR, in Go, and are wondering how this can be done?
This article shows the different available options and how Speech Recognition can be integrated into your Go application in 60 seconds.
Speech-to-Text APIs For Go
Since open source options in Go are still limited, the best option is to use a Speech-to-Text API, which you can access with our AssemblyAI SDK for Go.
Choosing the best Speech-to-Text API for your project can be challenging. One of the most easy-to-use APIs to integrate is AssemblyAI. So let's learn how this can be integrated into a Go application with only a few lines of code.
Speech Recognition in Go With AssemblyAI
Before we start writing code, we need to get a working API key. You can get one here and get started for free:
Get started with the AssemblyAI SDK
To install the AssemblyAI SDK for Go, use go get
in your terminal:
Next, import the module and create a new authenticated client using your API key:
Transcribe a local file
If you have a file locally on your computer, you can use the TranscribeFromReader
method to first upload the file to AssemblyAI's servers. The file will be deleted as soon as the transcription finishes.
Transcribe audio from a URL
If you instead want to transcribe audio that is already available from a URL, use the TranscribeFromURL
method.
Open Source Speech Recognition Libraries in Golang
Unfortunately, the options in Go are still limited. The go-to programming language with the most open source libraries for offline Speech Recognition is Python.
If you still want to use an open source library, you can try PocketSphinx for Go. It's a lightweight Speech Recognition engine, specifically tuned for handheld and mobile devices. However, this project hasn't been updated in over four years.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.