Play Music

Before attempting to play your first song, make sure you have successfully installed LightShow Pi and verified your hardware configuration.

Playing your first Song

You can play a single song with the following command from your install directory (replacing the path with that of another music file you’ve uploaded to your Raspberry Pi if desired):

sudo python py/ --file=/home/pi/lightshowpi/music/sample/ovenrake_deck-the-halls.mp3

Before the song is played all the lights are turned on for 30 seconds, then off for 1 second before playback begins. You can modify this behavior by overriding the preshow_configuration setting.

Playing back music from a playlist

You can create a playlist of songs to play. The playlist is simply a file with one song per line in the following format (replacing <tab> with the actual <tab> character):

My Cool Song<tab>/home/pi/lightshowpi/music/cool_song.mp3
An Amazing Tune<tab>/home/pi/lightshowpi/music/amazing_tune.mp3

A sample playlist and sample songs are provided in the lightshowpi/music/sample directory.

You can play one song at a time from your playlist by running the following command (replacing /home/pi/lightshowpi/music/sample/.playlist with the path to your playlist):

sudo python py/ --playlist=/home/pi/lightshowpi/music/sample/.playlist

Each time the above command is run, a single file from your playlist will be played. To play one song after another from your playlist you’ll want to override the playlist_path configuration setting to point to your playlist, and then run the following script to continuously play songs from your playlist:


To stop the continuous playback, you can issue to following command:



  1. Is there a way to convert this simple command line menu to a GUI interface

    trap ‘ ‘ 2
    while true
    echo “=================================”
    echo ” Menu of Songs”
    echo “=================================”
    echo “Enter 1 Manheim Steamroller Deck the Halls”
    echo “Enter 2 Frozen”
    echo “Enter 3 Jingle Bells”
    echo “Enter 4 Joy to the World”
    echo “Enter 5 Mary, Did you Know”
    echo “Enter 6 Blue Christmas”
    echo “Enter 7 Main Street Electrical Parade”
    echo “Enter 8 Little Drummer Boy”
    echo “Enter 9 Eye of the Tiger”
    echo “Enter a Don’t want to miss a Thing”
    echo “Enter b Firework”
    echo “Enter q to quit”
    echo -e “\n”
    echo -e “Enter your Selection here and hit ”
    read answer # create varible to retain the answer
    case “$answer” in
    1) sudo python py/ –file=/home/pi/lightshowpi$
    2) sudo python py/ –file=/home/pi/lightshowpi$
    3) sudo python py/ –file=/home/pi/lightshowpi$
    4) sudo python py/ –file=/home/pi/lightshowpi$
    5) sudo python py/ –file=/home/pi/lightshowpi$
    6) sudo python py/ –file=/home/pi/lightshowpi$
    7) sudo python py/ –file=/home/pi/lightshowpi$
    8) sudo python py/ –file=/home/pi/lightshowpi$
    9) sudo python py/ –file=/home/pi/lightshowpi$
    a) sudo python py/ –file=/home/pi/lightshowpi$
    b) sudo python py/ –file=/home/pi/lightshowpi$
    q) exit ;;
    echo -e “/n”
    echo -e ” Hit the key to continue.. \c”
    read input #This cause a pause so we can read the output of the selection be$

    Thanks in advance.

  2. ERROR in execute
    # sudo python py/ –playlist=/home/pi/lightshowpi/music/sample/.playlist
    /home/pi/lightshowpi/py/ RuntimeWarning: divide by zero encountered in log10
    :piff(frequency_limits[i][1], chunk_size, sample_rate):1]))

  3. Is there a way to make this work with with a bluetooth adapter with music coming from an external device? I am new to this, but really want to learn more.

  4. Pingback: Mi show de luces y música de Navidad con Raspberry Pi | Cyberhades

  5. Hope you can help. I am getting the following error:

    “Unable to enable V3D. Please check your firmware is up to date.”

    When running [ sudo python py/ –file=/home/pi/lightshowpi/music/sample/ovenrake_deck-the-halls.mp3 ]

  6. When I try to set what music I want to play I get an error that “Traceback (most recent call last):
    File ‘py/’, line 465, in
    File ‘py/’, line 290, in play_song
    for song in playlist:
    _csv.Error: line contains NULL byte”
    What does all that mean and how can I fix it?

  7. just fyi for anyone trying to stream stuff with stream-in mode, don’t just stream the url to stdout with ffmpeg or something, i’ve had better results using these settings and commands:
    (i am streaming

    1. Run: mkfifo /home/pi/lightshowpi.sock

    2. Change your config to:
    mode = stream-in
    stream_in_command = cat /home/pi/lightshowpi.sock

    3. Start in one terminal (i use tmux)

    4. Run this in another terminal: ffmpeg -re -i -ar 48000 -f wav pipe:1 > /home/pi/lightshowpi.sock

    BOOM! A less resource intensive, less laggy, less delay stream-in mode

Leave a Reply

Your email address will not be published. Required fields are marked *