Last active
May 2, 2024 03:14
-
-
Save rmtbb/bf4cb328a9f5a9f538dea319dcaf58ab to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nohup bash -c 'for i in {0..100}; do voice=$(say -v "?" | awk "{print \$1}" | sort -R | head -1); rate=$((50 + RANDOM % 150)); say -v "$voice" -r $rate $i; done' & |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Number Counting Prank: Announce numbers 0 through 100 at random voices and speech rates.
to use Number Counting Prank via Terminal:
to use Number Counting Prank via curl:
Explanation of the Script
This script is designed to run a sequence in the background of a Unix-like operating system that audibly announces numbers from 0 to 100. Each number is spoken using the
say
command, with randomly selected voices and varying speech rates. Here's a detailed breakdown of each component:nohup
:nohup
stands for "no hang up." It's used to run a command immune to hangups, with output to a non-tty. This ensures the command continues running even if the user logs out or the terminal is closed.bash -c
:-c
option allows passing the entire command sequence as a single string.for i in {0..100}; do ... done
:for
loop that iterates over the numbers from 0 to 100. Each iteration of the loop executes the commands within thedo ... done
block.voice=$(say -v "?" | awk "{print \$1}" | sort -R | head -1);
:say -v "?"
: This command lists all available voices for thesay
command.awk "{print \$1}"
: Usesawk
to print the first column of the output, which corresponds to the voice names.sort -R
: Randomly shuffles the list of voices.head -1
: Selects the first entry from the shuffled list, which will be the random voice chosen for that iteration. The selected voice is stored in the variablevoice
.rate=$((50 + RANDOM % 150));
:RANDOM % 150
produces a random number between 0 and 149, which, when added to 50, results in a speech rate ranging from 50 to 199.say -v "$voice" -r $rate $i;
:say
command with the selected voice ($voice
) and the calculated rate ($rate
) to announce the current number ($i
).&
:Overall Function
This script demonstrates an engaging use of the
say
command, combining it with loops and randomization to create a varied auditory experience. It can serve educational purposes or simply as an entertaining script that showcases Bash scripting capabilities involving text-to-speech functions.The Antidote: Shut Your Computer Up
to use The Antidote via terminal:
to use The Antidote via curl:
More Info on the Antidote