csgoMP - a Linux compatible music player / soundboard for CS:GO
with YouTube support and a web interface
Download version 0.2.1 (2021-09-23)
Download version 0.2.0 (2021-09-10)
- Webserver mode: check duration of song before searching
- Escape ' character before searching with youtube-dl
Older versions at the bottom of page
- Added webserver mode. This allows searching and playing using a web interface. see below for info
csgoMP (Music Player) is a python program which lets you load up a few audio files and will convert them to the correct format to be played over the csgo comms system. You can then play music or sound effects to your friends in game. It is similar to the HLDJ and SLAM programs for Windows (but more limited in functionality at the moment). csgoMP can also search YouTube for songs and now has a web interface to allow control from a remote PC. When you highlight a file on the list it will be converted and copied to your Counter-Strike Global Offensive directory. When you hold down the assigned key in game it will play the sound / music over comms to your teammates. Sound files can be added from the local file system or from youtube and other video streaming sites that are supported by youtube-dl. It is written for Linux but could probably be easily modified to work on Mac OS X. csgoMP doesn't modify game files in any way or run any code in the background, it just converts the files and creates the configuration file. The source engine does all the actual music playing.
- Python 3
- PyGObject (tested with 3.38) - python3-gobject package?
- python-xlib (tested with 0.26) - python3-xlib package?
- ffmpeg (tested with 4.3.1)
- youtube-dl latest for adding songs from youtube
Script for automatically updating youtube-dl on Slackware
At the moment youtube-dl doesn't seem to work very well, so you might be better with yt-dlp. You can enter the path to yt-dlp in the csgoMP GUI settings, it is currently a drop in replacement for youtube-dl.
- Uses libnotify for displaying status messages
- Extract the archive and run csgomp.py
$ tar zxvf csgoMP-0.1.3.tar.gz
$ cd csgoMP-0.1.3
If you add a link to the csgomp.py script to your path it will be easier to run from your run shortcut.
When upgrading from a previous version you may have to delete your config.ini file.
Check the preferences. If your steam library is at ~/.local/share/Steam/SteamApps and ffmpeg is /usr/bin/ffmpeg then it should work OK already.
Add some audio files (video files with audio tracks should work too)
Click "Write csgo cfg" to save the required config file to your csgo directory
In game, bring up the console and run "exec csgomp" without the quotes. This will set up the keybinding, currently ' (single quote), and some aliases that are needed to play the audio files. It will also set up the / (forward slash) keybinding for toggling continuous playback.
On the main window of csgoMP, select the music file you want to hear in game and it will be converted and made ready for use (usually takes 2-3 seconds for a 3 minute mp3)
Connect to a server or start a game with bots, hold down your ' button (or press /) and you should hear your chosen audio file (so will anyone else on the server)
To search full songs from the command line (or your run shortcut)
$ csgomp.py mission impossible theme
$ csgomp.py bee gees stayin alive
$ csgomp.py mario death sound
To search from command line with a starting position just add a time prefixed with +
$ csgomp.py mission impossible theme +0:07 # 7 seconds in
$ csgomp.py sound of silence +20 # 20 seconds in (It's a bit sad that Disturbed comes up as the first hit, but it's a nice cover)
$ csgomp.py ez for ence +1:22 # 1 minute 22 seconds in
If you start csgomp.py with the -w flag then it will start in webserver mode. The webserver listens on port 1337 by default and you can access it by going to http://127.0.0.1:1337/ to check it works. You can also access it from any other device on your network by going to your PCs IP address (eg http://192.168.1.5:1337/) and if you really want you can forward the port 1337 on your router to your PC to let people anywhere on the internet start searching for songs by going to port 1337 on your public IP address (not recommended, but actually the reason I added the webserver).
Before using webserver mode, you will need to run csgomp.py without any options to set up the paths for your CS:GO directory and stuff in case they can't automatically be detected. You will also need to have the Python module PyAutoGUI installed, this is used for sending the keypress to CS:GO which will start the in game playback.
Playback will only work if you are in a game and have run exec csgomp from the console. If you change the keybindings in the cfg file you will need to change it in the pyautogui call in the code too.
The web interface provides boxes to enter a search term and a starting time - this works in a similar way to the command line search. There is also a toggle mic button which will allow people to start and stop your music playback from anywhere in the world if you open up the port on the firewall.
I wouldn't recommend opening up the port to the internet since this code hasn't been created with security in mind. Most additions to the code were made just after (or even during) some CS:GO matches with beer when we came up with what seemed like a good idea at the time. It has grown into one big messy Python file, but it seems to work as long as youtube-dl does :)
Only one audio file can be active at any one time. If you want to change the current audio file just go back to the csgoMP main window and select it. When using continuous playback you will have to press / again to toggle it off when the end of the song is reached otherwise you will continue to transmit silence. Even if the round ends you will still need to press the toggle off button again otherwise you will be transmitting the music file every time you try to use normal voice comms.
Any filetype which has an audio track and is supported by your installation of ffmpeg should work. That includes video files as well as audio files. If you open a video file then the audio track will (hopefully) be extracted.
My mic doesn't work anymore
If music is getting played every time you try to use your mic then you either forgot to toggle music playback off again when the file finished playing, or the game didn't register that you let go of the push to play button for some reason. Just press the toggle button again or the push to play button again and it will reset back to normal mic input for comms.
If you want to report any bugs, suggest new features, or just need help getting it running then send an email to firstname.lastname@example.org.
This initial release is missing a few features. Some things that will be added in the future
- Cleanup code/UI
- Add option to choose in game keybindings (at the moment hardcoded as ' and / for playing and keypad numbers for switching tracks)
- Add support for OS X
- Add support for other games. It should work with TF2, Insurgency and some other source games
- Add options to assign audio tracks an alias so you can switch song from the in game console. Watch a cfg file for current track request?
- Search youtube from csgo console and download first hit
csgoMP is free but donations are always welcome :)
Trade offer link
Download version 0.1.4 (2021-01-31)
Download version 0.1.3 (2020-10-09)
- Added test button to check youtube-dl is up to date
- Added test buttons to check ffmpeg and the CS:GO directory are set correctly
Download version 0.1.2 (2019-11-12)
- Remove non numerical characters from starting time offset
Download version 0.1.1 (2019-10-09)
- Added option to set starting position when searching youtube with +
Download version 0.1.0 (2019-10-02)
- Updated detection of ffmpeg version
Download version 0.0.9 (2019-03-04)
- Updated to use Python 3.
- Option to lower volume on YouTube files
- Fix bug where duplicates would be added to the list
- Check version of ffmpeg to determine options required
Download version 0.0.8 (2018-11-10)
- You can now search for a song by passing it as a command line option. Put a link to csgomp.py somewhere in your path and you can run (for example) "csgomp.py mission impossible theme" to search youtube for the mission impossible theme and set it as the active song by using your run shortcut/hotkey. Notifications will let you know when the song is ready to play or if there was a problem. csgoMP must have already been set up before using command line search so that it knows where to find youtube-dl and where your csgo directory is.
Download version 0.0.7
- Added option to remove files from the list by right clicking them.
- Added some warnings for missing settings and command failures.
Download version 0.0.6
- Added start of hotkey support for changing tracks. This requires the python-xlib module.
- At the moment the hotkeys are just hardcoded as keypad 0 - 9 corresponding to the first 10 tracks on the list. Sorry if you are using your numpad for something else already. Warning: don't change the track while you are already playing another track, it might crash csgo.
Download version 0.0.5
- Added scrollbars to the audio file list
- Try to restore the window size on startup
Download version 0.0.4
- Fixed bug when adding a local file without setting a start and end position
Download version 0.0.3
- Fixed downloading music from youtube bug
- Added options to set aliases for the music files
- Added option when adding a local file to set start position and duration to cut a selection from music files
Download version 0.0.2
- Fixed conversion of mp3 files with images in metadata
- Added functions to cache converted music files instead of encoding everytime
- Added download from youtube option
Initial release 0.0.1
- Added bind to toggle continuous playback so you don't have to hold the push to play button