Merge pull request #2 from CelestialWalrus/master

Monstercat style FFT easing
master
karl 11 years ago
commit 7ee0861e3f
  1. 12
      README.md
  2. 15
      cava.c

@ -1,5 +1,5 @@
C.A.V.A.
========
C.A.V.A. - CW's fork
====================
**C**onsole-based **A**udio **V**isualizer for **A**LSA
@ -13,6 +13,7 @@ by [Karl Stavestrand](mailto:karl@stavestrand.no)
Updates
-------
4/19/2015 - Added Monstercat style FFT easing.
9/22/2014 - Added support for mpd FIFO input.
What it is
@ -26,6 +27,10 @@ This is my first published code. I am not a professional programmer so the sourc
Any tips or comments would be much appreciated.
TODO
----
* make cava react to terminal resizing
Build requirements
------------------
@ -37,6 +42,9 @@ Debian/Raspbian users can install this with:
apt-get install libfftw3-dev libasound2-dev
ArchLinux users can install this with:
pacman -S base-devel fftw
Getting started
---------------

@ -5,6 +5,10 @@
#include <sys/ioctl.h>
#include <fftw3.h>
#define PI 3.14159265358979323846
#define max(a,b) \
({ __typeof__ (a) _a = (a); \
__typeof__ (b) _b = (b); \
_a > _b ? _a : _b; })
#include <unistd.h>
#include <signal.h>
#include <string.h>
@ -502,6 +506,17 @@ int main(int argc, char **argv)
continue;
}
/* MONSTERCAT STYLE EASING BY CW !aFrP90ZN26 */
int z, m_y;
for (z = 0; z < bands; z++) {
for (m_y = z-1; m_y >= 0; m_y--) {
f[m_y] = max(f[z]/pow(2, z-m_y), f[m_y]);
}
for (m_y = z+1; m_y < bands; m_y++) {
f[m_y] = max(f[z]/pow(2, m_y-z), f[m_y]);
}
}
//**DRAWING**// -- put in function file maybe?
if (debug == 0) {
for (n = (height - 1); n >= 0; n--) {

Loading…
Cancel
Save