Speech to text failover system (with proof of concept script)

wyoming is a process intense system and my language Dutch does not work properly with a small model. I dont have a 24/7 system that responds within 2 seconds.

Could a failover system voor speech detection be created. Where a list of services is selected with a priority and the best online is selected.

This can be used for 2 scenarios.

  1. local failover for nabucasa cloud system. So that you dont go back to the stoneage when the inet is down.
  2. local none 24/7 preferred system. You got a nice laptop or a gamer pc that might be on but isnt a 24/7 system so you need a fail over.

The great thing of this because the lower priority are probably using a smaller model. That could give translation errors.
Because you have a higher resolution result. the failover system can learn from consisted translation errors by adding those to some translation table to the right text.

This way the whole Voice experience will improve. Because the user will have the fastest speech to text available and when the lower system is used this is backed with translation of your most used speech commands.

Here a proof of concept for just changing the IP address using duckdns.
Make sure all wyoming services use the same Port.



# List of potential ip's resolved. 1st one that pings is used.

# Convert the IP string into an array
IFS=' ' read -r -a IP_ARRAY <<< "$IP_STRING"

# Initialize a variable to store the previous IP address

while true; do

    # Initialize a variable to check if the IP has changed

    # Iterate over each IP address in the array
    for IP_ADDRESS in "${IP_ARRAY[@]}"; do
        # Ping the IP address with only one ICMP packet and suppress output
        if ping -c 1 -W 1 "$IP_ADDRESS" &> /dev/null; then
            # If ping is successful, assign the IP address to the $IP variable
            # Check if the IP has changed
            if [ "$IP" != "$PREVIOUS_IP" ]; then
                PREVIOUS_IP="$IP"  # Update the previous IP
            # Exit the loop after finding the first IP address

    # If the IP has changed, execute the curl command
    if [ "$IP_CHANGED" = true ]; then
        echo "Found IP: $IP"
        echo "Executing curl command with new IP: $IP"
        if curl_output=$(curl -s -k "https://www.duckdns.org/update?domains=$DOMAIN&token=$TOKEN&ip=$IP"); then
          echo "Curl command successful."
          echo "Curl command failed. Waiting 30 seconds before retrying"
          sleep 25

    # If no IP address is found, print a message
    if [ -z "$IP" ]; then
        echo "No IP address found in the list."
        echo "$IP is active."

    sleep 5