Topics

DTMF Tones and UDRC

Matthew Wolf
 

Is there any way to have to have to codec (TLV320AIC3204) on the UDRC pass DTMF tones the Raspberry PI?  I purchased the UDRC in order to setup up a aprstt gateway using direwolf.  I have tried to change the codec setting via the alsa tools with on luck. I have even looked at the kernel source for the snd_soc_tlv320aic32x4 and snd_soc_tlv320aic32x4_i2c kernel modules.

I can get direwolf and aprstt working with a usb sound card. I would prefer to use the UDRC instead of a USB sound card.


-Thanks

Matt, N4MTT

Jeremy McDermond
 

Matthew Wolf <mjwn4mtt@...> wrote:

Is there any way to have to have to codec (TLV320AIC3204) on the UDRC pass DTMF tones the Raspberry PI? I purchased the UDRC in order to setup up a aprstt gateway using direwolf. I have tried to change the codec setting via the alsa tools with on luck. I have even looked at the kernel source for the snd_soc_tlv320aic32x4 and snd_soc_tlv320aic32x4_i2c kernel modules.

I can get direwolf and aprstt working with a usb sound card. I would prefer to use the UDRC instead of a USB sound card.
Matthew --

I don’t recall you getting any answers to this question, so I’ll jump in. There is no special processing of DTMF tones in the AIC3204. It’s just a sound chip. It just samples the audio and passes it to the Pi. So I’m not sure where you’re going wrong with aprstt.

-Thanks

Matt, N4MTT
--
Jeremy McDermond
nh6z@...

Matthew Wolf
 

I have gotten both of the audio inputs on the UDRC working with direwolf. The left channel (AFOUT) is decoding packets. The right channel (DISCOUT) is decoding the DTMF tones.   The configuration of the UDRC is done by a shell that I will attach to the end of this message.

I having issue with the right audio output (TONEIN) on my UDRC. Have not gotten the audio output working from the UDRC.

I have gotten the audio output working correctly on a USB sound card. Once I resolve the audio output issue with my UDRC, I will adapt the USB sound card configuration to work with the UDRC.

With the USB sound card I have enabled the ability to have multiple programs use the sound card at the same time. This is needed for that the aprstt voice announcements can use the sound car at the same time as direwolf. 

I also have setup sound routing on the usb sound card. The left and right input and the left output is routed to direwolf. the right output is routed to the voice generation program. 

All the USB sound card stuff is done in a asoundrc file.   


-Matt, N4MTT


#!/bin/bash

# N4MTT-UDRC-level-preset.sh
# Version 1.0
# A bash script that uses the Alsa amixer program to configure the
# NW Digital Radio's Universal Digital Radio Controller (UDRC).
#
# This script enables all audio lines that are connected to the audio
# codec (TLV320AIC3204) on the UDRC, IN1_L, IN1_R, LOL, LOR.
#
# By Matthew J. Wolf <matthew.wolf.hpsdr@...>
# Copyright 2016 Matthew J. Wolf
#
# This bash script is free software: you can
# redistribute it and/or modify it under the terms of the GNU
# General Public License as published by the Free Software Foundation,
# either version 2 of the License, or (at your option) any later version.
#
# The N4MTT-UDRC-level-preset.sh bash script is distributed in the hope that
# it will be useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
# the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License.
# If not, see <http://www.gnu.org/licenses/>.

#
# The labels for the input setting are confusing because they are labeled
# for both single ended and balanced audio. We are using the inputs for
# single audio not balanced audio.
#
# See TI's "TLV320AIC3204 Application Reference Guide" for details (SLAA557).
# Also the Linux kernel source for kernel module
# snd_soc_tlv320aic32x4  (tlv320aic32x4.c ) is helpful.
#

amixer -q -c udrc -s << EOF

# - Gain Settings -

# Input ADC Gain.
sset 'ADC Level' 5.5dB

# Line Out Amplifier Gain.
sset 'LO Driver Gain' 0.0dB

# Output DAC Gain.
sset 'PCM' 0.0dB

# Headphone Amplifier Gain
sset 'HP Driver Gain' 0

# - Input Routing -

# Set Positive Terminal Input Route and Resistance to Left or Right PGA.
sset 'IN1_L to Left Mixer Positive Resistor' '10 kOhm'
sset 'IN1_R to Right Mixer Positive Resistor' '10 kOhm'

# Set Route and Resistance for Common Mode (ground) to PGA
# This grounds the Negative line of the Balanced connection at the PGA.
# The grounding makes the input become a single ended connection.
sset 'CM_L to Left Mixer Negative Resistor' '10 kOhm'
sset 'CM_R to Right Mixer Negative Resistor' '10 kOhm'

# Make sure that the Inputs are not Cross Connected.
sset 'IN1_L to Right Mixer Negative Resistor' 'Off'
sset 'IN1_R to Left Mixer Positive Resistor' 'Off'

# Disable Inputs that are not Connected.
sset 'IN2_L to Left Mixer Positive Resistor' 'Off'
sset 'IN2_L to Right Mixer Positive Resistor' 'Off'
sset 'IN2_R to Left Mixer Negative Resistor' 'Off'
sset 'IN2_R to Right Mixer Positive Resistor' 'Off'
sset 'IN3_L to Left Mixer Positive Resistor' 'Off'
sset 'IN3_L to Right Mixer Negative Resistor' 'Off'
sset 'IN3_R to Left Mixer Negative Resistor' 'Off'
sset 'IN3_R to Right Mixer Positive Resistor' 'Off'

# - Analog Programmable Gain Amplifier (PGA) -
#
# Use as a buffer Amplifier. Power and set gain to zero.
#

# Power the PGA
sset 'Mic PGA' on

# Set PGA Gain.
# -Amount of Gain varies with the selected input resistance.
# -When enabled the AGC can control the PGA gain.
#  See the Application Ref. Guide for details.
#
sset 'PGA Level' 0

# Un-Mute the ADC
sset 'ADCFGA Right Mute' off
sset 'ADCFGA Left Mute' off

# - Disable and clear AGC -
sset 'AGC Attack Time' 0
sset 'AGC Decay Time' 0
sset 'AGC Gain Hysteresis' 0
sset 'AGC Hysteresis' 0
sset 'AGC Max PGA' 0
sset 'AGC Noise Debounce' 0
sset 'AGC Noise Threshold' 0
sset 'AGC Signal Debounce' 0
sset 'AGC Target Level' 0
sset 'AGC Left' off
sset 'AGC Right' off

# - Headphone Amplifier Output -
#
# The headphone amplifier output pins are
# not connected on the URDC.

# Power Headphone Amplifier
sset 'HP DAC' off

# Route DAC Output to Headphone Amp.
sset 'HPL Output Mixer L_DAC' off
sset 'HPR Output Mixer R_DAC' off

# Route Line In to Headphone Amp.
sset 'HPL Output Mixer IN1_L' off
sset 'HPR Output Mixer IN1_R' off

# - Output DACs -

# Route the DAC output to the Line Out Amplifier (LO)
sset 'LOL Output Mixer L_DAC' on
sset 'LOR Output Mixer R_DAC' on

# Power on the Output DACs
sset 'LO DAC' on

EOF
alsactl store


Matthew Wolf
 

There was zero interest in my area for a APRS Touch Tone gateway.  My UDRC II is now sitting in a drawer because it is not being used.

I routed the receive audio from two radios into direwolf. One radio for APRS and the second radio for  Touch Tones.  The audio output was split between direwolf and the festival speech synthesis system. One of the audio output channels on the UDRC was used by direwolf. The second output was used by festival.

Below is the asound.conf file I used to route the audio input and output.  

After the asound.conf is the direwolf configuration file I used.

Then after the  direwolf configuration are the two shell scripts that I used to generate the voice responses for Touch Tone transmissions.  

asound.conf:

pcm.card1 {
    type hw
    card udrc 
}
pcm.dmix1 {
    type dmix 
    ipc_key 34521 
    slave {
        pcm "card1" 
    }
}
pcm.dsnoop1 {
    type dsnoop 
    ipc_key 34523
    slave {
        pcm "card1" 
    }
}
pcm.asym1 {
    type asym 
    playback.pcm "dmix1" 
    capture.pcm "dsnoop1"
}
pcm.pasym1 {
    type plug 
    slave.pcm "asym1"
}
 
pcm.!default {
    type plug
    slave.pcm "asym1"
}
 
pcm.pasym1_right {
   slave.pcm pasym1
   slave.channels 2 
   type route
   ttable {
   0.0 1
   1.0 0 
   0.1 0
   1.1 0
   }
}
 
pcm.pasym1_direwolf {
   slave.pcm pasym1
   slave.channels 2
   type route
   ttable {
   0.0 0
   1.0 0
   0.1 1
   1.1 1
   }
}
 

direwolf.conf:
#
ADEVICE pasym1_direwolf
ARATE 48000
ACHANNELS 2
# THE UDRC MUST ALWAYS BE ADDRESSED AS A STEREO DEVICE ALTHOUGH WE ARE ONLY USING ONE CHANNEL
 
#############################################################
#                                                           #
#               CHANNEL 0 PROPERTIES                        #
#                                                           #
#############################################################
# Left Sound Card Input
# UDRC II HD-15 Port
CHANNEL 0
 
MYCALL N4MTT-1
 
MODEM 1200
 
PTT GPIO 12
 
# TX inhibit when the other channel is TX.
TXINH 23
 
#############################################################
#                                                           #
#               CHANNEL 1 PROPERTIES                        #
#                                                           #
#############################################################
# Right Sound Card Input 
# UDRC II DIN-6 Port 
CHANNEL 1
 
# Not correct speed!!
# Added to stop channel 1 from decoding what should only be on channel 0.
# Defaults to 1200 when not configured.
MODEM 300
 
MYCALL N4MTT-1
PTT GPIO 23
 
# TX inhibit when the other channel is TX.
TXINH 12
 
SPEECH dwfestival.sh
 
# You probably want to put in a transmit delay on the APRStt channel so it
# it doesn't start sending a response before the user releases PTT.
# This is in 10 ms units so 100 means 1000 ms = 1 second.
DWAIT 100
 
# Finally, we enable the APRStt conversion.
# This means enable the DTMF decoder on channel 1.
# Send the result to any attached applications.
# Other possibilities are transmitting a packet over the radio or
# sending information thru the IGate.
TTOBJ 1 0 WIDE1-1
 
#############################################################
#                                                           #
#               VIRTUAL TNC SERVER PROPERTIES               #
#                                                           #
#############################################################
 
#
# Dire Wolf acts as a virtual TNC and can communicate with
# client applications by different protocols:
#
# - the "AGW TCPIP Socket Interface" - default port 8000
# - KISS protocol over TCP socket - default port 8001
# - KISS TNC via pseudo terminal   (-p command line option)
#
 
AGWPORT 8000
#KISSPORT 8001
#AGWPORT  0
#KISSPORT 0
 
#
#############################################################
#                                                           #
#               BEACONING PROPERTIES                        #
#                                                           #
#############################################################
 
#PBEACON delay=1 every=10 sendto=0 overlay=F symbol="digi" lat=35^48.41N long=78^46.35W comment="Fill in digipeater and bidirectional igate. Any APRStt (Touch Tone) interest? Email n4mtt@.... Thinking of putting up a APRStt gateway on 146.580."
 
PBEACON delay=1 every=10 sendto=0 overlay=F symbol="digi" lat=******* long=****** comment="Fill in digipeater and bidirectional igate."
 
#
# When the destination field is set to "SPEECH" the information part is
# converted to speech rather than transmitted as a data frame.
#
 
#CBEACON dest="SPEECH" info="Club meeting tonight at 7 pm."
 
# Similar for Morse code.  If SSID is specified, it is multiplied
# by 2 to get speed in words per minute (WPM).
 
#CBEACON dest="MORSE-6" info="de MYCALL"
 
#############################################################
#                                                           #
#               DIGIPEATER PROPERTIES                       #
#                                                           #
#############################################################
 
DIGIPEAT 0 0 ^WIDE1-1$ ^WIDE[12]-[12]$ 
 
#DIGIPEAT 0 0 ^WIDE[1-1]-[1-1]$|^TEST$ ^WIDE[1]-[1]$ TRACE
#DIGIPEAT 0 0 ^WIDE[3-7]-[1-7]$|^TEST$ ^WIDE[12]-[12]$ TRACE 
 
DEDUPE 30
 
# Filtering can be used to limit was is digipeated.
# For example, only weather weather reports, received on channel 0,
# will be retransmitted on channel 1.
#
FILTER 0 0 !b/N4MTT-2
 
 
#############################################################
#                                                           #
#               INTERNET GATEWAY                            #
#                                                           #
#############################################################
 
#IGSERVER noam.aprs2.net
#IGSERVER 127.0.0.1:1313
IGSERVER 127.0.0.1:10152
 
IGLOGIN N4MTT-1 *****
 
# To relay messages from the Internet to radio, you need to add
# one more option with the transmit channel number and a VIA path.
 
IGTXVIA 0 WIDE1-1
 
# Direwolf is hear the packets on both ports.
# Need the same filters on both ports.
FILTER 0 IG !b/N4MTT-1
 
# Not need since I chnage the speed on port 1
FILTER 1 IG !b/N4MTT-1
FILTER 1 IG !b/N4MTT-2
 
FILTER IG 0 t/mn
 
# Do not TX the messages from the local IG server
FILTER IG 0 !b/N4MTT-1
FILTER IG 0 !b/N4MTT-3
 
# Finally, we don't want to flood the radio channel.  
# The IGate function will limit the number of packets transmitted 
# during 1 minute and 5 minute intervals.   If a limit would 
# be exceeded, the packet is dropped and message is displayed in red.
 
IGTXLIMIT 6 10
 
 
#############################################################
#                                                           #
#               APRStt GATEWAY                              #
#                                                           #
#############################################################
 
# - Gateway Location
TTPOINT B01  <REMOVED>
 
TTVECTOR B5bbbddd <REMOVED>N <REMOVED>W 0.1 mi
 
TTMHEAD BAxxxxxxxxxxxx
TTMHEAD BAxxxxxxxxxx
TTMHEAD BAxxxxxx 
 
TTSATSQ BAxxxx
 
TTAMBIG BAx
 
# Speech responses.
# Default is Morse code "R" for received OK and "?" for all errors.
 
TTERR  OK               SPEECH  Message Received. N 4 M T T A P R S touch tone gateway
TTERR  D_MSG            SPEECH  D not implemented. N 4 M T T A P R S touch tone gateway
TTERR  INTERNAL         SPEECH  Internal error. N 4 M T T A P R S touch tone gateway
TTERR  MACRO_NOMATCH    SPEECH  No definition for digit sequence N 4 M T T APRS Touch Tone gate
TTERR  BAD_CHECKSUM     SPEECH  Bad check sum on call. N 4 M T T A P R S touch tone gateway 
TTERR  INVALID_CALL     SPEECH  Invalid callsign. N 4 M T T A P R S touch tone gateway
TTERR  INVALID_OBJNAME  SPEECH  Invalid object name. N 4 M T T A P R S touch tone gateway
TTERR  INVALID_SYMBOL   SPEECH  Invalid symbol. N 4 M T T A P R S touch tone gateway
TTERR  INVALID_LOC      SPEECH  Invalid location. N 4 M T T A P R S touch tone gateway
TTERR  NO_CALL          SPEECH  No call or object name. N 4 M T T A P R S touch tone gateway
#TTERR  SATSQ            SPEECH  Satellite square must be 4 digits N 4 M T T A P R S T T gateway
TTERR  SUFFIX_NO_CALL   SPEECH  Send full call before using suffix N 4 M T T A P R S T T gate 
#MAX num of chars foe   S mess  123456789112345678921234567893123456789412345678951234567896123
 
 
TTSTATUS 8 "no emergency testing testing"
TTSTATUS 9 "testing testing"
 
TTCMD /root/direwolf-ttcmd.sh


The dwfestival.sh shell script:

#!/bin/bash
chan=$1
msg=$2
sleep 1
/bin/echo "$msg" | /usr/local/bin/festival --tts
 
The direwolf-ttcmd.sh shell script that generates the text into for the voice responses.
#!/bin/sh
 
response=""
responseEnd=" N 4 M T T A P R S touch tone gateway"
s=" "
 
if [ "$TTCOMMENT" = "VR" ]
then
 
   response="report "
 
   if [ $TTCALLPH ] 
   then 
   response=$response" "$TTCALLPH 
   fi
 
   response=$response" "$TTCALLPH
 
   if [ $TTSSID ]
   then
   response=$response" s s i d "$TTSSID
   fi
 
   if [ $TTSYMBOL ]
   then
   response=$response" symbol "$TTSYMBOL
   fi
 
   if [ $TTLAT ]
   then
   response=$response" latitude "$TTLAT
   fi
 
   if [ $TTLON ]
   then
   response=$response" latitude "$TTLON
   fi
 
   if [ $TTFREQ ]
   then
   response=$response" monitoring "$TTFREQ
   fi
 
   if [ $TTSTATUS ]
   then
   response=$response" status "$TTSTATUS
   fi
 
else
   response="Message Received."
fi
 
responseFinal=$response$responseEnd
echo $responseFinal