Wednesday, January 13, 2016

Software Telephone Interface for Broadcasting

This post takes a break from amateur radio and delves into broadcasting.  I am a member of a local community radio station and help out with a couple of programs, mostly podcasting, though I do present and operate the panel occasionally.

Recently, the station's telephone interface was damaged by lightning, so putting calls to air hasn't been possible since (as of the time of writing, the interface is still off air).  So when one of the shows I help out with wanted to put an interview to air last week, I offered to pre-record the call at home.  At the time, I didn't have anything specifically setup, but I knew I had most of the necessary pieces already installed.

From the outset, it was obvious that I would make use of Voicemeeter Banana.  This is a donationware mixer for Windows with 5 input channels (3 hardware, two virtual) and 5 output channels (also 3 hardware, 5 virtual).  I had been using Voicemeeter Banana on a couple of Windows PCs to manage audio from multiple sources and to multiple devices, and knew it would be invaluable for routing audio through the PC.  For a local microphone, I used an old wireless mic system, which I had lying around.  This was the most convenient option that I had in the time available., although there may be better sounding mics lying around.  To record the phone calls, I decided to use the open source Audacity audio editor.  I already use Audacity for recording podcasts and know it well.  Audacity also has excellent post processing facilities such as noise reduction.  I could have possible used Voicemeeter Banana's internal recorder, but decided to stick with what I know and reduce the learning curve.  Audacity can record, edit and encode the audio, so I could focus on setting up the audio routing and phone interface.



Voicemeeter Banana configured for telephone recording.


In the image above, I used Hardware Input 2 (A2) for the local microphone (wireless mic).  Audacity was set with Virtual Output B2 as its source, which has a combination of A2 and B2.  To hear the call, Hardware Output 1 (A1) was routed to a USB sound device that the headphones were plugged into.  Inputs A2 and B2 were routed to the headphones, so we could hear both sides of the call, as if we were in the studio.  Another tweak I made was to have the audio from each side of the conversation routed to different channels, so I could do post processing independently on each side of the conversation.

For the phone side of things, I initially tried using an iPad with a softphone app on it, but the audio routing inside the iPad outsmarted itself, and I wasn't able to get audio to the PC.  My next attempt used an IP softphone on the PC.  I have a phone system on the router here that supports VoIP handsets, so I could simply configure a new "handset" on the router for the softphone, and have the softphone authenticate with the router.  I initially tried Zoiper, which almost worked, except for crashing when initiating an outbound call through the system.  My next attempt used X-Lite, which works perfectly.


X-Lite configured for local VoIP PBX.

As stated, I configured X-Lite as an extension of my existing VoIP PBX.  This simplified things, in that I didn't have to subscribe to and pay for a VoIP service just for phone interviews.  This system also gives me access to a real landline (since one is attached to the system) via approved equipment.  However, to save money, the interview was actually conducted over a VoIP provider, selected through least cost routing by the PBX.  Because the softphone connects to the PBX over a wired LAN connection, I chose uLaw as the preferred codec in X-Lite to maximise audio quality.  Bandwidth obviously isn't an issue on a LAN.
X-Lite audio configuration.
As shown above, X-Lite uses Voicemeeter's B2 input and output for its audio devices.  This allows Voicemeeter to route audio from the mic to X-Lite, and for audio from X-Lite to be routed to the headphones and Audacity.

Finally, Audacity was configured to use Voicemeeter's B2 input and B2 output, which allows Audacity to capture both sides of the phone interview from Voicemeeter Banana.

Operation of the phone system is simple.  Place the call with X-Lite.  Once the other party answers, levels can be set with the A2 and B2 sliders, until the levels are roughly equal.  At this point you're ready to record, and it's best to have Audacity rolling, so it's not forgotten later.  I pause for a few seconds to get a sample of background noise (for post processing), then proceed with the interview.  Afterwards, simply hang up and stop Audacity's recording.

For post processing, I first trim the audio (but leaving the first few seconds of background noise).  Next, split the stereo audio into two separate mono tracks.  Highlight a few seconds of background noise, select Effects -> Noise Reduction (Noise Removal on older versions) and click on "Get Noise Profile".  Now, select the whole track and apply 12dB of noise reduction.  I then repeat the same process on the second track.  In my setup, this reduces the noise floor to around -36dB, which is about 6dB below the station's noise floor at my location, and more than acceptable for phone calls.

After noise reduction, I merge both tracks into a single mono track, then trim the silence from the start.  Finally, the track is exported to a convenient audio format (I used FLAC, though MP3 is fine).  All that remains to be done now is to play the interview on air from the recorded audio.

Finally, the hardware/PC environment I'm using.

PC - Quad core Intel Q6600 (c. 2008) running at 2.4 GHz.

OS - Windows Vista Home Premium 64 bit.

Microphone - 37 MHz FM wireless microphone.

Audio - 2 sound devices in use - on board Realtek sound (used for mic input) and generic USB audio device (used for headphones).  This unusual audio setup is because a couple of inputs and outputs are dedicated to ham radio service on that PC, and it was easier to use spare inputs and outputs than rewire everything.

Mixer - Voicemeeter Banana 2.0.2.5.

Softphone - X-Lite 4.9.2.

Audio recording and processing - Audacity 2.0.5.

PBX - Fritzbox 7270 ADSL/Ethernet/Wifi/VoIP router.  Connected to 2 VoIP providers and landline.

While I made use of the PBX that I already have running, there is no reason the softphone couldn't be used directly with an external VoIP provider.  Results should be just as good, provided you have sufficient Internet bandwidth to reliably handle the call.

What started out as a need to rapidly implement telephone recording for radio interviews has developed into a functional phone interface, capable of professional quality audio.  The system could conceivably be used live in a studio environment, though I haven't had the need to do this yet.  If you want to hear the result, here is the interview that was recorded last week (courtesy Phoenix FM and Rainbow Radio).

http://rainbowradio.podomatic.com/entry/2016-01-08T15_57_57-08_00