Raspberry Pi as Audio Streaming Client
Updated: Mar 12, 2020
You can stream audio for Voicegain transcription API from any computer, but sometimes it is handy to have a dedicated inexpensive device just for this task. Below we relay experiences of one of our customers in using a Raspbery Pi to stream audio for real-time transcription. It replaced a Mac Mini which was initially used for that purpose. Using Pi had two benefits: a) obviously the cost, and b) it is less likely than Mac Mini to be "hijacked" for other purposes.
Voicegain Audio Streaming Daemon requires very little as far as computing resources, so in even a Raspberry Pi Zero is sufficient ; however, we recommend using Raspberry Pi 3 B+ mainly because it has on-board 1Gbps wired Ethernet port. WiFi connections are more likely to have problems with streaming using UDP protocol.
Here is a list of all hardware used in the project (with amazon prices (as of July 2019)):
Element14 Raspberry Pi 3 B+ Motherboard - $37.78
Miuzei Raspberry Pi 3 b+ Screen, 3.5 Inch - $23.99
Miuzei 3.5 Inch Screen Case for 3.5 LCD - $9.99
iPazzPort Wireless Mini Handheld Keyboard - $13.99
UGREEN USB Audio Adapter - $8.99
SanDisk Ultra 32GB microSDHC UHS-I card - $7.23
plus some existing USB 5V power supply was uses.
All the components added up to a total of $101.97. The reason why a mini monitor and a mini keyboard were included is that they make it more convenient to control the device while it is in the audio rack. For example, the alsa audio mixer can be easily adjusted this way, while at the same time monitoring the level of the audio via headphones.
The device is running standard Raspbian which can easily be installed from an image using e.g. balenaEtcher. After base install, the following was needed to get things running:
enable ssh access
change default audio device to USB sound card (Raspbian comes default with alsa and basic USB sound drivers)
installing driver for the display (otherwise output font is too tiny and not readable)
installing OpenJDK 9
use link generated from Voicegain Portal to download Voicegain AudioDaemon jar file and correct JSON config
seting the correct audio source number the AudioDaemon start script and launching the daemon
Here are some lessons learned from using this setup over the past 6 months:
While streaming the CPU use stays under 10%
Java heap is set to 128m, which seems to be more that enough because GCs manage to reduce it to about 54m
Raspberry Pi turned out to be very reliable - we have not had a single issue with the hardware nor with the Raspbian OS
Cheap USB audio card delivers very good sound quality (for speech recognition at least)
Very cheap USB power supplies should be avoided - sometimes they cause a hum in the audio (but that also depends on what audio device is being connected).