Giter Site home page Giter Site logo

rpi-fft-led's Introduction

rpi-fft-led

This is a Raspberry Pi Projekt for the German Jugend Forscht competition. This Code controlls WS2812B LEDs using the SPI port of the Raspberry Pi by calculating a Fast Fourier Transform. The code I wrote makes use of the GPU_FFT library (http://www.aholme.co.uk/GPU_FFT/Main.htm) and code to steer the WS2812b LEDs (https://github.com/penfold42/stuff/blob/master/ws2812_spi.c).

fft.c is the main file and requires 1 to 3 arguments, the

  • 1st is a mono .wav file to play or "mic" if you want to use an external microphone
  • 2nd is the mode 1-4 to for displaying the sound
  • 3nd is optional. If set to "log" displays Bins logarythmically on LED-Strip. If set as something else the frequency spectrum of each time frame should be scaled to 1 for the highest FFT amplitude.

The Modes are in the led_modes.c file

  • Mode 1 maps each LED a number of bins and displays a color spectrum and the brightness is the amplitude(has to be optimized).
  • Mode 2 maps each LED a number of bins and the color is the amplitude.
  • Mode 3 is the same as mode 2 but the base is additional brightness.
  • Mode 4 displays a snake that always adds the frequency with the highest amplitude to the beginning.
  • Mode 5 displays the current volume using the number of LEDs. The color is represented by the most domiante frequency

Install and build

#Update system
sudo apt-get update && sudo apt-get upgrade

#Install missing librarys
sudo apt-get install libsndfile1 libsndfile1-dev

#Clone Project
git clone https://github.com/mariusdkm/rpi-fft-led

cd rpi-fft-led

#Build Project
make fft.bin

An example call would be:

sudo ./fft.bin example.wav 4

or

sudo ./fft.bin mic 2

Run the code using sudo since the GPU_FFT code makes use of the GPU, which requires root permissions.

The Langfassung.pdf is the Document I wrote for the Jugend Forscht Contest. It is in German but goes a bit deeper into how and why I've built this Project.

In developing this, I made use of the following information: http://www.aholme.co.uk/GPU_FFT/Main.htm https://stackoverflow.com/questions/3407942/rgb-values-of-visible-spectrum https://github.com/penfold42/stuff/blob/master/ws2812_spi.c https://www.linuxjournal.com/article/6735 https://ubuntuforums.org/showthread.php?t=968690

For the spi interface Copyright (c) 2016 penfold42

For the GPU_FFT Copyright (c) 2014 Andrew Holme.

Copyright (c) 2018 mariusdkm

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Softare Foundation, version 2.

rpi-fft-led's People

Contributors

mariusdkm avatar mixa999999 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

rpi-fft-led's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.