- Create play.sh script to play an alarm sound with increasing volume using the mpv player. - The script iterates through different volume levels (20 to 100 in increments of 10). - Utilize pkill to terminate any previous mpv processes before starting a new one. - Incorporate comments for script header, loop, and process handling. - Add wait command to ensure the completion of each mpv process before starting the next one. - Created: 06.02.2024 - Description: Script to play an alarm sound with increasing volume.
28 lines
886 B
Bash
28 lines
886 B
Bash
#!/data/data/com.termux/files/usr/bin/zsh
|
|
#
|
|
# Alarm Volume Increase Script
|
|
#
|
|
# This script plays an alarm sound with increasing volume using the mpv player.
|
|
# It iterates through different volume levels, starting from 20 and increasing by 10 until reaching 100.
|
|
|
|
# Header information
|
|
# Created: 06.02.2024
|
|
# Description: Script to play an alarm sound with increasing volume.
|
|
|
|
# Loop to play the alarm sound with increasing volume
|
|
for ((volume = 20; volume <= 100; volume += 10)); do
|
|
echo "Current volume: $volume"
|
|
|
|
# Terminate any previous mpv processes
|
|
/system/bin/pkill mpv
|
|
|
|
# Start the new mpv process with the specified volume
|
|
/data/data/com.termux/files/usr/bin/mpv --replaygain=track --volume="$volume" /data/scripts/your-new-morning-alarm.ogg &
|
|
|
|
# Wait for the completion of the current mpv process before starting the next one
|
|
wait
|
|
done
|
|
|
|
# End of the script
|
|
|