Last active
December 21, 2025 20:44
-
-
Save scottjenson/649cdb84fece20a80bbf0841386203f2 to your computer and use it in GitHub Desktop.
fsb Audio Extractor
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
| #!/bin/bash | |
| # Usage: ./extract_fsb.sh <filename.fsb> | |
| # 1. Check if a filename was provided | |
| if [ -z "$1" ]; then | |
| echo "Error: No file provided." | |
| echo "Usage: ./extract_fsb.sh <filename>" | |
| exit 1 | |
| fi | |
| BANK_FILE="$1" | |
| # 2. Check if file exists | |
| if [ ! -f "$BANK_FILE" ]; then | |
| echo "Error: File '$BANK_FILE' not found!" | |
| exit 1 | |
| fi | |
| # 3. Get total count | |
| count=$(vgmstream-cli -m "$BANK_FILE" | grep "stream count" | awk '{print $3}') | |
| if [ -z "$count" ]; then | |
| echo "Error: Could not read stream count. Is this a valid bank file?" | |
| exit 1 | |
| fi | |
| echo "Starting silent extraction of $count files from $BANK_FILE..." | |
| echo "Printing one dot '.' for every 50 files processed:" | |
| # 4. Loop through every file | |
| for ((i=1; i<=count; i++)); do | |
| # Get the name (silently) | |
| track_name=$(vgmstream-cli -m -s $i "$BANK_FILE" | grep "stream name:" | sed 's/.*stream name: //') | |
| # Fallback if name is empty | |
| if [ -z "$track_name" ]; then | |
| track_name="${BANK_FILE%.*}_$i" | |
| fi | |
| # Extract the file (silently redirecting output to the void) | |
| vgmstream-cli -s $i -o "${track_name}.wav" "$BANK_FILE" > /dev/null 2>&1 | |
| # Print a dot every 50 files | |
| if (( i % 50 == 0 )); then | |
| printf "." | |
| fi | |
| done | |
| echo "" | |
| echo "Done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment