A GUI in Qt for recording speech using Codec2

Codec2 is an audio codec designed for speech. The codec is designed for very high compression ratios. I find 1200 bits per second produces quite legible audio as long as there is not much background noise.

Qt is an extension of C++ that allows easy programming of both GUI and non-GUI applications. Qt creator is an IDE that can be used for Qt projects. Qt and Qt creator are also free, open source and works on Windows, Linux and Mac. Qt 5 (version 5) now contains built-in classes that allow access to the soundcard without having to install third-party libraries.

I wanted to use the new Qt 5 audio input and output classes and Codec2 to write an application that performed on the fly encoding and decoding of speech using Codec2; writing a simple speech recorder made sense. Qt and Codec2 work on Windows, Linux and Mac so this application can be compiled on any of these systems. It is hoped in addition to being useful application that this application serves as a simple example of how to use Codec2 and the audio input/output classes of Qt. When recording audio, the original uncompressed audio can be saved to a wav of file.


How I did it:


I did things a bit back to front and did not really read anything to begin with. I did it on Windows but on Linux I would imagine it to be easier. I already had the MinGW version of the open source version of Qt and Qt creator installed on my computer.

Downloaded bits and pieces…

·       Qt and Qt creator https://www.qt.io/download-open-source
--- view all downloads --- Qt 5.?.? for Windows ??-bit (MinGW ?.?.?, ??? MB)

·       Downloaded Codec2 from GitHub https://github.com/drowe67/codec2

·       Downloaded CMake from http://www.cmake.org/  (http://www.cmake.org/files/v3.2/cmake-3.2.2-win32-x86.exe)

·       Downloaded MinGW from http://www.mingw.org/ --- download installer
(MinGW comes with Qt but I wanted MSYS and Qt it just seemed easier to download the latest version of MinGW)

Compiled Codec2…

·       Made a folder for the build of Codec2

·       Ran CMake GUI and did whatever it’s supposed to do (configure, generate). I had to choose my gcc.exe and g++.exe manually when given the option as well as I had to uncheck the unittest checkbox.

·       Ran msys.bat navigated to the folder typed /c/MinGW/bin/mingw32-make.exe .. (typing make doesn’t work for me as it points to Windows make)

Wrote the Qt application…

·       Used Qt creator




Windows 64 binary


Source code repo


Jonti 2021


Jonti. Last modified Thu, 8 Apr 2021 00:25:58 GMT.