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%