Dispatch Tone Out Decoder Part 5: Adding Speech to Text Conversion in Python

Dispatch Tone Out Decoder Part 5: Adding Speech to Text Conversion in Python

I want the scanner tone out decoder to include an actual real time transcribed audio text displayed in line with the departments toned out so that I can easily see if there is something going on that is important with just a quick skim of the output display. Another great feature I can incorporate is checking for trigger keywords that will alert me if there is really something that needs immediate attention, such as a wildland fire in my area.

I have been researching for most of today looking to see what is available for converting speech to text and there are several options. I have chosen to go down the path of using the Google Cloud API. Mainly because they have a 60 minute free transcription per month, they include a $300 credit within a 90 day trial to use for any of the APIs, and finally because once you go over 60 minutes per month of transcription the cost is only 2.4 cents per minute. So it is worth trying out.

After I setup my Google Cloud account, I had trouble figuring out how to really get started until I happened across this : https://www.hellocodeclub.com/python-speech-recognition-create-program-with-google-api/ . This tutorial worked up until the point of adding in an environment variable. My main Python debug setup is still running on Windows 10. I saved my Google Credentials JSON file to my C:\ directory for ease of editing the Environment Variable. Add the System Environment Variable for the JSON file location by hitting the Window key and typing in ‘environment’. The search brings up ‘edit environment variables control panel’ click that.

Click Environment Variables…

Click New…


Add your JSON file name and location in the Variable value:

Restart your Python Idle session for the environment variables to take effect.

I ran the code in the tutorial against a snippet of recorded audio from the Broadcastify Boulder County dispatch channel:

The output is not 100% correct but is good enough to see what is going on:

Transcript: 2621 2601 respond with Lafayette please to the outside entrance of Exempla Good Sam 200 Exempla Circle

The next step will be to integrate this into the tone out decoder display.

Leave a Reply

Your email address will not be published. Required fields are marked *