<commit_before>#!/bin/bash
#
# Streams opus encoded audio to a client using a TCP connection
#
usage ()
{
    echo "Usage: audio_server.sh <audiodev> <port>"
}

if [ $# -ne 2 ]; then
    usage
    exit 0
fi

# Gets the IP address after lo
host=`ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/'`

echo "Starting audio streaming server at $host:$2"
echo "Audio device: $1"

while true; do
    gst-launch-1.0 -v alsasrc device=$1 ! \
        audio/x-raw, format=\(string\)S16LE, channels=2, rate=48000 ! \
        opusenc bandwidth=1102 bitrate=12000 frame-size=60 complexity=5 ! \
        rtpopuspay ! tcpserversink host=$host port=$2

    echo "Sleeping for 5 seconds..."
    sleep 5
done
<commit_msg>New encoder parameters that might work better (TBC).<commit_after>#!/bin/bash
#
# Streams opus encoded audio to a client using a TCP connection
#
usage ()
{
    echo "Usage: audio_server.sh <audiodev> <port>"
}

if [ $# -ne 2 ]; then
    usage
    exit 0
fi

# Gets the IP address after lo
host=`ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/'`

echo "Starting audio streaming server at $host:$2"
echo "Audio device: $1"

while true; do
    gst-launch-1.0 -v alsasrc device=$1 ! \
        audio/x-raw, format=\(string\)S16LE, channels=2, rate=48000 ! \
        opusenc bandwidth=1102 bitrate=24000 audio=true frame-size=60 complexity=3 ! \
        rtpopuspay ! tcpserversink host=$host port=$2

    echo "Sleeping for 5 seconds..."
    sleep 5
done

{'fraction_non_alphanumeric': 0.13430851063829788, 'fraction_numerical': 0.04521276595744681, 'mean_word_length': 3.002659574468085, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7216213', 'n_tokens_mistral': 579, 'n_tokens_neox': 529, 'n_words': 178}