-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaudio-tools
executable file
·64 lines (57 loc) · 1.82 KB
/
audio-tools
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
commands=("Frequency Detector" "Frequency Generator" "Sample Rate Detector" "Quit")
selected=0
# Function to display the list and highlight the selected item
display_list() {
clear
echo -e "\033[1m Audio Tools\033[0m\n ---------------------"
for i in "${!commands[@]}"; do
if [ $i -eq $selected ]; then
if [ "${commands[$i]}" == "Quit" ]; then
echo -e "\033[1m➤ ${commands[$i]}\033[0m\n"
else
echo -e "\033[1m➤ ${commands[$i]}\033[0m\n"
fi
else
echo -e " ${commands[$i]}\n"
fi
done
}
# Function to execute the selected command
execute_command() {
case ${commands[$selected]} in
"Frequency Detector")
# Add your command logic here
python3 Audio-Tools/tools/frequency-detector.py
read -p "Press Enter to return to the menu..."
;;
"Frequency Generator")
# Add your command logic here
python3 Audio-Tools/tools/frequency-generator.py
read -p "Press Enter to return to the menu..."
;;
"Sample Rate Detector")
# Add your command logic here
python3 Audio-Tools/tools/sample-rate-detector.py
read -p "Press Enter to return to the menu..."
;;
"Quit")
echo -e "\n\033[1mExiting script\033[0m"
exit 0
;;
*)
echo -e "\nInvalid selection"
;;
esac
}
# Main loop
while true; do
display_list
read -sn 1 key
case $key in
"A") ((selected--)); [ $selected -lt 0 ] && selected=$(( ${#commands[@]} - 1 ));;
"B") ((selected++)); [ $selected -ge ${#commands[@]} ] && selected=0 ;;
"") execute_command ;;
*) ;;
esac
done