Pages

Tuesday, June 2, 2015

Audio Signals in GNURadio

Figure - 1

This time, I'm writing a very little note on how to handle audio signals using GNURadio. There are two basic things we can do. Firstly, we can take audio signals from a microphone in our computer and then visualizing it with various plot. Secondly, we can generate some signal within the audible frequency range and put it out using the speakers of our computer. In between those two options, we have the opportunity to manipulate signals and do whatever the processing we need to perform. Let's begin.

Figure - 2

Prepare a flow graph in GNURadio Companion (GRC) as shown in figure-1 where we just have two components, an Audio Source and a WX GUI Waterfall Sink. These two blocks together will extract the sounds from our computers microphone and show it as in a spectrogram. In is important to understand that we have set the sample rate to 48kHz which is the most commonly supported sample rate in audio devices in our computers. A configuration file for this flow graph setting can be found here. Running this flow graph will result in a beautiful spectrogram as shown in figure-2.

Figure - 3

Similarly, generating an audible sound and sending it to the speaker is also very easy. As shown in the flow graph of figure-3, we mainly need two components, a Signal Source and an Audio Sink. Our signal source generate signals in the sample rate of 48kHz as in the previous case. Instead of setting a predefined frequency for the signal source, we have added a WX GUI Slider which defines the frequency of the signal source. The configuration for this flow graph can be found here. Running this flow graph results in a tone which changes it's pitch as we move the slider to adjust the frequency. It is notable that when we increase the frequency beyond 20kHz, the sound goes out of our hearing as our ear is not sensitive to frequencies out of that boundary.