is there a way to tighten up the voice telemetry cadence?
it sounds almost as bad as the Yaesu Fusion machine IDs
the spoken words are fine, but the number reading is painful
de k9wkj
is there a way to tighten up the voice telemetry cadence?
it sounds almost as bad as the Yaesu Fusion machine IDs
the spoken words are fine, but the number reading is painful
de k9wkj
Not any easy way that I know about. It might possible to record new sound files. But wouldn’t promise they wouldn’t get over written by an update. The sound files are in /var/lib/asterisk/sounds.
I speed mine up with this script. You will want to massage the in and out directory variables. I copy the sounds to a working folder, run the script, and copy them back.
You will need to install ffmpeg
#!/bin/bash
# Define the input directory, output directory, intermediate directory, and speed factor
INPUT_DIR="sounds/en"
OUTPUT_DIR="spedup/sounds/en"
INTERMEDIATE_DIR="working"
SPEED_FACTOR="1.2"
# Create the output and intermediate directories if they don't exist
mkdir -p "$OUTPUT_DIR"
mkdir -p "$INTERMEDIATE_DIR"
# Find all .ulaw files recursively in the input directory
find "$INPUT_DIR" -type f -name '*.ulaw' | while read -r INPUT_FILE; do
# Determine the relative path of the input file relative to INPUT_DIR
RELATIVE_PATH="${INPUT_FILE#$INPUT_DIR/}"
# Get the base name of the file (without directory and extension)
BASE_NAME=$(basename "$INPUT_FILE" .ulaw)
# Construct the output directory structure under OUTPUT_DIR
OUTPUT_SUBDIR=$(dirname "$RELATIVE_PATH")
OUTPUT_SUBDIR_PATH="$OUTPUT_DIR/$OUTPUT_SUBDIR"
mkdir -p "$OUTPUT_SUBDIR_PATH"
# Define the intermediate WAV file name
INTERMEDIATE_FILE="$INTERMEDIATE_DIR/${BASE_NAME}_temp.wav"
# Define the final output file name preserving directory structure
OUTPUT_FILE="$OUTPUT_SUBDIR_PATH/${BASE_NAME}.ulaw"
# Convert the u-law file to WAV, change the tempo, and convert back to u-law
if ffmpeg -y -f mulaw -ar 8000 -i "$INPUT_FILE" "$INTERMEDIATE_FILE" && \
ffmpeg -y -i "$INTERMEDIATE_FILE" -filter:a "atempo=$SPEED_FACTOR" -ar 8000 -f mulaw "$OUTPUT_FILE"; then
echo "Processed $INPUT_FILE successfully."
else
echo "Error processing $INPUT_FILE."
fi
# Remove the intermediate file
rm "$INTERMEDIATE_FILE"
done
echo "Processing complete. Output files are in $OUTPUT_DIR."
Similar to the script @N5ZR shared, this is what I use. It uses sox instead of ffmpeg and directly handles the ULAW and GSM files without intermediary conversions. It speeds up the speech a little bit and shortens the gaps between files.
Before:
After:
fasterAsteriskSounds.sh
#!/bin/bash
# Define directories
SOUNDS_DIR="/usr/share/asterisk/sounds"
BACKUP_DIR="/usr/share/asterisk/sounds_backup"
# Define the tempo adjustment (e.g., 1.1 for 10% faster, 0.9 for 10% slower)
TEMPO_ADJUSTMENT=1.1
# Define the amount of silence to leave at the beginning and end of each file (in milliseconds)
SILENCE_THRESHOLD_MS=200 # 200 milliseconds = 0.2 seconds
# Silence threshold percentage (lower values are less aggressive, higher values are more aggressive)
SILENCE_PERCENTAGE=1%
# Enable or disable silence removal (true or false)
REMOVE_SILENCE=true
# Create a backup of the sounds directory
echo "Creating backup of the sounds directory..."
cp "$SOUNDS_DIR" "$BACKUP_DIR"
if [ $? -eq 0 ]; then
echo "Backup created successfully at $BACKUP_DIR."
else
echo "Backup failed. Exiting."
exit 1
fi
# Process .ulaw and .gsm files
echo "Processing .ulaw and .gsm files..."
find "$SOUNDS_DIR" -type f \( -name "*.ulaw" -o -name "*.gsm" \) | while read -r file; do
echo "Processing $file..."
# Generate a temporary filename for the output
temp_file="${file}.tmp"
# Determine the format based on the file extension
if [[ "$file" == *.ulaw ]]; then
input_format="ul"
elif [[ "$file" == *.gsm ]]; then
input_format="gsm"
else
echo "Unsupported file format: $file"
continue
fi
# Convert milliseconds to seconds for sox command
SILENCE_THRESHOLD_SEC=$(echo "$SILENCE_THRESHOLD_MS / 1000" | bc -l)
# Build the sox command based on the REMOVE_SILENCE flag
if [ "$REMOVE_SILENCE" = true ]; then
# Include silence removal with adjusted threshold
sox -t "$input_format" -r 8000 -c 1 "$file" -t "$input_format" "$temp_file" \
silence 1 "$SILENCE_THRESHOLD_SEC" "$SILENCE_PERCENTAGE" reverse \
silence 1 "$SILENCE_THRESHOLD_SEC" "$SILENCE_PERCENTAGE" reverse \
tempo "$TEMPO_ADJUSTMENT"
else
# Skip silence removal
sox -t "$input_format" -r 8000 -c 1 "$file" -t "$input_format" "$temp_file" \
tempo "$TEMPO_ADJUSTMENT"
fi
if [ -f "$temp_file" ]; then
# Replace original file with the processed file
mv "$temp_file" "$file"
echo "Finished processing $file."
else
echo "Failed to process $file."
fi
done
echo "All files processed."
Mason, where in your node did you place this script? Are there any other steps to make it work besides me creating the file, copying the script you have here, and making it executable?
Place it anywhere you like and run it, that’s all ![]()
Thanks!
It worked great on one of my nodes but missed the letter 6 as asterisk said it has zero size. I copied over the original by sudo mv /usr/share/asterisk/sounds_backup/en/digits/6.ulaw /usr/share/asterisk/sounds/en/digits/6.ulaw
Just want to add that I had to include -r after cp to the line cp "$SOUNDS_DIR" "$BACKUP_DIR" as it was giving an error.
I too was missing the number 6! All better now, thanks.
Mason:
Do you have an updated version of this that runs on ASL3 ?
Not sure what you mean. I made this for my ASL3 node
It gives some errors when I try to run it:
I am not a coder but have some basic skills . . .
./fasterAsteriskSounds.sh
-bash: ./fasterAsteriskSounds.sh: cannot execute: required file not found
root@KF0ILP-TX1:~# sh ./fasterAsteriskSounds.sh
: not founderiskSounds.sh: 2:
: not founderiskSounds.sh: 6:
: not founderiskSounds.sh: 9:
: not founderiskSounds.sh: 12:
: not founderiskSounds.sh: 15:
: not founderiskSounds.sh: 18:
Creating backup of the sounds directory...
cp: cannot stat '/usr/share/asterisk/sounds/en'$'\r'' -r': No such file or directory
: not founderiskSounds.sh: 22:
./fasterAsteriskSounds.sh: 42: Syntax error: "elif" unexpected (expecting "then")
I can't really tell what's going on here - it looks like there are some copy/paste formatting problems between your console and what you are trying show us here. You can (and should) encase copy/paste stuff like this in a block of 3 backticks (```). Nobody seems to do that around here and it causes a mess of probems.
This is what it looks like when I properly format code and logs in my community post.
root@node55199:~# \
> echo "The following command will cause an error" \
> && ./error \
> && echo "This command won't run due to the previous error"
The following command will cause an error
-bash: ./error: No such file or directory
root@node55199:~#
Anyways, the fact that you show this:
./fasterAsteriskSounds.sh
-bash: ./fasterAsteriskSounds.sh: cannot execute: required file not found
is a problem. Most likely, you have saved this script on your system by pasting/editing it in some piece of software or other computer that uses CRLF line endings.
You can try this to fix CRLF line endings:
sed -i 's/\r$//' fasterAsteriskSounds.sh
Per last - I found the issue:
Needed to ADD a -r to the cp command in the script.
cp -r "$SOUNDS_DIR" "$BACKUP_DIR"
Now working 100%
Thx for this. ASL3 here, but I get errors on every line. I had to add the -r as another person mentioned here. Not sure what I am missing.
"Processing /usr/share/asterisk/sounds/en/vm-toreply.ulaw...
./fasterAsteriskSounds.sh: line 87: bc: command not found
./fasterAsteriskSounds.sh: line 98: silence: command not found
./fasterAsteriskSounds.sh: line 100: silence: command not found
./fasterAsteriskSounds.sh: line 102: tempo: command not found
Finished processing /usr/share/asterisk/sounds/en/vm-toreply.ulaw."
You are missing tools, apt install bc ...
#!/bin/bash
# Build sped-up Asterisk prompt overrides under /usr/local/share so package
# upgrades of /usr/share/asterisk/sounds/en are never overwritten.
#
# Requires: sox, root (or write access to DEST_DIR)
# Asterisk: sounds_search_custom_dir = yes (ASL3 default)
# → plays DEST_DIR/<path> before sounds/en/<path>
set -euo pipefail
# Stock language tree (package-owned; read-only source)
SOURCE_DIR="${SOURCE_DIR:-/usr/share/asterisk/sounds/en}"
# Custom overrides (survives apt). On ASL3 this is what
# /usr/share/asterisk/sounds/custom points at.
DEST_DIR="${DEST_DIR:-/usr/local/share/asterisk/sounds}"
TEMPO_ADJUSTMENT="${TEMPO_ADJUSTMENT:-1.1}"
# Minimum run of quiet audio (seconds) before sox trims leading/trailing silence
SILENCE_DURATION_SEC="${SILENCE_DURATION_SEC:-0.2}"
SILENCE_PERCENTAGE="${SILENCE_PERCENTAGE:-1%}"
REMOVE_SILENCE="${REMOVE_SILENCE:-true}"
DRY_RUN="${DRY_RUN:-false}"
OWNER="${OWNER:-asterisk:asterisk}"
usage() {
cat <<EOF
Usage: sudo $0 [--dry-run] [--tempo N] [--no-silence]
Reads .ulaw/.gsm from SOURCE_DIR and writes processed copies into DEST_DIR,
preserving relative paths (e.g. digits/1.ulaw). Stock package files are left alone.
Environment overrides: SOURCE_DIR DEST_DIR TEMPO_ADJUSTMENT REMOVE_SILENCE
EOF
}
while [[ $# -gt 0 ]]; do
case "$1" in
-h|--help) usage; exit 0 ;;
--dry-run) DRY_RUN=true; shift ;;
--tempo) TEMPO_ADJUSTMENT="$2"; shift 2 ;;
--no-silence) REMOVE_SILENCE=false; shift ;;
*) echo "Unknown option: $1" >&2; usage; exit 1 ;;
esac
done
if [[ "$(id -u)" -ne 0 && "$DRY_RUN" != true ]]; then
echo "Must run as root to write to $DEST_DIR (or use --dry-run)." >&2
exit 1
fi
if ! command -v sox >/dev/null 2>&1; then
echo "sox is required but not installed." >&2
exit 1
fi
if [[ ! -d "$SOURCE_DIR" ]]; then
echo "Source directory not found: $SOURCE_DIR" >&2
exit 1
fi
mkdir -p "$DEST_DIR"
ok=0
fail=0
skip=0
echo "Source: $SOURCE_DIR"
echo "Dest: $DEST_DIR"
echo "Tempo: $TEMPO_ADJUSTMENT"
echo "Silence: $REMOVE_SILENCE (duration=${SILENCE_DURATION_SEC}s, thresh=${SILENCE_PERCENTAGE})"
echo "Dry-run: $DRY_RUN"
echo
while IFS= read -r -d '' file; do
rel="${file#"$SOURCE_DIR"/}"
dest="$DEST_DIR/$rel"
dest_dir=$(dirname "$dest")
ext="${file##*.}"
case "$ext" in
ulaw) fmt=ul ;;
gsm) fmt=gsm ;;
*) echo "Skip unsupported: $rel"; skip=$((skip + 1)); continue ;;
esac
echo "Processing $rel ..."
if [[ "$DRY_RUN" == true ]]; then
ok=$((ok + 1))
continue
fi
mkdir -p "$dest_dir"
temp_file="${dest}.tmp.$$"
sox_args=( -t "$fmt" -r 8000 -c 1 "$file" -t "$fmt" "$temp_file" )
if [[ "$REMOVE_SILENCE" == true ]]; then
sox_args+=(
silence 1 "$SILENCE_DURATION_SEC" "$SILENCE_PERCENTAGE" reverse
silence 1 "$SILENCE_DURATION_SEC" "$SILENCE_PERCENTAGE" reverse
)
fi
sox_args+=( tempo "$TEMPO_ADJUSTMENT" )
if sox "${sox_args[@]}" 2>/tmp/faster-sounds-sox.err; then
mv -f "$temp_file" "$dest"
chown "$OWNER" "$dest" 2>/dev/null || true
chmod 644 "$dest"
ok=$((ok + 1))
else
echo " FAILED: $rel ($(tr '\n' ' ' </tmp/faster-sounds-sox.err))" >&2
rm -f "$temp_file"
fail=$((fail + 1))
fi
done < <(find "$SOURCE_DIR" -type f \( -name '*.ulaw' -o -name '*.gsm' \) -print0)
echo
echo "Done. ok=$ok fail=$fail skip=$skip"
if [[ "$DRY_RUN" != true ]]; then
echo "Asterisk will prefer these over $SOURCE_DIR when sounds_search_custom_dir=yes."
fi
[[ "$fail" -eq 0 ]]
This is a cleaned up version of Mason's script, it uses the custom sound dir path instead of overwritting the system package, prevents it from breaking if an update is pushed.
Thx for the assist. I did not see the requirement of apt install bc and did that as well. It worked aside from the letter 6- which is 7047 in size and plays fine from default dir when I set the sounds dir back to "no" - sounds_search_custom_dir=no. The files process ok w no errors "Done. ok=631 fail=0 skip=0". There is something going on with that 6.ulaw processing. Not sure how I will resolve it but I'll figure it out I'm sure. (I copied the 6.ulaw file from another node using WinSCP and still made the 6 zero bytes. What the heck?)
Okay there are actually a total of 16 files that end up as zero bytes ...
digits/6, digits/h-6, letters/x, spy-sip, both 2tones, and all of silence/*
sox silence-trim was too aggressive. For some short prompts — especially digits/6.ulaw — it treated the whole clip as silence and wrote a 0-byte file. That empty override still shadowed stock audio via sounds_search_custom_dir, so “6” played nothing as you experienced.
#!/bin/bash
# Build sped-up Asterisk prompt overrides under /usr/local/share so package
# upgrades of /usr/share/asterisk/sounds/en are never overwritten.
#
# Requires: sox, root (or write access to DEST_DIR)
# Asterisk: sounds_search_custom_dir = yes (ASL3 default)
# → plays DEST_DIR/<path> before sounds/en/<path>
set -euo pipefail
# Stock language tree (package-owned; read-only source)
SOURCE_DIR="${SOURCE_DIR:-/usr/share/asterisk/sounds/en}"
# Custom overrides (survives apt). On ASL3 this is what
# /usr/share/asterisk/sounds/custom points at.
DEST_DIR="${DEST_DIR:-/usr/local/share/asterisk/sounds}"
TEMPO_ADJUSTMENT="${TEMPO_ADJUSTMENT:-1.1}"
# Minimum run of quiet audio (seconds) before sox trims leading/trailing silence.
# Note: 1% / 0.2s is aggressive and can wipe some short prompts (e.g. digits/6);
# empty outputs fall back to tempo-only.
SILENCE_DURATION_SEC="${SILENCE_DURATION_SEC:-0.2}"
SILENCE_PERCENTAGE="${SILENCE_PERCENTAGE:-1%}"
REMOVE_SILENCE="${REMOVE_SILENCE:-true}"
DRY_RUN="${DRY_RUN:-false}"
OWNER="${OWNER:-asterisk:asterisk}"
usage() {
cat <<EOF
Usage: sudo $0 [--dry-run] [--tempo N] [--no-silence]
Reads .ulaw/.gsm from SOURCE_DIR and writes processed copies into DEST_DIR,
preserving relative paths (e.g. digits/1.ulaw). Stock package files are left alone.
Environment overrides: SOURCE_DIR DEST_DIR TEMPO_ADJUSTMENT REMOVE_SILENCE
EOF
}
run_sox() {
# run_sox <fmt> <src> <dest> [extra sox effects...]
local fmt=$1 src=$2 out=$3
shift 3
sox -t "$fmt" -r 8000 -c 1 "$src" -t "$fmt" "$out" "$@" 2>"$sox_err"
}
while [[ $# -gt 0 ]]; do
case "$1" in
-h|--help) usage; exit 0 ;;
--dry-run) DRY_RUN=true; shift ;;
--tempo) TEMPO_ADJUSTMENT="$2"; shift 2 ;;
--no-silence) REMOVE_SILENCE=false; shift ;;
*) echo "Unknown option: $1" >&2; usage; exit 1 ;;
esac
done
if [[ "$(id -u)" -ne 0 && "$DRY_RUN" != true ]]; then
echo "Must run as root to write to $DEST_DIR (or use --dry-run)." >&2
exit 1
fi
if ! command -v sox >/dev/null 2>&1; then
echo "sox is required but not installed." >&2
exit 1
fi
if [[ ! -d "$SOURCE_DIR" ]]; then
echo "Source directory not found: $SOURCE_DIR" >&2
exit 1
fi
mkdir -p "$DEST_DIR"
ok=0
fail=0
skip=0
fallback=0
sox_err=$(mktemp /tmp/faster-sounds-sox.XXXXXX)
trap 'rm -f "$sox_err" ${temp_file:-}' EXIT
echo "Source: $SOURCE_DIR"
echo "Dest: $DEST_DIR"
echo "Tempo: $TEMPO_ADJUSTMENT"
echo "Silence: $REMOVE_SILENCE (duration=${SILENCE_DURATION_SEC}s, thresh=${SILENCE_PERCENTAGE})"
echo "Dry-run: $DRY_RUN"
echo
while IFS= read -r -d '' file; do
rel="${file#"$SOURCE_DIR"/}"
dest="$DEST_DIR/$rel"
dest_dir=$(dirname "$dest")
ext="${file##*.}"
case "$ext" in
ulaw) fmt=ul ;;
gsm) fmt=gsm ;;
*) echo "Skip unsupported: $rel"; skip=$((skip + 1)); continue ;;
esac
echo "Processing $rel ..."
if [[ "$DRY_RUN" == true ]]; then
ok=$((ok + 1))
continue
fi
mkdir -p "$dest_dir"
temp_file=$(mktemp /tmp/faster-sounds-out.XXXXXX)
# silence/* is near-zero amplitude; silence-trim always destroys it.
# Short tones/digits can also be wiped by aggressive trim — fall back.
use_silence=false
if [[ "$REMOVE_SILENCE" == true && "$rel" != silence/* ]]; then
use_silence=true
fi
processed=false
if [[ "$use_silence" == true ]]; then
if run_sox "$fmt" "$file" "$temp_file" \
silence 1 "$SILENCE_DURATION_SEC" "$SILENCE_PERCENTAGE" reverse \
silence 1 "$SILENCE_DURATION_SEC" "$SILENCE_PERCENTAGE" reverse \
tempo "$TEMPO_ADJUSTMENT" \
&& [[ -s "$temp_file" ]]; then
processed=true
else
echo " silence-trim emptied/failed; retrying tempo-only"
: >"$temp_file"
fallback=$((fallback + 1))
fi
fi
if [[ "$processed" != true ]]; then
if run_sox "$fmt" "$file" "$temp_file" tempo "$TEMPO_ADJUSTMENT" \
&& [[ -s "$temp_file" ]]; then
processed=true
fi
fi
if [[ "$processed" == true && -s "$temp_file" ]]; then
cp -f "$temp_file" "$dest"
chown "$OWNER" "$dest" 2>/dev/null || true
chmod 644 "$dest"
ok=$((ok + 1))
else
echo " FAILED: $rel ($(tr '\n' ' ' <"$sox_err"))" >&2
# Never leave a zero-byte override that shadows stock audio
if [[ -f "$dest" && ! -s "$dest" ]]; then
rm -f "$dest"
echo " removed empty override $rel"
fi
fail=$((fail + 1))
fi
rm -f "$temp_file"
done < <(find "$SOURCE_DIR" -type f \( -name '*.ulaw' -o -name '*.gsm' \) -print0)
echo
echo "Done. ok=$ok fail=$fail skip=$skip tempo_only_fallback=$fallback"
if [[ "$DRY_RUN" != true ]]; then
echo "Asterisk will prefer these over $SOURCE_DIR when sounds_search_custom_dir=yes."
fi
[[ "$fail" -eq 0 ]]
Here is the update which ensure we do not end up with zero byte files.
Wow you improved the script and fixed that issue! Thx!
I do get a new error on first run (in bold):
root@ASL48654:/home/kk6qms# ./fasterAllstarTelemetry.sh
Source: /usr/share/asterisk/sounds/en
Dest: /usr/local/share/asterisk/sounds
Tempo: 1.1
Silence: true (duration=0.2s, thresh=1%)
Dry-run: false
./fasterAllstarTelemetry.sh: line 224: syntax error near unexpected token `&&'
I counted up from the bottom of nano and guess it would be in this vacinity:
if [[ "$REMOVE_SILENCE" == true && "$rel" != silence/* ]]; then
use_silence=true
fi
processed=false
if [[ "$use_silence" == true ]]; then
if run_sox "$fmt" "$file" "$temp_file" \
silence 1 "$SILENCE_DURATION_SEC" "$SILENCE_PERCENTAGE" reverse \
silence 1 "$SILENCE_DURATION_SEC" "$SILENCE_PERCENTAGE" reverse \
tempo "$TEMPO_ADJUSTMENT" \
&& [[ -s "$temp_file" ]]; then
processed=true
You have a different issue, the file is only 164 lines ....
Got it working!
Started from scratch, pasted into text editor first this time, pasted in the script- and I get the same error. Seems when it gets pasted into the terminal inside of ASL3 cockpit it gets spaces added. I just used WinSCP and used an SCP connection and the built in file editor and pasted in perfect- and worked perfect! There are 6 messages about those 6 files but they all play fine in their faster/trimmed versions. Thanks!
Processing letters/x.ulaw ...
silence-trim emptied/failed; retrying tempo-only
Processing ascending-2tone.ulaw ...
silence-trim emptied/failed; retrying tempo-only
Processing spy-sip.ulaw ...
silence-trim emptied/failed; retrying tempo-only
Processing descending-2tone.ulaw ...
silence-trim emptied/failed; retrying tempo-only
Processing digits/6.ulaw ...
silence-trim emptied/failed; retrying tempo-only
Processing digits/h-6.ulaw ...
silence-trim emptied/failed; retrying tempo-only