Skip to content

rbn42/panon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Different Audio Spectrum Analyzer for KDE Plasma

../../wiki/plasmoid/preview.png

Contents

Requirements

Minimal version required
OpenGL / GLSL3.0 / 1.30
QtQuick2.0

Install the required dependencies

Arch Linux

sudo pacman -S qt5-websockets qt5-3d \
    python-docopt python-numpy python-pillow python-pyaudio python-cffi python-websockets 

Ubuntu

sudo apt-get install qml-module-qt3d qml-module-qt-websockets \
    python3-docopt python3-numpy python3-pyaudio python3-cffi python3-websockets python3-pil 

Installation

Via KDE Store

  1. Open the “Add Widgets” dialog of your desktop
  2. Go to “Get New Widgets” in the bottom
  3. Click “Download New Plasma Widgets”
  4. Search for “panon”
  5. Click “Install”

Via Command Line

git clone https://github.com/rbn42/panon.git
cd panon/kde
# To install
kpackagetool5 -t Plasma/Applet --install plasmoid
# To upgrade
kpackagetool5 -t Plasma/Applet --upgrade plasmoid

Via AUR

plasma5-applets-panon and plasma5-applets-panon-git are available for ArchLinux.

If you want to modify shaders, installing panon as a system package is not a preferred solution right now, because then the modification will require write permission in /usr/share/plasma/plasmoids/panon.

Drag panon widget to your panel (eg. latte-dock).

../../wiki/plasmoid/step1.png ../../wiki/plasmoid/step2.png

Shaders

What is a shader? And a turtorial for beginners.

Shaders are stored in kde/plasmoid/contents/shaders/. If you want to modify the shaders, you can start with solid.frag.

Providing panon is installed in your home directory, you can add your own shader files to ~/.local/share/plasma/plasmoids/panon/contents/shaders/. Panon can detect and load shaders in this folder. The name of a shader file must be ended with .frag.

Shader API and Shadertoy.com

Shadertoy.com is a cross-browser online community and tool for creating and sharing shaders through WebGL, from where you can find many wonderful works shared by kind people. And by default, these works are licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.

Panon’s shader API is designed to be similar to shadertoy.com. Many of the works can be copied directly to panon, providing you add #version 130 to the shader file’s first line. But all these works were designed to show in browsers, so they won’t look good in tiny space like a panel. example-shadertoy.frag is such an example.

Currently, these shadertoy-like uniforms are provided,

iResolutionwidth and heigh of the appletavailable
iTimeavailable
iTimeDeltaavailable
iFrameavailable
iMousemouse positionavailable
iChannel0fixed wave datacoming soon
iChannel1fixed spectrum dataavailable

Debugging Shaders

Neither KDE Panel nor Latte-Dock shows the errors caused by the shaders. To catch the error messages, plasma-sdk is required. To debug your shader, you must put your shader file in kde/plasmoid/contents/shaders/, and then start plasmoidviewer in a console.

cd ./kde/
#Providing plasma-sdk is installed
plasmoidviewer --applet ./plasmoid/

In plasmoidviewer, go to the configuration window and pick your own shader. Then plasmoidviewer will run your shader and show the errors, if exist, in the console.

Troubleshooting

Panon shows nothing when you are playing music

  1. Please make sure your OpenGL version satisfies the minimum requirement.
  2. If you are using pyaudio as panon’s backend, please execute python3 ./test/test_pyaudio.py The script will tell you if pyaudio works or not. If the script failed, this issue can be reported to pyaudio. Alternatively, you may choose to execute ./test/test_python-sounddevice.py and ./test/test_QtMultimedia.py and if one of them works for you, I can add it to panon as another backend choice.

Credits

LICENSE
source.py and spectrum.pyadapted from PyVisualizer
husl-glsl.fshcopied from hsluv-glsl
hsv2rgb in utils.fshcopied from GLSL-color.md
example-shadertoy.fragcopied from shadertoyCC BY-NC-SA 3.0
pulseaudio.py and pulseaudio.py.hcopied from SoundCardBSD-3-Clause