A Command-Line MP3 player for Windows (Updates - 26 Jan 2024)
In 2009, I was tinkering with the Windows multimedia subsystem and I wrote a short program to play MP3 audio files from the command-line ( cmdmp3.exe ). I created a second program that was a GUI application ( cmdmp3win.exe ) for those who didn’t want the console window to show. Althought it’s technically a GUI application, no visible user interface is present unless an error occurs.
I have released a new version of the sources and executable programs tonight ( 26 Jan 2024 ).
The sources and executable files for these programs can be found at:
https://jiml.us/downloads/cmdmp3.zip
The Github repo for the sources is here:
https://github.com/jimlawless/cmdmp3
To compile the sources, you can use these commands:
gcc cmdmp3.c -lwinmm -o cmdmp3.exe
gcc cmdmp3win.c -lwinmm -mwindows -o cmdmp3win.exe
To play an MP3 file with either, enter:
cmdmp3 filename
or
cmdmp3 url
…or…
cmdmp3win filename
or
cmdmp3win url
16 Jan 2024 - URL Support
The older version of cmdmp3 have apparently already supported using a URL as an argument. I’ve updated the command-line help text to indicate this. If you’d like to try this function, please try the following …
cmdmp3 https://straypointers.com/sp.mp3
You should hear a promo for my podcast, Stray Pointers ( please visit https://straypointers.com for more information ).
3 Oct 2022 - WAV files
Microsoft made some changes to Windows that now permit playing WAV files through this API. I didn’t have to make any changes to my code. This isn’t really something that I had intended to support, so enjoy it while it lasts!
Error Messages
A number of people using the original C program have reported issues with the above technique. The issues occur as “error 277” and/or “error 263”. These issues began to occur in Windows 7 which supplied its own audio compression / decompression drivers. The blog post below describes the issue. Scroll down to the bottom of the post for a potential solution: