GENERAL INFORMATION ON RUNNING MPG123 IN A WINDOWS ENVIRONMENT

(Caution- This is a brief guide, based on my experience running MPG123 under Windows. This is NOT a sanctioned document from the MPG123 team. It has not been reviewed by MPG123 for accuracy or completeness. Use this information at your own risk. DON'T submit tickets to MPG123 based on anything you read in this document, and there is NO guarantee as to the validity of information contained herein. -- J. Amick - 2021-02-13 )

A portable (no installation required) MPG123.EXE can be downloaded from “Win32 and Win64 binaries” at WWW.MPG123.DE. The file you want is mpg123-v-static-x86-bb.zip, where v (version) is currently “1.26.4” and bb (your system architecture) is either “32” or “64” bit.. Extract the entire downloaded zip. Consider creating a new target directory named MPG123 in “Program Files”. Make sure the target directory is included in your PATH system environment variable- add if necessary.

Command Line usage: mpg123 [ options ] file ... | URL ... | -

file …

Windows full path file name(s), surrounded by double quotes. The * wildcard is OK. For example: “F:\Music\*.mp3”. Surrounding double quotes allow file/folder names containing blanks.

Option [-a dev]

Specify the audio device to use. If not present on the command line, MPG123 will use the Windows default audio device- sharing the same audio channel with normal Windows sounds. If you want MPG123 to play through a separate/dedicated audio channel, you have to provide another audio device (sound card, USB sound device, etc). To see what sound devices are installed and available in your Windows system, access and run the “Device Manager” (devmgmt.msc). Click to expand “Sound, video and game controllers”. Identify the desired sound device and double-click or right click to “Properties”. Select the “Details” tab, and look for Property “Device instance path” (Win 10) or “Device instance id” (Win XP). The “Value” box will contain one or more lines- the first line is the one you want- and looks something like this: USB\VID_0D8C&PID_0014&MI_00\6&175BA917&0&0000. If you type this line on the command line, surround it with double quotes. Consider saving this (including the surrounding double quotes) as a System environment variable, to eliminate a lot of future typing if debugging a BAT file: System Properties > Environment Variables > System Variables.

If you have multiple sound devices in your computer, confirm the Windows Default Sound Device is set to the one you want for any audio other than that generated by MPG123.

CASE STUDY- SOUND SOURCE FOR TELEPHONE SYSTEM MUSIC ON HOLD

I needed a music source to implement “Music on Hold” in our office phone system. In the past, personal CD/MP3 players have sufficed, but none would last more than a year playing continuously. All the inexpensive I-Pod type MP3 players I found couldn’t play and charge at the same time. The solution came in the form of MPG123 playing a folder of MP3 files on an old XP computer running unattended in the phone closet, still doing batch file document backups. A channel of MOH audio exclusively for the phone system was added in the form of a Sabrent USB-SBCV plug-in audio generator device capable of continuous play for less than $10 (Amazon). This device requires NO external drivers- truly plug and play.

This application required MPG123 to play a continuous loop of every MP3 file found in a folder named “Music On Hold”. MPG123 has the -Z option which does this directly, but files are played in random order. I preferred to have the files looped in alphabetical order, which MPG123 will not directly do. A short batch file (created in the same directory as MPG123.EXE) takes care of this problem. As a template, copy and paste the following lines into Notepad, and save as a BAT file:

@echo off

rem Start up an infinite loop

for /L %%n in () do (

rem Play mp3 files in alphabetical order from specified directory

for %%f in ("G:\music on hold\*.mp3") do (

mpg123 -m -a %Sabrent% ^"%%f^" ))

This batch file presumes a Sabrent system environment variable set from the sound device property details as described earlier. Substitute the correct location of your MP3 files. Remove the -m option if you want stereo.

This batch file can be initiated directly from a scheduled task created to launch when windows starts (or other trigger). Each version of Windows has its own idiosyncrasies starting a batch file from a scheduled task, and I recommend a Google search if you have difficulties. Ditto for having the batch file run in a minimized CMD window, or no window at all. Consider flushing all console output (stdout and stderr) when you invoke the batch file from a scheduled task. For this batch file saved as PLAYEM.BAT- enter “PLAYEM > nul 2>&1” on the command line.