Git Product home page Git Product logo

music-sync's Introduction

Build Status Coverage Status Codacy Grade Code Climate Issues Code Climate Maintainability GitHub Release Version GoDoc Reference License

Music Sync

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.

Installation

To install do go get github.com/LogicalOverflow/music-sync/... or download the executable from the latest release.

Getting Started

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 playlist
  • jump position - Jumps to position in the playlist, interrupting the current song
  • playlist - Prints the current playlist
  • pause - Pauses playback
  • resume - Resumes playback
  • volume 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 command
  • ls [sub-directory] - Lists all songs in the music (sub-)directory
  • clear - Clears the terminal
  • exit - 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.

music-sync's People

Contributors

logicaloverflow avatar

Watchers

James Cloos avatar Zack avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.