Dispatch Tone Out Decoder Part 6: Using a Cheap USB Sound Card
The USB sound card I ordered from Amazon finally arrived. I ordered this $7.99 JSAUX USB interface. I specifically picked this device because it had okay reviews and a nice form factor with an aluminum case. The small size was the major decision factor on this purchase for when/if the project ever gets put on a Raspberry Pi coupled with a Baofeng UV-5R radio, I want the solution to be very small.
Note: As an Amazon Associate I earn from qualifying purchases
I was excited to get this project hooked up to the Pro-2052 scanner so that I did not have the silly overlapping Sheriff’s dispatch and Fire dispatch that was on the Broadcastify channel. I used a 1/8 male to male tip ring sleeve (TRS) audio patch cable directly from the headphone output on the scanner to the mic input on the USB card. The USB sound card was plug and ‘play’ as far as Windows 10 recognizing it, but then the problems:
- Mic Muting Windows 10
- Distorted Audio
- Unable to decode tones
Debugging Windows microphone muting
When the scanner was connected to the USB mic port there was no detectable audio. I switched the scanner to listen to weather so that I had a constant audio output to troubleshoot this. Turning the volume up on the scanner and still no audio.
Next I opened the sound settings by right clicking the speaker on the task bar lower right corner:
The input was correct as ‘Microphone (USB Audio) was the input device, but still no movement on the Test your microphone bar
I clicked the Device properties for the Microphone , everything looked correct:
Next I clicked Additional device properties under Related Settings
The input was muted, that is weird?!
I unmuted it, and the Test your microphone bar was moving only for a second and then stopped again. The Microphone properties once again showed the mic was muted. WTF?! I spent a little time playing around with everything, moving to a different USB port etc.. Finally after a little troubleshooting I realized that Windows does not like it when the microphone input that hits the peak on input volume, it will mute the mic input automatically without any hesitation., without notification and keeps the mic in a muted state until it is manually unselected. What engineer at Microsoft thought that this was a good idea?!! 😒(Note for Microsoft engineers that may care about customer experience 🤣: How about mute for the peak input then unmute the mic when the input returns to a less than peak level 🤔 ) With the volume on the scanner turned down the auto muting went away. I really look forward to moving this project to Ubuntu.
Distorted recorded audio
When listening to the recorded audio from the scanner it was very distorted no matter what the settings were for the microphone level or scanner volume, so I immediately thought that it was some mismatch between the mic input and scanner headphone output. To listen to the microphone input with the speakers, you can loop back the connection with this setting, it plays audio after applying the setting:
To address the mismatch I went digging through my junk drawers looking to see if I had any audio isolation transformers that I could use to isolate the two, nope nothing. I tried winding a couple of transformers by hand and checked the response using a frequency generator to sweep through the audio range of 100-20,000Hz and an o-scope to monitor the output. Not having the right core material for the hand wound audio transformer it was a no go as the low frequency response was rolling off too much. I can order an audio isolation transformer and wait a week but I want to get this project moving. I had a Triad toroid power isolation transformer. I figured what the heck I’ll try it on the o-scope and it had a very flat response all throughout the audio range. I cut the 1/8 inch TRS patch cable in half inserted the transformer, a load resistor of 33 Ohms in parallel and a 1k Ohm series on the microphone input side of the transformer. I picked the resistor values with a little experimenting of listening to what the audio sounded like with different values.
The recorded audio is okay at this point. The isolation setup looks very silly but for now the project is moving forward once again:
I am going to order some small audio isolation transformers to experiment with when they arrive.
Okay on to decoding tones with the code that was working great on the Broadcastify channel as long as there was no overlapping audio…
The decoder code was not working at all on the scanner audio, so back to debugging once again. Well it turns out after spending a few hours debugging that the input on the mic and the output of the scanner had to be tweaked to get that volume in the sweet spot for the FFT portion of the code to pick the tones out. A few more tweaks were made to make it more robust since the received audio from the scanner up in the mountains at a long distance from the transmitting antenna is different audio than what is picked up on the Broadcastify channel.
For example this is recorded audio from the scanner output using the cheap USB sound card:
Decoding the two tone, fire tone outs is working great once again :
5100: Pinewood Springs Protection District : Tone out on 01-02-23 at 06:36:30 1: 951.2Hz 2:1821.8Hz C1:15 C2: 8 5100: Pinewood Springs Protection District : Tone out on 01-02-23 at 06:36:34 1: 949.8Hz 2:1819.6Hz C1:11 C2: 8 5000: Big Elk Meadows Protection District : Tone out on 01-02-23 at 06:36:39 1: 1129.4Hz 2:1228.7Hz C1:16 C2: 8 2200: Mountain View Fire St.-1 : Tone out on 01-02-23 at 06:42:06 1: 1501.0Hz 2:864.8Hz C1:15 C2: 8 2600: Lafayette Fire Department : Tone out on 01-02-23 at 07:13:19 1: 948.9Hz 2:1341.4Hz C1:15 C2: 8 2200: Mountain View Fire St.-1 : Tone out on 01-02-23 at 07:32:06 1: 1502.5Hz 2:868.8Hz C1:14 C2: 8 2200: Mountain View Fire St.-1 : Tone out on 01-02-23 at 07:40:48 1: 1503.3Hz 2:868.7Hz C1:13 C2: 8 2600: Lafayette Fire Department : Tone out on 01-02-23 at 07:46:44 1: 948.5Hz 2:1341.4Hz C1:17 C2: 8 2300: Boulder Rural : Tone out on 01-02-23 at 07:46:48 1: 948.7Hz 2:1529.2Hz C1:15 C2: 8
I have a new idea that I want to try that will make the detection better and much more streamlined. The entire detection routine will have to be redone from scratch as it will use a ‘rotating’ FTT summing method. Essentially it will be a sliding window that ‘rolls’ across the audio stream summing the FFT on each chunk together to really pop up unique tones and flatten everything that is not unique in the signal. I have been thinking about for a few days, but this will be for a later project for the Mad Scientist Hut.
I have also ordered a couple of the $10 Behringer UCA222 USB audio adapters to see how they ‘sound’ they are a little big for what I wanted in the final project but we will see if the audio is better when they arrive. Back to getting the speech to text conversion code working..