Requirements
-
clientprefs. This plugin saves players' volume and offset settings for their convenience.
-
setup. It’s going to take you quite a bit of time to get everything working.
-
web server with PHP. Songs are played through HTML MOTDs, so you’ll need to be able to serve the PHP pages.
-
file host. You need somewhere to put the songs, of course. This can be the same as the web server if you’d like.
-
MP3 files. This is the most common, lossy codec available, so we’re going with these. Small filesizes are better, so the bit rate should be at most 128 kbps.
-
LRC files. The plugin uses these for song information (title, artist, etc.) and, well, lyrics.
Got these? Good. Now on to installation!
Installation
1) You will need a public place to store the audio files (see "file host" above). You can use your webhost if you like. All music must be placed in one folder. Remember the URL of this folder for later steps.
2) You will need a web server with PHP. Upload the contents of Karaoke_www.zip and remember the URL for "play.php".
You must edit this file! You need to specify the URL of the audio folder from step #1. The line which you should edit is clearly marked; be sure not to change anything else unless you know what you are doing.
3) Download the attached plugin (click "Get Plugin" for the .smx) and place it in addons\sourcemod\plugins
4) Create the following file:
addons\sourcemod\data\karaoke.txt
The first line should contain the URL for play.php from step #2.
5) Create the following folder:
addons\sourcemod\data\karaoke\
In this folder should be .lrc files with names that match the .mp3 files on your server. For example, if you have a file called
LonelyIsland_LikeABoss.lrc, the matching MP3 file should be called
LonelyIsland_LikeABoss.mp3 or else it will not work. For more information on .lrc files, see below.
6) In-game and as an admin with the slay flag, type
/k or
/karaoke and a menu should pop up listing songs found in your karaoke folder. If a song is not there, check error logs, as there may be a problem with the .lrc file. Alternatively, you can type
/kvote and up to six songs will be randomly chosen for you to choose. The song with the most votes after 20 seconds will be selected.
7) The announcer should count down from 20 seconds with an accompanying centertext explaining that you may change your volume with
/vol #. While this happens, players may hear the song faintly in the background, as this is an attempt to preload the song so that it won't be too out of sync. Another command is
/offset, which allows you to change how much later or earlier the music and lyrics will display. Type
/offset for more instructions on how to use it.
8) The music should play, and if the .lrc file was written well, the centertext-ed lyrics should display with the music. The timing should not be too far off, as the lyrics are meant to display earlier than they occur in the music so that singers have time to prepare for the next line, but there still may be some cases of the music playing too late. I will see if there are any ways of fixing this.
9) That's it! Enjoy singing along while killing people!
Commands- /k or /karaoke will pop up a menu that will allow you to choose a sorting method (title, artist, or album), which will then allow you to choose an individual song. Requires SLAY admin flag.
- /kstop will prematurely end the current song. Lyrics and music should stop playing, and you should be able to pick a new song immediately.
- /kvote picks 6 random songs and sends a vote to all players. After 20 seconds, the votes are collected and the winning song is played. Requires SLAY admin flag.
- /offset changes how early or late the song or lyrics will play. This is on a per-client basis and only has effect before a song is chosen. Type /offset for more information.
- /vol changes the volume of the songs. This is per-client and can be changed mid-song at the cost of possible desyncing.
.lrc Files
The beginning of a .lrc file should contain metadata for the song. These are in "tags", which are of the following format:
[tag:information]
Possible .lrc tags that can be used include:
- ti: Song title. This is required.
- ar: Artist. Also required.
- al: Album.
- offset: Offset in milliseconds. The music will be delayed by this much when it is played (e.g. [offset:2000] will display lyrics two seconds earlier). Can be negative.
- by: .lrc author identification. Not really "supported" since all other tags are ignored, but credit is always nice to have.
Following this should be lines with timestamps and text, like so:
[0:12.34]Hello, world!
For the above line, 12.34 seconds after the song starts, "Hello, world!" will display on the screen. If there is a line after it, "Hello, world!" will stay on screen until the next line. If you do not want this to happen, you can just put nothing after a timestamp for a blank line.
If you want to use newlines, you can use either \n or | as a newline delimiter.
UTF-8 .lrc files are supported, as the plugin will remove the BOM (\xEF\xBB\xBF). However, I'm not sure what else will or won't work, so you will have to find out for yourself.
For examples of .lrc files that work with Karaoke, you can see my works
here.
Changelog
19 September 2009 - 1.2
- The plugin actually works again.
- Songs menu now lets you sort by artist, title, or album.
- Fixed bug where the song would not be considered "finished" when it was.
17 September 2009 - 1.1
- No longer dependent on TF2.
- Music offset limits changed to ±5.0 seconds.
- Lyrics now play 0.5 seconds later than before.
-
/vol now changes volume mid-song at the cost of some desyncing.
- Added two new commands:
/kstop and
/kvote. Both require the slay flag.
- Fixed an error message when attempting to show lyrics after the song is over.
- "of" tag changed to "offset"; now represents milliseconds to be subtracted from timestamps.
---
Note: This is nowhere near as secure as SirLamer's Jukebox plugin. You have been warned. You claim responsibility by installing this plugin. If you'd like to contribute a patch for this (or anything), I'd be happy to include it.