TwoToneDetect New TwoToneDetect in the works - Python based

davidVT

Member
Feed Provider
Joined
Aug 29, 2010
Messages
138
Location
Washington County,Vermont
Ubuntu 20.04 with minimal gnome and adding FFMPEG, TTD seems to be working. (just the usual audio errors)
This on a VM so now to move to real hardware to test the audio.
Early AM progress:
I googled my way into getting audio PCI passthrough to connect on my PROXMOX Ubuntu installation.
I can operate the local TTD74 webpage from my network on port 8080.
The TTD error messages seem trivial at this point.....
Now to move a radio near to the server to see if we can actually see audio on the Audio Level bar...
------
Yes, it will be nice to remove the requirement for any GUI. For now I can only make this work with a GNOME session started and logged into.
From an SSH session the CLI will throw all the same errors as above. However, open up GNOME gui and open a terminal and using good ole 'screen', TTD74 runs fine. With 'screen' it will tolerate closing the GUI terminal session.
------
 
Last edited:

davidVT

Member
Feed Provider
Joined
Aug 29, 2010
Messages
138
Location
Washington County,Vermont
Early AM progress:
I googled my way into getting audio PCI passthrough to connect on my PROXMOX Ubuntu installation.
I can operate the local TTD74 webpage from my network on port 8080.
The TTD error messages seem trivial at this point.....
Now to move a radio near to the server to see if we can actually see audio on the Audio Level bar...
------
Yes, it will be nice to remove the requirement for any GUI. For now I can only make this work with a GNOME session started and logged into.
From an SSH session the CLI will throw all the same errors as above. However, open up GNOME gui and open a terminal and using good ole 'screen', TTD74 runs fine. With 'screen' it will tolerate closing the GUI terminal session.
------
Probably Last for today.... 12/30/22...
I was able to connect a microphone and feed it enough noise to verify the audio is reaching TTD74 inside the VM on PROXMOX.
My first try to use a radio caused the computer to reboot. Surely a wiring issue and not TTD. A karma thing no doubt.
I was able to configure TTD74 so to successfully send an admin message to myself.

Open items/questions:
Can I copy the tones file from TTD71 directly into TTD74 to save all the typing?
For now I will likely just type in one tone set and send it to myself.
Can I use a network audio stream from another computer in my network until I free up a good radio?
I think DC31 tried that in the past?
Are there any tools to help with audio setup?
Speaking to the old Pi stuff that helped us setup levels.
The pushover stuff was removed for the new owners, correct?

Comments:
All in all, this shows promise. Much easier than all the tweaking we had to do years ago to get the Pi's to work.
This tiny PC has audio jacks so none of the sensitive usb audio ports! It just works!
Thanks again Andy!
 

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,547
Location
Massachusetts
.

Open items/questions:

Can I copy the tones file from TTD71 directly into TTD74 to save all the typing?

I think so. Anything that refers to IaR you can just leave blank unless you are an IaR subscriber. The “instance_id” parameter in config.cfg usually gives me fits and I can never remember the work around.


Can I use a network audio stream from another computer in my network until I free up a good radio?

yes, pulseaudio allows network streaming. It requires some patience…
I have also streamed Broadcastify web player on the pi and used pulse to send the audio into TTD.

Are there any tools to help with audio setup?

if the old LevelMeter tool didn’t didn’t install with TTD, you can easily copy it from another computer running TTD.


The pushover stuff was removed for the new owners, correct?

yes, the pushover integration into TTD has been removed for versions +73 of TTD. Push notifications go to the IaR app for subscribers.
 

davidVT

Member
Feed Provider
Joined
Aug 29, 2010
Messages
138
Location
Washington County,Vermont
Regarding further successful testing with the Ubuntu version of TTD74:
Today I succeeded using Linux Mint, a gui version I like for older hardware.
Mint 21.1 Cinnamon 64-bit

I put TTD74 distribution file in to the user base directory.
From the GUI file manager I right clicked and used ‘expand here’.
I clicked into the new TTD directory and just clicked on the TTD74 executable to start it.
I saw the audio and log directories show up which suggested that TTD might be running….
I opened the browser to localhost:8080 ...
& sure enough the TTD page came up.
Much to my delight I realized the TTD audio bar was showing that the microphone was picking up my speech.

This is outstanding especially considering the hardware I am using :

This is a free OS on a $20 scratched up laptop i5 dell E4310 I bought from state surplus. Full disclosure: I had to add a tiny hard drive from my junk pile to make it work!! For security they toss the hard drives before selling at surplus.

The laptops can be configured to run with the lid closed, they have their own built in UPS if any life left in the battery. Works for me in this horrid RPI supply chain world… (and crazy easy)

YMMV

I may try with even smaller Linux gui distros to see what else works!!
Great stuff Andy!

This laptop will probably be the device I put into production with TTD74 as I don’t have to move my radio to use it. I will leave the proxmox test install for another day..
 
Last edited:

aaknitt

Member
Feed Provider
Joined
Aug 27, 2005
Messages
1,300
v74c Available

v74c is now available via the IaR form (website link to the form is still down, I'm not sure when it will be back up). The only change from v74 is that this one should allow headless operation on an Ubuntu or Pi box that's not running a desktop environment. If you don't care about that, there's no reason to upgrade. If there are issues let me know.

Andy
 

aliby19

Member
Feed Provider
Joined
Mar 10, 2005
Messages
145
Location
Indianapolis, IN
@aaknitt Got v74c up and running on Ubuntu Server 22.04. Previously have been using a Raspberry Pi.

With the Ubuntu version, I get the email but in the iOS Mail client, no email body is displayed. Instead it is attached as “mime-attachment.txt”.

Any ideas why this might be?
 

MikeOrlando02

Member
Joined
Oct 8, 2015
Messages
97
@aaknitt Got v74c up and running on Ubuntu Server 22.04. Previously have been using a Raspberry Pi.

With the Ubuntu version, I get the email but in the iOS Mail client, no email body is displayed. Instead it is attached as “mime-attachment.txt”.

Any ideas why this might be?

I have seen the same in v74 on Windows. Body is a “mime-attachment.txt”.
 

jschmall

Member
Premium Subscriber
Joined
Jul 15, 2017
Messages
79
Location
Anderson, CA
Regarding FFMPEG on Ubuntu, seems that installing via apt isn't enough for TTD. On start, my logs show FFMPEG NOT FOUND even though I've installed the latest version.

Ideas?
 

aliby19

Member
Feed Provider
Joined
Mar 10, 2005
Messages
145
Location
Indianapolis, IN
Regarding FFMPEG on Ubuntu, seems that installing via apt isn't enough for TTD. On start, my logs show FFMPEG NOT FOUND even though I've installed the latest version.

Ideas?

I had this same problem and had to remove the Ubuntu installed ffmpeg version and install it myself from source using instructions from earlier in this thread, as the built in/precompiled Ubuntu version does not have all the libraries TwoToneDetect relies on.

Bash:
apt-get remove ffmpeg

then:

Bash:
cd ~
git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg
cd ffmpeg;
sudo apt-get install libopencore-amrnb-dev
sudo apt-get install libmp3lame-dev
sudo apt-get install libfdk-aac-dev
./configure --pkg-config-flags=--static --enable-gpl --enable-libass --enable-nonfree --enable-libmp3lame --enable-libopencore-amrnb --enable-version3 --enable-libfdk-aac
make
sudo make install
 

jschmall

Member
Premium Subscriber
Joined
Jul 15, 2017
Messages
79
Location
Anderson, CA
I had this same problem and had to remove the Ubuntu installed ffmpeg version and install it myself from source using instructions from earlier in this thread, as the built in/precompiled Ubuntu version does not have all the libraries TwoToneDetect relies on.

Bash:
apt-get remove ffmpeg

then:

Bash:
cd ~
git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg
cd ffmpeg;
sudo apt-get install libopencore-amrnb-dev
sudo apt-get install libmp3lame-dev
sudo apt-get install libfdk-aac-dev
./configure --pkg-config-flags=--static --enable-gpl --enable-libass --enable-nonfree --enable-libmp3lame --enable-libopencore-amrnb --enable-version3 --enable-libfdk-aac
make
sudo make install
That did the trick. Thanks!
 

aliby19

Member
Feed Provider
Joined
Mar 10, 2005
Messages
145
Location
Indianapolis, IN
@aaknitt - Any ideas in v74c of the Ubuntu version, I get this error when trying to switch from Pulse to my USB soundcard within the web interface?


Code:
{0: 'HDA Intel PCH: ALC3234 Analog (hw:0,0)', 2: 'HDA Intel PCH: HDMI 0 (hw:0,3)', 3: 'HDA Intel PCH: HDMI 1 (hw:0,7)', 4: 'HDA Intel PCH: HDMI 2 (hw:0,8)', 5: 'HDA Intel PCH: HDMI 3 (hw:0,9)', 6: 'HDA Intel PCH: HDMI 4 (hw:0,10)', 7: 'USB Audio Device: - (hw:1,0)', 8: 'sysdefault', 9: 'samplerate', 10: 'speexrate', 11: 'pulse', 12: 'upmix', 13: 'vdownmix', 14: 'default'}
pulse
[('', <geventwebsocket.websocket.WebSocket object at 0x7f4f021fcb80>), ('', <geventwebsocket.websocket.WebSocket object at 0x7f4f021fcfa0>)]
Expression 'ret' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1736
Expression 'AlsaOpen( &alsaApi->baseHostApiRep, params, streamDir, &self->pcm )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1904
Expression 'PaAlsaStreamComponent_Initialize( &self->capture, alsaApi, inParams, StreamDirection_In, NULL != callback )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2171
Expression 'PaAlsaStream_Initialize( stream, alsaHostApi, inputParameters, outputParameters, sampleRate, framesPerBuffer, callback, streamFlags, userData )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2839
Traceback (most recent call last):
  File "TwoToneDetect74c.py", line 2321, in start_audio_stream
  File "pyaudio.py", line 754, in open
OSError: [Errno -9985] Device unavailable
Audio Device Error - TwoToneDetect had trouble finding or accessing an audio device on your system.  You may need to plug a speaker and/or line input into your PC in order for the system to activate the audio device. TwoToneDetect will now exit.
Exception ignored in: <__main__.Logger object at 0x7f4f05a11040>
AttributeError: 'Logger' object has no attribute 'flush'
 

aaknitt

Member
Feed Provider
Joined
Aug 27, 2005
Messages
1,300
@aaknitt - Any ideas in v74c of the Ubuntu version, I get this error when trying to switch from Pulse to my USB soundcard within the web interface?

Linux audio is quirky. You pretty much always want to use "pulse" as the audio source with TTD, and then use pavucontrol to select which actual audio hardware interface pulseaudio is using as input. Directly accessing the hardware doesn't allow TTD to change the sample rate (which it needs to do) and prevents you from using that same audio device in parallel with other software. So keep TTD set to pulse and then change your pulseaudio settings to use your USB sound card.

Andy
 

jschmall

Member
Premium Subscriber
Joined
Jul 15, 2017
Messages
79
Location
Anderson, CA
@aaknitt I'm seeing the following error in my logs about once a day. After this error occurs, I have to restart the service in order for tone detection to work properly again. Any ideas on where to troubleshoot? This will happen with multiple stations, not just the one in the code example below. This is an Ubuntu 20 VM using a network pulseaudio source.'

Code:
Traceback (most recent call last):
File "TwoToneDetect74c.py", line 1765, in alert
File "pyaudio.py", line 754, in open
OSError: [Errno -9993] Illegal combination of I/O devices
delay timer Sta 23 Cottonwood 13:08:57 on 02/14/23
Traceback (most recent call last):
File "TwoToneDetect74c.py", line 1795, in alert
UnboundLocalError: local variable 'recordstream' referenced before assignment
something went wrong in alert thread - removing alert_list_local: [['Sta 23 Cottonwood', 1676408932.170134, 0]]
 

aaknitt

Member
Feed Provider
Joined
Aug 27, 2005
Messages
1,300
@aaknitt I'm seeing the following error in my logs about once a day. After this error occurs, I have to restart the service in order for tone detection to work properly again. Any ideas on where to troubleshoot? This will happen with multiple stations, not just the one in the code example below. This is an Ubuntu 20 VM using a network pulseaudio source.'

Code:
Traceback (most recent call last):
File "TwoToneDetect74c.py", line 1765, in alert
File "pyaudio.py", line 754, in open
OSError: [Errno -9993] Illegal combination of I/O devices
delay timer Sta 23 Cottonwood 13:08:57 on 02/14/23
Traceback (most recent call last):
File "TwoToneDetect74c.py", line 1795, in alert
UnboundLocalError: local variable 'recordstream' referenced before assignment
something went wrong in alert thread - removing alert_list_local: [['Sta 23 Cottonwood', 1676408932.170134, 0]]
The error is basically saying that TTD is having trouble accessing the sound device. I've most often seen that when using extremely flaky sound cards on Windows or when Windows tries to go to sleep and the sound cards shut down. I'm not sure what might be causing it in Ubuntu. Linux audio is a bit of voodoo to me...I've seen lots of strange things happen where sound device enumerations seem to randomly change, sound devices appear and disappear at seemingly random, etc. Unfortunately I don't think I'll be much help since I'm not very knowledgeable about the Linux audio & sound card interface side of things.

Andy
 

jschmall

Member
Premium Subscriber
Joined
Jul 15, 2017
Messages
79
Location
Anderson, CA
The error is basically saying that TTD is having trouble accessing the sound device. I've most often seen that when using extremely flaky sound cards on Windows or when Windows tries to go to sleep and the sound cards shut down. I'm not sure what might be causing it in Ubuntu. Linux audio is a bit of voodoo to me...I've seen lots of strange things happen where sound device enumerations seem to randomly change, sound devices appear and disappear at seemingly random, etc. Unfortunately I don't think I'll be much help since I'm not very knowledgeable about the Linux audio & sound card interface side of things.

Andy
No worries. I figured I’d ask before I went down the rabbit hole and tried to resolve this. I’ll report back if I figure anything out that could be useful for others.
 

KC2NNS

Member
Premium Subscriber
Joined
Nov 28, 2007
Messages
17
Location
Freehold, NJ
Hello, everyone.

Unfortunately, the home server I was running TTD on crashed a several weeks ago and I've been trying to resurrect TTD on a new one. I'm having a problem that I didn't run into the first time, and I'm just looking to see if somebody can point me in the right direction. TTD recognizes the tones accurately and activates, but the recording sounds slow/warped (it's half speed - if I play it back at double-time with Audacity it becomes intelligible) and the file is twice as long as the test audio length. It's like something in the recording process stretched the audio out. After reviewing some previous posts here, I suspect it's an issue with the sampling rate, but no matter what adjustments I make, I can't fix the issue.

I tried changing the TTD setting for MP3 bitrate, left/right/mono audio, various settings for the USB audio adapter. Nothing seems to do the trick. While troubleshooting, I was able to determine that the original WAV being recorded also sounds the same way, before it's converted into MP3, so the problem isn't in the conversation process. I also tried recording the scanner audio using a different application (Audacity) and that works OK. I also noticed that my original TTD server Windows 7) was set to mono in the config file, but if I select that on the new machine (Windows 10) I get no audio. If I choose either Left or Right, I get the scanner audio. It's the same USB sound adapter. I did also grab another USB sound adapter I had laying around (different model) and experienced the same problem with that one, too.

Hopefully something I've missed will pop out for somebody. I'm really scratching my head over here. Thanks!
 

xxbryantd

Member
Joined
Sep 11, 2015
Messages
54
Im attempting to move my two-tone instance over from my windows 11 server over to a raspberry pi dedicated to running the two-tone program. Im having issues with audio noise though. Im using the record out from my uniden scanner and using in-line aux cable filter that goes into a usb to aux in cable. Im getting alot of static noise in the audio and would love to be able to clear that up if possible. Anyone else had issues like this or know how to go about fixing it.
 

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,547
Location
Massachusetts
Im attempting to move my two-tone instance over from my windows 11 server over to a raspberry pi dedicated to running the two-tone program. Im having issues with audio noise though. Im using the record out from my uniden scanner and using in-line aux cable filter that goes into a usb to aux in cable. Im getting alot of static noise in the audio and would love to be able to clear that up if possible. Anyone else had issues like this or know how to go about fixing it.
Have you tried simply removing everything except for the audio cable and usb sound card? Plug the cable into an external speaker jack and into mic in (or line in) on the sound card. Keep scanner volume low.

if you plug a headset into the record out, do you hear good audio?
 

xxbryantd

Member
Joined
Sep 11, 2015
Messages
54
Have you tried simply removing everything except for the audio cable and usb sound card? Plug the cable into an external speaker jack and into mic in (or line in) on the sound card. Keep scanner volume low.

if you plug a headset into the record out, do you hear good audio?
The audio from the scanner is clear, as I was getting clear sound when I use the same audio line in for windows 11 Only thing that is diffrent is it now being on a raspberry pi device with a line-in to usb adapter vs windows 11 server with a dedicated sound card.
 
Top