GoFM

A cross-platform real-time audio streaming server for MP3 files, written in Go. It allows synchronized playback across multiple clients.

Go Version Go Report Card Downloads License References

fm.stackstore.net


What is GoFM?

GoFM is a cross-platform, real-time audio streaming server written in Go. It enables you to stream MP3 audio files from a specified directory over HTTP and synchronize playback across multiple clients.

We have fully opened the source code of GoFM under the most liberal MIT license. If you are interested, you can find the source code of the program at https://github.com/pxgo/GoFM.

Below are some online GoFM services:

Taylor’s Music

Pop music

If you have available services, you can send links to [email protected]. We’ll verify them and add them here.

Quick Start

By reading this section, you will learn how to deploy a GoFM service.

Getting GoFM

We recommend downloading the precompiled GoFM from GitHub Releases, which is the most convenient way to get GoFM. If you are familiar with Golang, or if there is no version available for your computer architecture in GitHub Releases, you can also compile GoFM from the source code.

Project link: https://github.com/pxgo/GoFM

Configuring the Directory

Create a folder named fm and place the GoFM executable in it. Next, create a music folder inside the fm folder and copy your favorite music into it. The final directory structure should look like this:

fm
├─ GoFM // or GoFM.exe
└─ music
   ├─ Style.mp3
   └─ Yesterday.mp3

Starting the Service

Starting the GoFM service is very simple. Open a console and navigate to the fm directory, then execute the following command:

# linux or mac
./GoFM -d ./music 
# windows system
./GoFM.exe -d ./music

If you see http server started on [::]:8090 in the console, and you can see the following content by accessing http://127.0.0.1:8090 through a browser:

running

Congratulations 🎉, your first GoFM service has been successfully started. Isn’t it simple?

Now let’s review the startup command ./GoFM -d ./music. In this command, we used the -d parameter to specify the folder where the audio files are located. In addition to the -d parameter, GoFM also supports other parameters for adjusting service properties, such as the -n parameter for adjusting the service name and the -p parameter for adjusting the service port.

If you want to change the service name to Taylor's Music and run the service on port 8080, you can start the service like this:

# linux or mac
./GoFM -d ./music -n "Taylor's Music" -p 8080
# windows system
./GoFM.exe -d ./music -n "Taylor's Music" -p 8080

By accessing http://127.0.0.1:8080 through a browser, you will see that the service name has been changed:

running

If you want to learn more about GoFM parameters, please execute the following command:

# linux or mac
./GoFM -h
# windows system
./GoFM.exe -h

The console will output all the parameters supported by GoFM and their descriptions.

Usage: GoFM [options]
  -d string
        directory to play (default "./")
  -debug
        enable debug mode for server
  -h    show help information
  -host string
        server host address (default "0.0.0.0")
  -n string
        server name (default "GoFM")
  -p int
        server port number (default 8090)
  -r    enable random playback mode

By now, you have fully mastered the deployment of a GoFM service. Enjoy using GoFM!