| name | floyd |
| description | Play an audio file (.mp3, .wav, or .flac) using the floyd command line player. Use when the user wants to play, listen to, or preview an audio file. |
| argument-hint | <file> | stop |
| allowed-tools | Bash(floyd *), Bash(kill *), Bash(echo *), Bash(cat *), Bash(rm *), Bash(curl *), Bash(chmod *), Bash(uname *), Bash(which *) |
Play or stop audio using the floyd command line player.
Supported formats: .mp3, .wav, .flac
The PID of any running floyd process is stored in /tmp/floyd.pid.
Steps
Step 1 โ Ensure floyd is installed
Check if floyd is on the PATH:
which floyd
If not found, detect the OS and download the appropriate binary from the latest release:
OS=$(uname -s)
if [ "$OS" = "Darwin" ]; then
curl -L https://github.com/robrohan/floyd/releases/tag/v1.0.0/floyd-mac -o /usr/local/bin/floyd
else
curl -L https://github.com/robrohan/floyd/releases/tag/v1.0.0/floyd -o /usr/local/bin/floyd
fi
chmod +x /usr/local/bin/floyd
If /usr/local/bin is not writable, try ~/.local/bin instead (create it if needed) and inform the user they may need to add it to their PATH.
If the user wants to stop playback (argument is "stop" or user says stop/pause):
- Check if
/tmp/floyd.pid exists. If not, tell the user nothing is playing.
- Stop the process and clean up:
kill $(cat /tmp/floyd.pid) && rm /tmp/floyd.pid
- Tell the user playback has stopped.
If the user wants to start playback (argument is a file or directory path):
- If
$ARGUMENTS is empty, ask the user which file or directory they want to play.
- If
/tmp/floyd.pid exists, stop any currently playing audio first:
kill $(cat /tmp/floyd.pid) 2>/dev/null; rm -f /tmp/floyd.pid
-
floyd only accepts a single file at a time โ never pass a directory path to floyd directly.
- If the argument is a single file, play it directly:
(floyd -d "$ARGUMENTS") &
echo $! > /tmp/floyd.pid
- If the argument is a directory, find all supported files recursively and play them one by one in a loop:
(find "$ARGUMENTS" -type f \( -iname "*.mp3" -o -iname "*.wav" -o -iname "*.flac" \) | sort | while read f; do floyd -d "$f"; done) &
echo $! > /tmp/floyd.pid
-
Tell the user what is playing and that they can stop it with /floyd stop.