A PowerShell script for converting and organizing audio files to meet WAV Trigger requirements.
The script follows a two-step process to prepare audio files for use with the WAV Trigger board:
-
Initial Processing with FFmpeg
- Source files (MP3, M4A, or WAV) are processed using FFmpeg
- Files are standardized to meet basic WAV Trigger requirements:
- 16-bit PCM format
- 44.1 kHz sample rate
- Stereo output
- Uncompressed PCM encoding
- This creates an intermediate WAV file with consistent properties
-
Audacity Processing and Normalization
- The standardized WAV file is then processed through Audacity
- An automated macro applies:
- Normalization to ensure consistent volume levels
- Any required audio cleanup
- Final format validation
- The result is a playable WAV file fully compatible with the WAV Trigger board
This two-stage workflow ensures that files from any source are properly formatted, normalized, and ready for use, while preserving audio quality throughout the conversion process.
This script has evolved through several iterations to find the optimal workflow for my needs. While the current default process uses FFmpeg and Audacity, the script includes other processing options that can be enabled through configuration variables:
- Direct FFmpeg processing without Audacity
- Sox audio processing capabilities
- VLC media conversion
- Direct WAV metadata manipulation
- Various file organization strategies
The two-stage FFmpeg/Audacity workflow was chosen as the default because it provides:
- Consistent results across different source formats
- Reliable normalization through Audacity's processing
- Preservation of audio quality
- Automated operation through Audacity macros
However, the script remains flexible - other processing paths can be enabled by adjusting variables in the configuration section. This allows the workflow to be customized based on available tools and specific requirements.
- Converts MP3 and M4A files to WAV format
- Creates an Audicty macro to automate as much as possible
- Sanitizes metadata to ensure compatibility
- Handles file organization and naming:
- Removes leading track numbers from source files
- Assigns 3-digit prefixes supporting multiple WAV Trigger file scopes
- Prevents duplicate files with different numerical prefixes
- PowerShell 7 or later
- FFmpeg installed in the path
- Audactity installed in a common location
- Source audio files in MP3, M4A, or WAV format
- Place your source files in the
Source_Files
folder - Run the script:
.\wavmaker.ps1
- Follow the prompts to:
- Remove leading track numbers from source files
- Process and validate audio files
- Select primary or alternate track collection
- Move files to the target folder with appropriate prefixes
The script will:
- Convert or validate files to meet WAV Trigger requirements:
- 16-bit PCM
- 44.1 kHz sample rate
- Stereo output
- Uncompressed PCM encoding
- Organize files in the target folder with 3-digit prefixes
- Preserve valid WAV files without modification
- Convert invalid files to meet requirements
- Valid WAV files are copied without metadata modification
- Invalid WAV files are converted to meet requirements
- Source files are removed after successful processing
- Duplicate files are prevented in the target folder
This tool is part of a larger project to add digital sound to a 1947 Chicago Coin Play Boy pinball machine. The system uses a WAV Trigger board to manage audio playback for various game events, including music, sound effects, and voice announcements. See CONFIGURATION.md for detailed information about the WAV Trigger setup and project vision.
-
Clone this repository or download the script
-
Ensure ffmpeg is installed:
choco install ffmpeg
- Source files: Place in
Source_Files
folder - Converted files: Temporarily stored in
WAVs
folder - Final destination: Files are moved to the configured target folder with proper 3-digit prefixes
- Primary tracks:
101_
to199_
- Alternate tracks:
201_
to299_
- Example:
101_SongName.wav
See requirements.md for detailed WAV Trigger file specifications.
See CHANGELOG.md for version history and updates.