Light music player

Copyright © Quectel Wireless Solutions Co., Ltd. 2026. All rights reserved.


The light music player is a multimedia demo project based on the Quectel Pi H1 smart single-board computer.

This project plays local audio files, analyzes audio signals in real time, and drives a 16 × 16 WS2812 full-color RGB LED matrix to display dynamic lighting effects synchronized with the rhythm, delivering seamless audio-reactive interaction.

It demonstrates the Quectel Pi H1 smart single-board computer's capabilities in audio processing, SPI peripheral control, and multithreaded real-time display, serving as a reference design for music visualizers, ambient lighting, and LED display applications.

Development resource summary

Development accessory list

Accessory name

Quantity
(Unit: PC(s))

Specifications

Quectel Pi H1 smart single-board computer

1

-

16 × 16 WS2812 full-color RGB LED matrix

1

16 × 16 WS2812 full-color RGB LED matrix

PH1.25 2-pin interface speaker

1

PH1.25 2-pin interface speaker

Power adapter

1

USB type-C power supply

Micro HDMI cable

1

Micro HDMI 2.0; Length: 1 m; Connector: HDMI-A (male) to HDMI-D (male)

Ethernet cable

1

Length: 1 m; Transmission rate: Gigabit

CPU cooling fan (optional)

1

Active cooler (B) for Raspberry Pi 5 with thermal pad

HDMI monitor

1

HDMI monitor

Hardware accessories reference

../../../_images/image_Fx4BbHbLboH8hnx7ea3csgVcnpl.webp

Get started quickly

Development preparation

The Quectel Pi H1 comes pre-installed with Debian 13, so reflashing the OS image is typically not required. Follow the steps below to get started:

Hardware connection

Peripheral connection

../../../_images/image_CNC3bvmW4o3VwwxTDk3ckax4nbg.webp
  1. Display connection: Connect one end of the Micro HDMI cable to the Micro HDMI of the board and the other end to the HDMI of the monitor.

  2. Network connection: Connect one end of the Ethernet cable to the Gigabit Ethernet port of the board and the other end to the Ethernet port of the router (make sure the router is connected to the network).

  3. Input device connection: Connect the USB keyboard and mouse to the USB ports of the board.

  4. Power connection: Connect the USB-A end of the USB-A power cable to the power adapter and the USB-C end to the power port of the board (usually labeled POWER IN).

  5. Cooling fan connection: First insert the cooling fan cable into the FAN slot of the board, then secure both ends of the fan in the reserved inserting holes.

  6. Speaker connection: Connect the PH1.25 2-pin interface speaker to the SPK slot of the board.

6×16 WS2812 connection

The 16 × 16 WS2812 full-color RGB LED matrix connects to the smart mainboard via the SPI interface. Connect its data input pin (DIN) to the corresponding pin on the smart mainboard, and connect VCC and GND to the designated pins on the 40-pin header (see the wiring diagram below):

../../../_images/image_BkEzbbALuoZ0plxyBs3cAwjPnPf.webp
  • Current load limits: The 16 × 16 LED matrix draws significant power under full load. If powering the matrix directly from Pin 2 or Pin 4 (5 V rail) of the mainboard, limit the global brightness to below 15 % in software to prevent mainboard reboots caused by overcurrent or undervoltage brownouts.

  • External power recommendation: For higher brightness levels or sustained, long-term operation, strongly consider powering the matrix using an external dedicated 5 V/ 5 A DC power supply, and tie the external ground (GND) to the smart mainboard's GND pin to establish a common ground.

Project implementation

Prerequisites installation

After confirming that the device is connected to the network, open the terminal and run the following command:

sudo apt update && sudo apt install -y pulseaudio-utils python3-numpy python3-spidev ffmpeg

The preceding command updates the local package index cache and installs the low-level multimedia utilities and Python runtime dependencies required to run the project:

  • pulseaudio-utils: Provides audio utilities such as pacat to play decoded PCM audio data through the system;

  • python3-numpy: Performs FFT spectral analysis and numerical computations on audio signals to drive spectrum lighting effects;

  • python3-spidev: Provides Python bindings to interface with the SPI bus, driving the WS2812 full-color RGB LED matrix;

  • ffmpeg: Decodes audio files in formats such as MP3 and WAV into raw PCM data streams for audio playback and real-time signal analysis.

Configuring 40-Pin interface configuration file

To ensure proper communication between the smart mainboard and the 16 × 16 WS2812 full-color RGB LED matrix, enable spi10 on the 40-pin header as follows:

  • On the board, run vi /etc/qpi-config/qpi-config.ini to open the qpi-config.ini configuration file, and change spi10=disable to spi10=enable, as shown below:

i2c9=enable
spi10=enable
uart12_2w=enable
i2c13=enable
#need pull up gpio47 in you app when use spi14
spi14=disable
led_red_trigger=none
led_blue_trigger=none
led_green_trigger=heartbeat
led_red_brightness=0
led_blue_brightness=0
led_green_brightness=100
  • In the terminal, run sudo qpi-config 40pin set, then restart the board for the configuration to take effect.

Obtaining the code

Go to the GitHub repository to get the code and download it to the board. If you are accessing the device remotely, refer to File copy using SCP for file transfer instructions.

Preparing music files

Copy the music files (MP3 and WAV formats are supported) to the user's Music directory, such as /home/pi/Music.

# Create the Music directory in the current user's home directory
mkdir -p ~/Music 

After the program starts, it automatically scans this directory for music files and generates a playlist.

Application demo

Running the program

Run the following commands in the project directory to start the program:

cd demo-light-music-player/src
sudo python3.13 light_music_player.py 

The lighting effects support two spectrum visualization rendering modes, which can be specified via command-line arguments at startup:

  • Mode 1 (Default): sudo python3 light_music_player.py --mode1 — Scrolling spectrum bar effect.

  • Mode 2: sudo python3 light_music_player.py --mode2 — Full-screen dynamic energy pulse effect.

../../../_images/image_RVWobYTL8owJg6x9kcIcQPFznef.webp

Lighting effects overview

Notes: 16 × 16 WS2812 LED matrix layout

Because the physical trace routing and wiring of 16 × 16 WS2812 full-color RGB LED matrix panels can vary across manufacturers, the physical layout used in this project is configured as follows:

  • Starting LED position: Bottom-left corner (LED 0)

  • First row direction: Left to right (LED 0 → LED 15)

  • Row progression: Bottom to top

  • Wiring layout: serpentine (zigzag) layout

Specifically, the first row routes from left to right, the second row alternates from right to left, and subsequent rows continue upward in this alternating pattern.

The application's internal lighting effects (including dynamic animations such as spectrum bar orientation and energy diffusion direction) map coordinates based on the layout described above.

If the physical wiring layout of your LED matrix differs from the description above, the visual output may appear inverted or misaligned. In this case, adjust the LED matrix mapping configuration to match the actual layout of your panel.

Spectrum push effect of mode1

mode1

This mode is based on 16-band spectrum analysis of the audio:

  • Each column of the LED matrix corresponds to the energy of one band;

  • The bar height changes in real time with the spectrum energy;

  • Supports smooth rising, slow falling, and peak-hold effects;

  • When the music rhythm changes abruptly, the overall display produces a pronounced pushing visual effect.

Raindrop lighting effect of mode2

mode2

This mode simulates the visual effect of raindrops falling from the top of the LED matrix:

  • Raindrop spawn rate dynamically scales with audio intensity;

  • Supports trail rendering and background color fills;

  • Higher instantaneous audio energy (or signal strength) increases raindrop density and dynamic brightness.

Technical support and contributions

If you encounter any problems during use, please submit a technical inquiry on the Quectel official forum. The Quectel technical support team will respond promptly.

Project open-source repository: https://github.com/Quectel-Pi/demo-light-music-player

You are welcome to submit issues to report problems or pull requests to contribute to code improvements!