A go application to play the same music on multiple devices at once. It works best when all playing devices are similar, to avoid differences in the time it takes the audio to be played. I usually test the timing with two Windows 7 machines, one x64, one x86 to ensure the timing difference between the devices is small enough that hearing 2 different devices playing music sounds like one.
To install do go get github.com/LogicalOverflow/music-sync/...
or download the executable from the latest release.
After installing, create a directory named audio
and put your audio files into it. Also, create a users.json
containing at least one username and password/public key of your choice:
{
"username": {
"password": "a password",
"pubKey": "a public key formatted for use in the SSH wire protocol (RFC 4253, section 6.6)"
}
}
If you want, you can add lyrics information to your songs. To add lyrics to a song called song.mp3
, create a file called song.mp3.json
next to the mp3
file containing the lyrics:
[
[
{
"timestamp": 1234,
"caption": "The first "
},
{
"timestamp": 5678,
"caption": "line of lyrics."
}
],
[
{
"timestamp": 9101,
"caption": "The second "
},
{
"timestamp": 10112,
"caption": "line."
}
]
]
Here, timestamps are in milliseconds from the start of the song, each array describes a line of lyrics and each object in those arrays a word/phrase/syllable in the lyrics.
Then you can start a local music-sync-server using
music-sync-server
. By default, this server listens on 127.0.0.1:13333
(--address
, --port
) for clients and provides a ssh terminal on 127.0.0.1:13334
(--ssh-address
, --ssh-port
) to control the server. By default, the server checks in it's working directory for a file called id_rsa
to use as a host key (--host-key-file
). If this file is not found a new host key is generated on every startup. For more options check music-sync-server --help
.
To start a player use music-sync-player
. By default this tries to connect to a server at 127.0.0.1:1333
(--address
, --port
). For more options check music-sync-player --help
.
To get information about the current song playing and lyrics (if provided) in a terminal UI, you can use music-sync-infoer
. By default this tries to connect to a server at 127.0.0.1:1333
(--address
, --port
). For more options check music-sync-infoer --help
.
The ssh terminal on the server is used to control the server. The usernames and passwords are read from users.json
(--users-file
). You can manage the current playlist, pause and resume playback and set the playback volume for all clients. These commands are available:
queue filename [position]
- Adds filename to the playlist at position or the end. You can use glob patterns to add multiple files.remove position
- Removes the song at position from the playlistjump position
- Jumps to position in the playlist, interrupting the current songplaylist
- Prints the current playlistpause
- Pauses playbackresume
- Resumes playbackvolume volume
- Sets the playback volume for all clients (volume should be between 0 and 1)help [command]
- Prints all commands or information and usage of commandls [sub-directory]
- Lists all songs in the music (sub-)directoryclear
- Clears the terminalexit
- Closes the connection
Spaces in commands can be escaped using \
. To escape a backslash before a space use \\
, otherwise the backslash does not need to be escaped.