Advertisement
metalx1000

Speak IP Address with My Voice

Jun 9th, 2025 (edited)
1,073
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.82 KB | None | 0 0
  1. #record digits vocals
  2. for i in {0..9}
  3. do
  4.   echo $i
  5.   rec ${i}.wav silence 1 0.1 3% 1 0.5 3%
  6.   sleep .2
  7. done
  8.  
  9. #record dot vocals
  10. rec dot.wav silence 1 0.1 3% 1 0.5 3%
  11.  
  12. # play ip address audio
  13. ip="$(hostname -I|awk '{print $1}')"
  14. for ((i=0; i<${#ip}; i++)); do
  15.   char="${ip:i:1}"
  16.   [[ "$char" == "." ]] && char="dot"
  17.   mpv ${char}.wav
  18. done
  19.  
  20. # wav output for streaming to Thingino
  21. echo "Content-type: audio/x-wav"
  22. echo ""
  23. # get q variable
  24. eval $(echo "$QUERY_STRING" | awk -F'&' '{for(i=1;i<=NF;i++){print $i}}')
  25.  
  26. #get IP address and strip all non number and 'dot' chars
  27. ip=$(busybox httpd -d $q | sed 's/[^0-9.]//g')
  28.  
  29. input_wavs=""
  30. for ((i = 0; i < ${#ip}; i++)); do
  31.   char="${ip:i:1}"
  32.   [[ "$char" == "." ]] && char="dot"
  33.   input_wavs+="${char}.wav "
  34. done
  35. sox $input_wavs -t wav - channels 1 rate 16000
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement