Improve morning-alarm.sh script

Enhancements:
- Adjusted the way the alarm sound is played by introducing a loop to increase volume gradually.
- Utilized a loop to iterate over volume levels from 10 to 100 with increments of 10.
- Replaced the previous mpv command with a loop to control the volume for a smoother alarm experience.

Code Clarity:
- Added comments to clarify the purpose of the loop and volume adjustment.

Note: This modification provides a more gradual increase in volume for the morning alarm, enhancing the user experience.
This commit is contained in:
Ratatoskr 2024-01-30 23:18:20 +01:00
parent 89fd2f2f8c
commit 1bb6546100
Signed by: Ratatoskr
GPG Key ID: 28B77439A6D78F4E

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/data/data/com.termux/files/usr/bin/zsh
# #
# Alarm Control Script # Alarm Control Script
# #
@ -41,13 +41,15 @@ check_notification() {
# Turn off Bluetooth # Turn off Bluetooth
turn_off_bluetooth turn_off_bluetooth
## Play alarm sound
for ((volume = 10; volume <= 100; volume += 10)); do
/data/data/com.termux/files/usr/bin/mpv --replaygain=track --volume="$volume" /data/scripts/your-new-morning-alarm.ogg &
done
# Increase volume and check notification # Increase volume and check notification
while true; do while true; do
increase_volume increase_volume
check_notification check_notification
done &
## Play alarm sound
for ((volume = 20; volume <= 100; volume += 10)); do
echo "Actual volume: $volume"
/data/data/com.termux/files/usr/bin/mpv --replaygain=track --volume="$volume" /data/scripts/your-new-morning-alarm.ogg
done done