diff --git a/README.md b/README.md
index 0b325c3..847c98d 100644
--- a/README.md
+++ b/README.md
@@ -228,3 +228,98 @@ If cava quits unexpectedly or is force killed, echo must be turned on manually w
| m | Swtich between smoothing modes |
| up / down| increase/decrease sensitivity |
| q or CTRL-C| Quit C.A.V.A. |
+
+Configuration
+-------------
+
+Configuration file is located in `$XDG_CONFIG_HOME/cava/config` or `$HOME/.config/cava/config`.
+
+### Example file:
+
+ [general]
+ mode=normal
+ framerate=60
+ sensitivity=100
+ bars=0
+
+ [input]
+ method=fifo
+ source=/tmp/mpd.fifo
+
+ [output]
+ method=terminal
+
+ [color]
+ background=white
+ foreground=blue
+
+ [smoothing]
+ integral=1
+ monstercat=1
+ gravity=1
+
+ [eq]
+ ; naming of keys doesn't matter
+ 1=0.5
+ 2=0.6
+ 3=0.7
+ 4=0.3
+ 5=0.2
+
+### Sections:
+
+#### [general]
+
+* `mode` defines smoothing mode, can be `normal`, `scientific` or `waves`. Default: `normal`.
+* `framerate` is framerate (FPS). Default: `60`. Accepts only non-negative values.
+* `sensitivity` is sensitivity %. Default: `100`. Accepts only non-negative values.
+* `bars` defines the amount of bars. `0` sets it to auto. Default: `0`. Accepts only non-negative values.
+
+#### [input]
+
+* `method` may be `alsa` or `fifo`.
+* `source` is the ALSA path or FIFO path.
+
+#### [output]
+
+* `method` may be `terminal` or `circle`. Default: `terminal`.
+
+#### [color]
+
+* `background` is the background color.
+* `foreground` is the foreground (bars) color.
+
+#### [smoothing]
+
+* `integral` sets the multiplier for the integral smoothing calculations. Default: `1`. Another example: `0.5`. Accepts only non-negative values.
+* `monstercat` disables or enables the so-called "Monstercat smoothing". Default: `1`. Accepts only `0` or `1`.
+* `gravity` sets the gravity multiplier. Default: `1`. Accepts only non-negative values.
+
+#### [eq]
+
+This one is tricky. You can have as much keys as you want. More keys = more precision.
+
+**How it works:**
+
+1. Cava takes values from this section in the order of appearance (naming of the keys doesn't really matter) and puts them into an array.
+2. Visualization is divided into `x` sections (where x is the amount of values) and all bars in each of these sections are multiplied by the corresponding value from that array.
+
+**Examples:**
+
+ [eq]
+ 1=0
+ 2=1
+ 3=0
+ 4=1
+ 5=0
+
+
+
+ [eq]
+ 1=2
+ 2=2
+ 3=1
+ 4=1
+ 5=0.5
+
+
\ No newline at end of file
diff --git a/cava.c b/cava.c
index aecb2d6..b64c0f6 100644
--- a/cava.c
+++ b/cava.c
@@ -64,7 +64,7 @@ void sig_handler(int sig_no)
int main(int argc, char **argv)
{
// config: location
- char *configFile = "config.ini";
+ char *configFile = "config";
char configPath[255];
configPath[0] = '\0';
@@ -106,7 +106,7 @@ int main(int argc, char **argv)
int mode = 1;
int modes = 3; // amount of smoothing modes
int enableMonstercat = iniparser_getboolean(ini, "smoothing:monstercat", 1);
- int enableIntegral = iniparser_getboolean(ini, "smoothing:integral", 1);
+ int integral = iniparser_getdouble(ini, "smoothing:integral", 1);
double gravity = iniparser_getdouble(ini, "smoothing:gravity", 1);
float fc[200];
float fr[200];
@@ -405,7 +405,9 @@ Options:\n\
if (bw < 1) bw = 1; //bars must have width
- smh = (double)(((double)(smcount-1))/((double)bands));
+ if ((smcount > 0) && (bands > 0)) {
+ smh = (double)(((double)smcount)/((double)bands));
+ }
// process [smoothing]: calculate gravity
g = gravity * ((float)height / 270) * pow((60 / (float)framerate), 2.5);
@@ -575,8 +577,10 @@ Options:\n\
}
// process [smoothing]: eq
- for (z = 0; z < bands; z++) {
- f[z] = f[z] * smooth[(int)floor(((double)z) * smh)];
+ if (smcount > 0) {
+ for (z = 0; z < bands; z++) {
+ f[z] = f[z] * smooth[(int)floor(((double)z) * smh)];
+ }
}
// process [smoothing]: falloff
@@ -598,9 +602,9 @@ Options:\n\
}
// process [smoothing]: integral
- if (enableIntegral) {
+ if (integral > 0) {
for (o = 0; o < bands; o++) {
- fmem[o] = fmem[o] * 0.70 + f[o];
+ fmem[o] = fmem[o] * 0.70 * integral + f[o];
f[o] = fmem[o];
if (f[o] < 1)f[o] = 1;