Skip to content

Smooth-Pineapple/Visualiser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Visualiser

This project contains the code and instructions (plus links to futher instructions) for creating a real-time audio visualiser.

This is achieved by connecting a RaspberryPi (tested on Raspberry Pi 3 Model B+), to a LED Matrix (tested on a 64x32 led display) via a RGB Hat (tested on Adafruit RGB Hat), and have it visualise, in real-time, the sound picked up on a USB microphone (tested on GOBEST USB Microphone). There are currently 3 patterns implemented, but more can be added with relative ease.

The project also contains code for a webapp, allowing users to select patterns, languages (Italian and English, but again more can be added with relative ease), brightness, colours and more! (well not much more... but still!)

Prerequisites

Installation

Installation is not necessary, but the following script can act as a set-up script for using the Visualiser webapp on a RaspberryPi:


#!/bin/bash

#If 'COPF' exists copy logs from Visualiser log path to '/boot/Visualiser_Logs/'
COPF=/boot/COPY-YES
if [ -f "$COPF" ]; then
     sudo rm -r /boot/Visualiser_Logs/*
     sudo cp -Rfa /home/pi/Visualiser/log/. /boot/Visualiser_Logs/
fi

#If 'ZIP' exists containing Visualiser code zip, will move/ unzip it to 'DIRECTORY', overwriting anything there and setting the appropriate permissions
ZIP=/boot/Visualiser.zip
DIRECTORY=/home/pi/Visualiser
if [ -f "$ZIP" ]; then
    if [ -d "$DIRECTORY" ]; then
         sudo rm -rf /home/pi/Visualiser
    fi
    sudo unzip /boot/Visualiser.zip -d /home/pi/
    sudo chmod 777 -R /home/pi/Visualiser
    sudo rm -f /boot/Visualiser.zip
fi

#If 'VCONF_S' exists will allow you to provide a config file for the Visualiser without using the webapp (Assuming 'VCONF_D' is a vaild location)
VCONF_S=/boot/config.txt
VCONF_D=/home/pi/Visualiser/config
if [ -f "$VCONF_S" ]; then
    if [ -d "$VCONF_D" ]; then
	 sudo mv -f /boot/config.txt /home/pi/Visualiser/config/
    fi
fi

exit 0

Notes

  • If updating RaspberryPi from 2.7 to 3.7.1, the following may be necessary:

    • Remove Python 2.x:
      
      cd /etc
      sudo apt-get remove python2.7
      sudo apt-get autoremove
      
    • Install libffi-dev:
    
      sudo apt-get install libffi-dev
      
    • Install pip:
    
      sudo apt-get install python-pip
      
    • Update RaspberryPi '~/.bashrc' with:
    
      alias python='/usr/local/bin/python3'
      
  • Automatic script start from boot on a RaspberryPi can be achieved by appending the following to the '/etc/rc.local' file:

    
      sh /home/pi/start-visualiser-server.sh
      cd /home/pi/Visualiser/webapp
      python app.py "$_IP" &
    
      cd /home/pi/Visualiser/display/control
      python app.py &
      

Webapp

Specific Prerequisites

Notes

  • Includes and modifies 'Flask-Colorpicker' - Ver. 0.9 (https://github.com/mrf345/flask_colorpicker/) to allow custom assignment of picker's 'cancel' and 'choose' buttons.

  • Config file format is as follow:

    {"colour": "rgb([0-255], [0-255], [0-255])", "brightness": "[1-100]", "pattern_type": "[1/2/3]", "ip": "[IP ADDRESS]", "lang": "[en/it]"}

Display

Specific Prerequisites

Notes