This file is indexed.

/usr/share/svxlink/events.d/CW.tcl is in svxlink-server 17.12.1-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
###############################################################################
#
# This code is used to send morse code messages.
#
# This file is sourced by the main event handler file so no manual inclusion
# is necessary. Use functions CW::setWpm or CW::setCpm to set the CW speed.
# Use functions CW::setPitch to set the pitch and CW::setAmplitude to set the
# amplitude. Then use CW::play to play some text. See documentation for each
# function below.
#
###############################################################################

namespace eval CW {

# Timing variables
variable short_len;
variable long_len;
variable char_spacing;
variable letter_spacing;
variable word_spacing;

# The pitch of the CW audio
variable fq;

# The amplitude of the CW audio
variable amplitude;

# Morse code table
array set letters {
  "A" ".-"
  "B" "-..."
  "C" "-.-."
  "D" "-.."
  "E" "."
  "F" "..-."
  "G" "--."
  "H" "...."
  "I" ".."
  "J" ".---"
  "K" "-.-"
  "L" ".-.."
  "M" "--"
  "N" "-."  
  "O" "---"
  "P" ".--."
  "Q" "--.-"
  "R" ".-."
  "S" "..."
  "T" "-"
  "U" "..-"
  "V" "...-"
  "W" ".--"
  "X" "-..-"
  "Y" "-.--"
  "Z" "--.."
  
  "0" "-----"
  "1" ".----"
  "2" "..---"
  "3" "...--"
  "4" "....-"
  "5" "....."
  "6" "-...."
  "7" "--..."
  "8" "---.."
  "9" "----."
  
  "." ".-.-.-"
  "," "--..--"
  "?" "..--.."
  "/" "-..-."
  "=" "-...-"

  " " " "
}


# Private function
proc calculateTimings {} {
  variable short_len;
  variable long_len [expr $short_len * 3];
  variable char_spacing $short_len;
  variable letter_spacing [expr $short_len * 3];
  variable word_spacing [expr $short_len * 7];
}


#
# Set the CW speed in words per minute
#
proc setWpm {wpm} {
  variable short_len [expr 60000 / (50 * $wpm)];
  calculateTimings;
}


#
# Set the CW speed in characters per minute
#
proc setCpm {cpm} {
  variable short_len [expr 60000 / (10 * $cpm)];
  calculateTimings;
}


#
# Set the pitch (frequency), in Hz, of the CW audio.
#
proc setPitch {new_fq} {
  variable fq $new_fq;
}


#
# Set the amplitude in per mille (0-1000) of full amplitude.
#
proc setAmplitude {new_amplitude} {
  variable amplitude $new_amplitude;
}


#
# Play the given CW text
#
proc play {txt} {
  variable short_len;
  variable long_len;
  variable char_spacing;
  variable letter_spacing;
  variable word_spacing;
  variable fq;
  variable amplitude;
  variable letters;
  
  set txt [string toupper $txt];
  set first_letter 1;
  foreach letter [split $txt ""] {
    if {!$first_letter} {
      playSilence $letter_spacing;
    }
    set first_letter 0;
    set first_char 1;
    foreach char [split $letters($letter) ""] {
      if {!$first_char} {
      	playSilence $char_spacing;
      }
      set first_char 0;
      if {$char == "."} {
      	playTone $fq $amplitude $short_len;
      } elseif {$char == "-"} {
      	playTone $fq $amplitude $long_len;  
      } elseif {$char == " "} {
      	playSilence $word_spacing;
      }
    }
  }
}


# Set defaults
setPitch 800;
setAmplitude 500;
setCpm 100;

}