RadioReference on Facebook   RadioReference on Twitter   RadioReference Blog
 

Go Back   The RadioReference.com Forums > Computer Aided Monitoring and Programming > Streaming / Broadcasting / Audio Recording


Streaming / Broadcasting / Audio Recording - Interested in putting your scanner online for others to hear? Want to listen to other radios on the internet. This forum is here for you to discuss these topics related to streaming scanners online.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #761 (permalink)  
Old 06-11-2018, 8:55 PM
Member
  Amateur Radio Operator
Amateur Radio
 
Join Date: Sep 2017
Location: Westport Island, ME
Posts: 9
Default I am attempting to have tones played at the station.

Currently we have the radio playing at the station fairly quietly. If one is working and not listening we may miss the tone and only find it via receiving an e-mail/SMS.

I have setup a relay with a few alarms on it via an optoisolator relay board, that's working well (we have a simple bash script controlling the GPIO pins).

My next step is to have the speakers connected to the output on the PI and turn the volume up and only play our departments tones and not the other dozen departments that shares the frequency.

With this post I am attempting to include enough to be helpful thus it may be overly verbose.

TwoToneDetect is working well for our department. We are running TwoToneDetect on a headless Raspberry PI 3.
We are only running on version of TwoToneDetect and are not running anything else on the Raspberry PI that uses audio.

I am now atteping to get fancy and having and issue if set:
playback_during_record = 1
with
playback_during_record = 0
everything other than the playback is working.

This is the cronjob that I have setup to start everything:
MAILTO=jkates@wvfd.me
@reboot /home/pi/TTD/gpio-reboot.sh
@reboot cd /home/pi/TTD/ && screen -d -m /home/pi/run-TDD.sh
4 4 * * * /usr/bin/find /home/pi/TTD/logfiles -mtime +30 -delete
*/5 * * * * sleep 60; /home/pi/TTD/check-ttd-running.sh

This is our startup script:
#!/bin/sh
export PULSE_SOURCE=alsa_input.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-mono
export PULSE_SINK=alsa_output.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-stereo
pacmd "set-default-source alsa_input.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-mono"
pacmd "set-default-sink alsa_output.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-stereo"
cd /home/pi/TTD/
echo ./TwoToneDetect70
cd /home/pi/TTD/ && ./TwoToneDetect70

(I have attmmpted this with alsa_output.platform-soc_audio.analog-stereo as a SINK with the same retuls).


This is the list of Audio Sinks:

pi@comms:~ $ pacmd list-sinks | grep -e 'name:' -e 'index'
* index: 0
name: <alsa_output.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-stereo>
index: 1
name: <alsa_output.platform-soc_audio.analog-stereo>

I have also attempted the sam with the PULSE_SOURCE and PULSE_SINK not set.

This is the log file from my current test:
default selected as audio input device
default selected as audio output device

Successfully retrieved local tone info at 21:19:31 on 06/11/18
Successfully retrieved local tone info at 21:19:31 on 06/11/18
Tone1
Successfully retrieved local tone info at 21:19:31 on 06/11/18
483.0 12.3977969933
301.0 30.667419789
295.0 48.2842051431
274.0 347.784843007
462.0 167.093593385
285.0 122.271059819
247.0 230.1690025
263.0 142.706550656
263.0 37.3141119503
247.0 123.783107573
263.0 163.265464985
328.0 58.9881886626
247.0 110.92088044
268.0 46.7055115589
268.0 456.531346515
344.0 48.9900321807
387.0 20.2267842258
247.0 12.553876019
301.0 16659.4462412
349.0 8838.25114444
1629.0 17928.7762242
1629.0 14403.2066596
263.0 17.2065772147
1629.0 2329.54005576
1629.0 8531.12017556
322.0 23.0208128322
1597.0 7912.40192502
1597.0 8089.62876176
1597.0 8185.08879493
1597.0 8250.13844091
1597.0 8216.25555016
704.0 17090.6969335
704.0 17140.8904987
704.0 17327.7904244
704.0 18236.7727301
709.0 18120.8059701
704.0 18323.9399207
704.0 18149.3543773
704.0 18386.7731098
709.0 18187.8939825
704.0 18200.29209
704.0 18957.0372221
704.0 18921.3736168
709.0 18817.6042038
704.0 19113.4462887
704.0 19255.2548571
Westport VFD Tone Set Found

0
after record
delay timer Westport VFD 21:22:40 on 06/11/18
0
delay done Westport VFD 21:22:40 on 06/11/18
waiting for audio Westport VFD 21:22:40 on 06/11/18
threshold value: 45
mono
704.0 19223.2374244
threshold exceeded
recording audio Westport VFD 21:22:40 on 06/11/18
iterations: 300
Traceback (most recent call last):
File "TwoToneDetect70.py", line 716, in alert
File "dist-packages/pyaudio.py", line 577, in write
IOError: [Errno Not output stream] -9974
709.0 19152.9878521
478.0 317.280926163
838.0 288.70974401
478.0 268.569162197
478.0 259.876890725
478.0 323.417454983
360.0 285.082441199
838.0 317.516349891
602.0 240.048870877
478.0 287.940957971
done converting to MP3 Westport VFD 21:22:42 on 06/11/18
478.0 269.195501227
478.0 309.703138144
478.0 254.264958375
done converting to AMR Westport VFD 21:22:42 on 06/11/18
Traceback (most recent call last):
File "TTD70.py", line 61, in mail
IOError: [Errno 2] No such file or directory: './audio/Westport_VFD_2018_06_11_21_22_40.mp3'
Email not sent via smtp.gmail.com on port 587 using STARTTLS on attempt 1 trying again in five seconds for Westport VFD Page Received at 21:22:40 on 06/11/18
311.0 563.206201656
360.0 410.888617805
360.0 349.740494429
602.0 3019.49864986
360.0 807.671106292
360.0 1000.83577943
360.0 708.376258953
360.0 1451.70899051
Traceback (most recent call last):
File "TTD70.py", line 61, in mail
IOError: [Errno 2] No such file or directory: './audio/Westport_VFD_2018_06_11_21_22_40.mp3'
Email not sent via smtp.gmail.com on port 587 using STARTTLS on attempt 2 trying again in five seconds for Westport VFD Page Received at 21:22:40 on 06/11/18
Traceback (most recent call last):
File "TTD70.py", line 61, in mail
IOError: [Errno 2] No such file or directory: './audio/Westport_VFD_2018_06_11_21_22_40.mp3'
Email not sent via smtp.gmail.com on port 587 using STARTTLS on attempt 3 trying again in five seconds for Westport VFD Page Received at 21:22:40 on 06/11/18
max retries exceeded, failed to send email
Traceback (most recent call last):
File "TwoToneDetect70.py", line 976, in alert
OSError: [Errno 2] No such file or directory: './audio/Westport_VFD_2018_06_11_21_22_40.wav'


This is my tones.cfg for when it failed:
[Tone1]
Atone = 1598.0 ;A tone frequency in Hz
Btone = 707.3 ;B tone frequency in Hz
Btonelength = 3
Description = Westport VFD
Atonelength = 1
gaplength = 0
ignore_after = 5
playback_during_record = 1
email_body = [d] Page Received at [t]
email_subject = [d] Page Received at [t]
mp3_emails ="Jason A Kates"<jason@kates.org>
text_email_send = after record
alert_command = /home/pi/TTD/alert.sh
This is a copy of our config.cfg (usernames & password have been removed):
[Section1]
email_user =
email_pwd =
email_server = smtp.gmail.com ;SMTP server address of email provider
email_port = 587 ;port to access email server with
record_seconds = 30.0 ;number of seconds of audio to record after a valid tone set is found
record_delay = 6 ;number of seconds to wait after a tone set is found before starting to record
tone_tolerance = 0.020 ;tolerance of tone detection algorithm 1% = .01
input_device_index = 5 ;index of audio input device
;output_device_index = 1 ;index of audio output device
output_device_index = 0 ;index of audio output device
audio_threshold = 45 ;threshold of audio squelch. audio signals below this level will be ignored
tone_offset = 0.0 ;tone offset in percentage. .01 = +1% tone offset, -.02 = -2% tone offset, etc.
mp3_bitrate = 32000 ;bit rate of mp3 encoder. Lower bitrate = smaller file size and lower audio quality
BCC = 1 ;1 = email addresses will be BCCed (hidden from other recipients). 0 = recipients will see other recipients
email_priority = 1 ;priority of email (1=highest, 3=normal, 5=lowest)
release_time=3.0 ;amount of silence (in seconds) required before recording will stop (max=60 seconds)
audio_channel = mono
email_from =
update_interval = 60.0
stacked_extend_record = 1
email_security = STARTTLS
email_authentication = 1
start_minimized = 0
email_send_sequential = none
upload_ftp_server =
upload_ftp_port = 21
upload_ftp_username =
upload_ftp_password =
upload_file_prefix =


I can play audio and it will change output device depening on what I set for the PULSE_SINK

pi@comms:~ $ aplay police_s.wav
Playing WAVE 'police_s.wav' : Unsigned 8 bit, Rate 22000 Hz, Mono


Allong with it failing to create the .wav file audio never is played on the speakers.

This is the log with: playback_during_record = 0, set:
default selected as audio input device
default selected as audio output device

Successfully retrieved local tone info at 22:01:02 on 06/11/18
Successfully retrieved local tone info at 22:01:02 on 06/11/18
Tone1
Successfully retrieved local tone info at 22:01:02 on 06/11/18
1597.0 27391.8141924
1597.0 27402.4910385
1597.0 27401.1459138
1597.0 27405.9139557
1597.0 27383.2889804
1597.0 27364.7665974
709.0 27216.8052765
709.0 27139.8090436
709.0 27167.2788237
709.0 27096.233312
709.0 27252.2931249
709.0 27297.1757151
709.0 27249.2980383
704.0 27027.253084
704.0 27162.2789564
704.0 27000.1362662
704.0 27223.340621
704.0 27224.1758884
704.0 27129.2798324
704.0 27209.5633407
704.0 27038.1475462
Westport VFD Tone Set Found

0
after record
delay timer Westport VFD 22:02:24 on 06/11/18
0
delay done Westport VFD 22:02:24 on 06/11/18
waiting for audio Westport VFD 22:02:24 on 06/11/18
threshold value: 45
mono
704.0 27313.8014084
360.0 943.707968564
threshold exceeded
recording audio Westport VFD 22:02:24 on 06/11/18
iterations: 300
360.0 789.234650798
360.0 948.968008096
301.0 908.928059418
301.0 865.250809126
360.0 1005.07273568
354.0 4280.65263944
333.0 2529.39100123
467.0 18664.9316649
2457.0 3171.61107288
457.0 4991.20857079
527.0 14493.582017
586.0 8169.20868952
295.0 924.72352407
440.0 3019.14608772
333.0 2522.38104099
586.0 13681.5556649
301.0 1307.42330816
306.0 5208.6127886
2522.0 9654.43646619
2328.0 7319.00927395
2489.0 3505.47267643
295.0 1030.98603669
301.0 9974.907171
360.0 1219.23237371
Waiting for Silence Westport VFD 22:02:52 on 06/11/18
Done recording Westport VFD 22:02:54 on 06/11/18
done writing WAV Westport VFD 22:02:54 on 06/11/18
done converting to MP3 Westport VFD 22:02:56 on 06/11/18
done converting to AMR Westport VFD 22:02:57 on 06/11/18
setting mail server up
set up mail server
starting TLS
done starting TLS
logging in
logged in
MP3 Group Email sent to "Jason A Kates"<jason@kates.org> via smtp.gmail.com on port 587 using STARTTLS Westport VFD Page Received at 22:02:24 on 06/11/18 22:02:59 on 06/11/18




Thanks in advance -Jason
Reply With Quote
Sponsored links
  #762 (permalink)  
Old 06-11-2018, 9:14 PM
Member
  Premium Subscriber
Premium Subscriber
 
Join Date: Aug 2005
Posts: 1,090
Default

Quote:
Originally Posted by k1jak View Post
Currently we have the radio playing at the station fairly quietly. If one is working and not listening we may miss the tone and only find it via receiving an e-mail/SMS.

I have setup a relay with a few alarms on it via an optoisolator relay board, that's working well (we have a simple bash script controlling the GPIO pins).

My next step is to have the speakers connected to the output on the PI and turn the volume up and only play our departments tones and not the other dozen departments that shares the frequency.

With this post I am attempting to include enough to be helpful thus it may be overly verbose.

TwoToneDetect is working well for our department. We are running TwoToneDetect on a headless Raspberry PI 3.
We are only running on version of TwoToneDetect and are not running anything else on the Raspberry PI that uses audio.

I am now atteping to get fancy and having and issue if set:
playback_during_record = 1
with
playback_during_record = 0
everything other than the playback is working.

This is the cronjob that I have setup to start everything:
MAILTO=jkates@wvfd.me
@reboot /home/pi/TTD/gpio-reboot.sh
@reboot cd /home/pi/TTD/ && screen -d -m /home/pi/run-TDD.sh
4 4 * * * /usr/bin/find /home/pi/TTD/logfiles -mtime +30 -delete
*/5 * * * * sleep 60; /home/pi/TTD/check-ttd-running.sh

This is our startup script:
#!/bin/sh
export PULSE_SOURCE=alsa_input.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-mono
export PULSE_SINK=alsa_output.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-stereo
pacmd "set-default-source alsa_input.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-mono"
pacmd "set-default-sink alsa_output.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-stereo"
cd /home/pi/TTD/
echo ./TwoToneDetect70
cd /home/pi/TTD/ && ./TwoToneDetect70

(I have attmmpted this with alsa_output.platform-soc_audio.analog-stereo as a SINK with the same retuls).


This is the list of Audio Sinks:

pi@comms:~ $ pacmd list-sinks | grep -e 'name:' -e 'index'
* index: 0
name: <alsa_output.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-stereo>
index: 1
name: <alsa_output.platform-soc_audio.analog-stereo>

I have also attempted the sam with the PULSE_SOURCE and PULSE_SINK not set.

This is the log file from my current test:
default selected as audio input device
default selected as audio output device

Successfully retrieved local tone info at 21:19:31 on 06/11/18
Successfully retrieved local tone info at 21:19:31 on 06/11/18
Tone1
Successfully retrieved local tone info at 21:19:31 on 06/11/18
483.0 12.3977969933
301.0 30.667419789
295.0 48.2842051431
274.0 347.784843007
462.0 167.093593385
285.0 122.271059819
247.0 230.1690025
263.0 142.706550656
263.0 37.3141119503
247.0 123.783107573
263.0 163.265464985
328.0 58.9881886626
247.0 110.92088044
268.0 46.7055115589
268.0 456.531346515
344.0 48.9900321807
387.0 20.2267842258
247.0 12.553876019
301.0 16659.4462412
349.0 8838.25114444
1629.0 17928.7762242
1629.0 14403.2066596
263.0 17.2065772147
1629.0 2329.54005576
1629.0 8531.12017556
322.0 23.0208128322
1597.0 7912.40192502
1597.0 8089.62876176
1597.0 8185.08879493
1597.0 8250.13844091
1597.0 8216.25555016
704.0 17090.6969335
704.0 17140.8904987
704.0 17327.7904244
704.0 18236.7727301
709.0 18120.8059701
704.0 18323.9399207
704.0 18149.3543773
704.0 18386.7731098
709.0 18187.8939825
704.0 18200.29209
704.0 18957.0372221
704.0 18921.3736168
709.0 18817.6042038
704.0 19113.4462887
704.0 19255.2548571
Westport VFD Tone Set Found

0
after record
delay timer Westport VFD 21:22:40 on 06/11/18
0
delay done Westport VFD 21:22:40 on 06/11/18
waiting for audio Westport VFD 21:22:40 on 06/11/18
threshold value: 45
mono
704.0 19223.2374244
threshold exceeded
recording audio Westport VFD 21:22:40 on 06/11/18
iterations: 300
Traceback (most recent call last):
File "TwoToneDetect70.py", line 716, in alert
File "dist-packages/pyaudio.py", line 577, in write
IOError: [Errno Not output stream] -9974
709.0 19152.9878521
478.0 317.280926163
838.0 288.70974401
478.0 268.569162197
478.0 259.876890725
478.0 323.417454983
360.0 285.082441199
838.0 317.516349891
602.0 240.048870877
478.0 287.940957971
done converting to MP3 Westport VFD 21:22:42 on 06/11/18
478.0 269.195501227
478.0 309.703138144
478.0 254.264958375
done converting to AMR Westport VFD 21:22:42 on 06/11/18
Traceback (most recent call last):
File "TTD70.py", line 61, in mail
IOError: [Errno 2] No such file or directory: './audio/Westport_VFD_2018_06_11_21_22_40.mp3'
Email not sent via smtp.gmail.com on port 587 using STARTTLS on attempt 1 trying again in five seconds for Westport VFD Page Received at 21:22:40 on 06/11/18
311.0 563.206201656
360.0 410.888617805
360.0 349.740494429
602.0 3019.49864986
360.0 807.671106292
360.0 1000.83577943
360.0 708.376258953
360.0 1451.70899051
Traceback (most recent call last):
File "TTD70.py", line 61, in mail
IOError: [Errno 2] No such file or directory: './audio/Westport_VFD_2018_06_11_21_22_40.mp3'
Email not sent via smtp.gmail.com on port 587 using STARTTLS on attempt 2 trying again in five seconds for Westport VFD Page Received at 21:22:40 on 06/11/18
Traceback (most recent call last):
File "TTD70.py", line 61, in mail
IOError: [Errno 2] No such file or directory: './audio/Westport_VFD_2018_06_11_21_22_40.mp3'
Email not sent via smtp.gmail.com on port 587 using STARTTLS on attempt 3 trying again in five seconds for Westport VFD Page Received at 21:22:40 on 06/11/18
max retries exceeded, failed to send email
Traceback (most recent call last):
File "TwoToneDetect70.py", line 976, in alert
OSError: [Errno 2] No such file or directory: './audio/Westport_VFD_2018_06_11_21_22_40.wav'


This is my tones.cfg for when it failed:
[Tone1]
Atone = 1598.0 ;A tone frequency in Hz
Btone = 707.3 ;B tone frequency in Hz
Btonelength = 3
Description = Westport VFD
Atonelength = 1
gaplength = 0
ignore_after = 5
playback_during_record = 1
email_body = [d] Page Received at [t]
email_subject = [d] Page Received at [t]
mp3_emails ="Jason A Kates"<jason@kates.org>
text_email_send = after record
alert_command = /home/pi/TTD/alert.sh
This is a copy of our config.cfg (usernames & password have been removed):
[Section1]
email_user =
email_pwd =
email_server = smtp.gmail.com ;SMTP server address of email provider
email_port = 587 ;port to access email server with
record_seconds = 30.0 ;number of seconds of audio to record after a valid tone set is found
record_delay = 6 ;number of seconds to wait after a tone set is found before starting to record
tone_tolerance = 0.020 ;tolerance of tone detection algorithm 1% = .01
input_device_index = 5 ;index of audio input device
;output_device_index = 1 ;index of audio output device
output_device_index = 0 ;index of audio output device
audio_threshold = 45 ;threshold of audio squelch. audio signals below this level will be ignored
tone_offset = 0.0 ;tone offset in percentage. .01 = +1% tone offset, -.02 = -2% tone offset, etc.
mp3_bitrate = 32000 ;bit rate of mp3 encoder. Lower bitrate = smaller file size and lower audio quality
BCC = 1 ;1 = email addresses will be BCCed (hidden from other recipients). 0 = recipients will see other recipients
email_priority = 1 ;priority of email (1=highest, 3=normal, 5=lowest)
release_time=3.0 ;amount of silence (in seconds) required before recording will stop (max=60 seconds)
audio_channel = mono
email_from =
update_interval = 60.0
stacked_extend_record = 1
email_security = STARTTLS
email_authentication = 1
start_minimized = 0
email_send_sequential = none
upload_ftp_server =
upload_ftp_port = 21
upload_ftp_username =
upload_ftp_password =
upload_file_prefix =


I can play audio and it will change output device depening on what I set for the PULSE_SINK

pi@comms:~ $ aplay police_s.wav
Playing WAVE 'police_s.wav' : Unsigned 8 bit, Rate 22000 Hz, Mono


Allong with it failing to create the .wav file audio never is played on the speakers.

This is the log with: playback_during_record = 0, set:
default selected as audio input device
default selected as audio output device

Successfully retrieved local tone info at 22:01:02 on 06/11/18
Successfully retrieved local tone info at 22:01:02 on 06/11/18
Tone1
Successfully retrieved local tone info at 22:01:02 on 06/11/18
1597.0 27391.8141924
1597.0 27402.4910385
1597.0 27401.1459138
1597.0 27405.9139557
1597.0 27383.2889804
1597.0 27364.7665974
709.0 27216.8052765
709.0 27139.8090436
709.0 27167.2788237
709.0 27096.233312
709.0 27252.2931249
709.0 27297.1757151
709.0 27249.2980383
704.0 27027.253084
704.0 27162.2789564
704.0 27000.1362662
704.0 27223.340621
704.0 27224.1758884
704.0 27129.2798324
704.0 27209.5633407
704.0 27038.1475462
Westport VFD Tone Set Found

0
after record
delay timer Westport VFD 22:02:24 on 06/11/18
0
delay done Westport VFD 22:02:24 on 06/11/18
waiting for audio Westport VFD 22:02:24 on 06/11/18
threshold value: 45
mono
704.0 27313.8014084
360.0 943.707968564
threshold exceeded
recording audio Westport VFD 22:02:24 on 06/11/18
iterations: 300
360.0 789.234650798
360.0 948.968008096
301.0 908.928059418
301.0 865.250809126
360.0 1005.07273568
354.0 4280.65263944
333.0 2529.39100123
467.0 18664.9316649
2457.0 3171.61107288
457.0 4991.20857079
527.0 14493.582017
586.0 8169.20868952
295.0 924.72352407
440.0 3019.14608772
333.0 2522.38104099
586.0 13681.5556649
301.0 1307.42330816
306.0 5208.6127886
2522.0 9654.43646619
2328.0 7319.00927395
2489.0 3505.47267643
295.0 1030.98603669
301.0 9974.907171
360.0 1219.23237371
Waiting for Silence Westport VFD 22:02:52 on 06/11/18
Done recording Westport VFD 22:02:54 on 06/11/18
done writing WAV Westport VFD 22:02:54 on 06/11/18
done converting to MP3 Westport VFD 22:02:56 on 06/11/18
done converting to AMR Westport VFD 22:02:57 on 06/11/18
setting mail server up
set up mail server
starting TLS
done starting TLS
logging in
logged in
MP3 Group Email sent to "Jason A Kates"<jason@kates.org> via smtp.gmail.com on port 587 using STARTTLS Westport VFD Page Received at 22:02:24 on 06/11/18 22:02:59 on 06/11/18




Thanks in advance -Jason
Jason,

I'm trying to remember if I've ever gotten the playback_during_record to work on a Pi or not. The error you're getting is indicating that the system can't access the sound card. The Pyaudio library being used may not support simultaneous playback and record from the same device on a Pi. I would suggest trying to playback through the Pi's onboard audio output (rather than the USB sound card) and see if you can get that to work.

Another more kludgy option would be to route the audio through a relay to the amplifier (assuming you're feeding an amplifier) that's controlled by a GPIO pin.

Andy
__________________
Using TwoToneDetect? Show us where! Add yourself to the user map here or PM me with your location and I'll add you.

If you need help with TwoToneDetect please read this post first
Reply With Quote
  #763 (permalink)  
Old 06-11-2018, 9:23 PM
Member
  Amateur Radio Operator
Amateur Radio
 
Join Date: Sep 2017
Location: Westport Island, ME
Posts: 9
Default

Quote:
Originally Posted by aaknitt View Post
Jason,

I'm trying to remember if I've ever gotten the playback_during_record to work on a Pi or not. The error you're getting is indicating that the system can't access the sound card. The Pyaudio library being used may not support simultaneous playback and record from the same device on a Pi. I would suggest trying to playback through the Pi's onboard audio output (rather than the USB sound card) and see if you can get that to work.

Another more kludgy option would be to route the audio through a relay to the amplifier (assuming you're feeding an amplifier) that's controlled by a GPIO pin.

Andy
Andy,
Thanks for the reply.

I have attempted from the on-board audio too, without any luck. Currently the setup is just a bunch of the midland speakers kicking around the station with a 6 way headphones spliter (was setup before my time).

I have purchased one of these: https://smile.amazon.com/gp/product/B00WV7GMA2/ and have the alert code setup to run the 2nd GPIO pin already:

cat TTD/alert.sh
#!/bin/sh
sudo bash -c 'echo "17" > /sys/class/gpio/export' > /dev/null 2>&1
sudo bash -c 'echo "22" > /sys/class/gpio/export' > /dev/null 2>&1
sudo bash -c 'echo "out" > /sys/class/gpio/gpio17/direction'
sudo bash -c 'echo "out" > /sys/class/gpio/gpio22/direction'
# Write output
sudo bash -c 'echo "0" > /sys/class/gpio/gpio17/value'
sudo bash -c 'echo "0" > /sys/class/gpio/gpio22/value'
sleep 3
sudo bash -c 'echo "1" > /sys/class/gpio/gpio17/value'
sleep 90
sudo bash -c 'echo "1" > /sys/class/gpio/gpio22/value'
(It's controlling a two channel relay board for now, thus I may need to reverse the direction of pin 22)
https://smile.amazon.com/gp/product/B00E0NTPP4/

As I am doing this on my own $ i am looking to see if someone will donate an old amplifier to the cause.


-Jason
Reply With Quote
  #764 (permalink)  
Old 06-13-2018, 4:35 AM
davidVT's Avatar
Member
  Audio Feed Provider
Audio Feed Provider
 
Join Date: Aug 2010
Location: Washington County,Vermont
Posts: 98
Default TwoToneDetect on a Raspberry Pi - How To

I like the kludgy idea at least as a working proof of concept.
I notice the message free notifications fire off as soon as the tone is received. Perhaps a script similar to how simple pushover fires could work along with that GPIO idea. I have some LEDs driven by TTD and node-red. I will see if they come on early enough to trigger such a speaker relay.

I see this device. Maybe too pricey but looks interesting, often used to control background music when building fire alarms go off:
"st-ssr1 solid state relay"
One of many sources in this link if you can open it.
https://www.bhphotovideo.com/c/produ...xoCaMQQAvD_BwE


Also I kind of recall DC31 saying he could listen to his incoming pages when I was trying to do that. However perhaps it was just the raw scanner feeds we send to broadcastify.

Quote:
Originally Posted by aaknitt View Post
Jason,



I'm trying to remember if I've ever gotten the playback_during_record to work on a Pi or not. The error you're getting is indicating that the system can't access the sound card. The Pyaudio library being used may not support simultaneous playback and record from the same device on a Pi. I would suggest trying to playback through the Pi's onboard audio output (rather than the USB sound card) and see if you can get that to work.



Another more kludgy option would be to route the audio through a relay to the amplifier (assuming you're feeding an amplifier) that's controlled by a GPIO pin.



Andy





Sent from my iPad using Tapatalk

Last edited by davidVT; 06-13-2018 at 5:00 AM..
Reply With Quote
  #765 (permalink)  
Old 06-13-2018, 4:49 AM
Member
  Audio Feed Provider
Audio Feed Provider
 
Join Date: Feb 2011
Location: Massachusetts
Posts: 951
Default

Quote:
Originally Posted by davidVT View Post
I like the kludgy idea at least as a working proof of concept.
I notice the message free notifications fire off as soon as the tone is received. Perhaps a script similar to how simple pushover fires could work along with that GPIO idea. I have some LEDs driven by TTD and node-red. I will see if they come on early enough to trigger such a speaker relay.
Also I kind of recall DC31 saying he could listen to his incoming pages when I was trying to do that. However perhaps it was just the raw scanner feeds we send to broadcastify.








Sent from my iPad using Tapatalk
Years ago, i remember having playback_during_record working on a pi. Probably an original Model B pi. In more recent attempts, I have not had success. You can use the alert_command to play a .wav file (alert tone?) which fires as soon as the tone set decodes. Then using the post_emsil_command you could play the recorded dispatch from the audio folder. However, this would delay the message until after recording is completed.

Unless you can get the playback feature working, I think the speaker relay is probably the easiest, cheapest option.

We have a pi connected up (HDMI) to a screen in the apparatus bay displaying IamResponding continuously. Any audio played on that pi comes right out of the tv speakers.
Reply With Quote
Sponsored links
  #766 (permalink)  
Old 06-13-2018, 6:36 AM
Member
  Amateur Radio Operator
Amateur Radio
 
Join Date: Sep 2017
Location: Westport Island, ME
Posts: 9
Default

Quote:
Originally Posted by DC31 View Post
Years ago, i remember having playback_during_record working on a pi. Probably an original Model B pi. In more recent attempts, I have not had success. You can use the alert_command to play a .wav file (alert tone?) which fires as soon as the tone set decodes. Then using the post_emsil_command you could play the recorded dispatch from the audio folder. However, this would delay the message until after recording is completed.

Unless you can get the playback feature working, I think the speaker relay is probably the easiest, cheapest option.

We have a pi connected up (HDMI) to a screen in the apparatus bay displaying IamResponding continuously. Any audio played on that pi comes right out of the tv speakers.
Thanks for the help,

Since I have the relay controlled power strip I have ordered:
https://smile.amazon.com/gp/product/B01FZKA28Y/
https://smile.amazon.com/gp/product/B003DBTAZ4/
https://smile.amazon.com/gp/product/B00081NX5U/

If that works out well I might order a 2nd set and that should give me coverage in all of the bays and upstairs, with better volume only when we need it.

The first set was ~$60 and should arrive Friday. I should be able to install them this weekend and give it a test.

Our station:
https://www.wvfd-me.org/


Thanks again for the the help. This software is very useful for our department.
-Jason
Reply With Quote
  #767 (permalink)  
Old 06-15-2018, 4:30 PM
Member
  Audio Feed Provider
Audio Feed Provider
 
Join Date: Jan 2009
Location: Ottawa Illinois
Posts: 931
Default

Switched to a pi3 setup and the pushover is delayed. It use to be sent instantaneously when ttd detected a tone on the pi2. Now itís being delayed 5 mins or more. Any ideas?
Reply With Quote
  #768 (permalink)  
Old 06-21-2018, 8:12 AM
Member
   
Join Date: Oct 2009
Posts: 28
Default

I have been trying to get TTD to work on my new raspberrypi 3. The image from their website doesn't work on rpi3. I am trying to set this up without any GUI.

My only issue right now is I can't get pulseaudio configured correctly. When I run LevelMeter I only get the following options:

AUDIO DEVICE LISTING:
Output Device 0: bcm2835 ALSA: - (hw:0,0)
Output Device 1: bcm2835 ALSA: IEC958/HDMI (hw:0,1)
Input Device 2: USB Sound Device: Audio (hw:1,0)
Output Device 2: USB Sound Device: Audio (hw:1,0)
Output Device 3: sysdefault
Output Device 4: dmix
Input Device 5: default
Output Device 5: default

On my older rpi2 I would get pulse as one of the input/output options.

Anyone have a step by step to properly setting up pulseaudio on the rpi3 for use with TTD?

Also, LevelMeter.py works with source 5. However, if I give source 5 to TTD it will crash with:

Traceback (most recent call last):
File "Fire.py", line 833, in <module>
stream = p.open(format=FORMAT, channels=CHANNELS, rate=RATE, input=True, output=False, frames_per_buffer=chunk, input_device_index=input_device, output_device_index=output_device)
NameError: name 'input_device' is not defined
Traceback (most recent call last):
File "Fire.py", line 862, in <module>
audio_data = record(0.2, audio_channel)
File "Fire.py", line 841, in record
data = stream.read(chunk)
NameError: global name 'stream' is not defined

Last edited by jwjkp; 06-21-2018 at 9:53 AM..
Reply With Quote
  #769 (permalink)  
Old 06-21-2018, 5:58 PM
Member
   
Join Date: Oct 2009
Posts: 28
Default

Forget my prior post. I was using a modified version of 68 that I run. I upgraded to v70 and made the same modifications (removing all emailing/recording features) and it now works on the rpi3.
Reply With Quote
  #770 (permalink)  
Old 06-21-2018, 6:00 PM
Member
  Audio Feed Provider
Audio Feed Provider
 
Join Date: Feb 2011
Location: Massachusetts
Posts: 951
Default

Quote:
Originally Posted by jwjkp View Post
I have been trying to get TTD to work on my new raspberrypi 3. The image from their website doesn't work on rpi3. I am trying to set this up without any GUI.

My only issue right now is I can't get pulseaudio configured correctly. When I run LevelMeter I only get the following options:

AUDIO DEVICE LISTING:
Output Device 0: bcm2835 ALSA: - (hw:0,0)
Output Device 1: bcm2835 ALSA: IEC958/HDMI (hw:0,1)
Input Device 2: USB Sound Device: Audio (hw:1,0)
Output Device 2: USB Sound Device: Audio (hw:1,0)
Output Device 3: sysdefault
Output Device 4: dmix
Input Device 5: default
Output Device 5: default

On my older rpi2 I would get pulse as one of the input/output options.

Anyone have a step by step to properly setting up pulseaudio on the rpi3 for use with TTD?

Also, LevelMeter.py works with source 5. However, if I give source 5 to TTD it will crash with:

Traceback (most recent call last):
File "Fire.py", line 833, in <module>
stream = p.open(format=FORMAT, channels=CHANNELS, rate=RATE, input=True, output=False, frames_per_buffer=chunk, input_device_index=input_device, output_device_index=output_device)
NameError: name 'input_device' is not defined
Traceback (most recent call last):
File "Fire.py", line 862, in <module>
audio_data = record(0.2, audio_channel)
File "Fire.py", line 841, in record
data = stream.read(chunk)
NameError: global name 'stream' is not defined
Try default as the source
Reply With Quote
  #771 (permalink)  
Old 06-21-2018, 8:11 PM
Member
  Audio Feed Provider
Audio Feed Provider
 
Join Date: Feb 2011
Location: Massachusetts
Posts: 951
Default

Quote:
Originally Posted by DC31 View Post
Try default as the source
Sorry, I should not hsve been so brief.

If you are using TTD in the GUI mode, choose default as the input device in the TTD window.

If you are using TTD in command line mode, set both input and output device indexes in config.cfg to 0 (zero)
Reply With Quote
  #772 (permalink)  
Old 06-22-2018, 9:34 AM
Member
   
Join Date: Oct 2009
Posts: 28
Default

DC31, Thanks!

I did however get it working by upgrading to version 70 of TTD. Was using 68.
Reply With Quote
  #773 (permalink)  
Old 06-27-2018, 6:08 PM
Member
  Amateur Radio Operator
Amateur Radio
 
Join Date: Sep 2009
Location: Waldron, Ar
Posts: 7
Default

Hello guys I need some help everytime I try to run ttd after modifying the config file it gives me this in the logfiles and wont run ttd

Sent from my SM-G950U using Tapatalk
__________________
Rodger Severns
73's From KE5BNV
Reply With Quote
  #774 (permalink)  
Old 06-27-2018, 7:06 PM
Member
  Amateur Radio Operator
Amateur Radio
 
Join Date: Sep 2009
Location: Waldron, Ar
Posts: 7
Default

Quote:
Originally Posted by ke5bnv View Post
Hello guys I need some help everytime I try to run ttd after modifying the config file it gives me this in the logfiles and wont run ttd

Sent from my SM-G950U using Tapatalk
Got it figured out. Forgot to put my password in to base64. Now if I can just get it to start automatically on boot

Sent from my SM-G950U using Tapatalk
__________________
Rodger Severns
73's From KE5BNV
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 10:52 AM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
All information here is Copyright 2012 by RadioReference.com LLC and Lindsay C. Blanton III.Ad Management by RedTyger
Copyright 2015 by RadioReference.com LLC Privacy Policy  |  Terms and Conditions