]> Freerunner's - dotfiles.git/commitdiff
cava: update config
authorAndre Ramnitz <tux.rising@gmail.com>
Sat, 19 Jul 2025 18:16:06 +0000 (20:16 +0200)
committerAndre Ramnitz <tux.rising@gmail.com>
Sat, 19 Jul 2025 18:16:06 +0000 (20:16 +0200)
dot-config/cava/config
dot-config/cava/shaders/eye_of_phi.frag [new file with mode: 0644]
dot-config/cava/shaders/spectrogram.frag [new file with mode: 0644]
dot-config/cava/shaders/winamp_line_style_spectrum.frag [new file with mode: 0644]
dot-config/cava/waybarconfig [new file with mode: 0644]

index 28b938e66ab4f3604ca923c126edf94f0d0e70c8..68ae1a717f6b444682e4018ab2bfd46fee0fd7b9 100644 (file)
@@ -22,7 +22,7 @@ framerate = 90
 # The number of bars (0-200). 0 sets it to auto (fill up console).
 # Bars' width and space between bars in number of characters.
 bars = 0
-bar_width = 8
+bar_width = 7
 bar_spacing = 1
 # bar_height is only used for output in "noritake" format
 ; bar_height = 32
@@ -36,8 +36,8 @@ bar_spacing = 1
 # the bandwidth of the visualizer.
 # Note: there is a minimum total bandwidth of 43Mhz x number of bars.
 # Cava will automatically increase the higher cutoff if a too low band is specified.
-lower_cutoff_freq = 27
-higher_cutoff_freq = 6666
+lower_cutoff_freq = 86
+higher_cutoff_freq = 15566
 
 
 # Seconds with no input before cava goes to sleep mode. Cava will not perform FFT or drawing and
@@ -146,16 +146,6 @@ channels = mono
 # Gradient mode, only hex defined colors (and thereby ncurses mode) are supported,
 # background must also be defined in hex  or remain commented out. 1 = on, 0 = off.
 # You can define as many as 8 different colors. They range from bottom to top of screen
-gradient = 1
-; gradient_count = 8
-; gradient_color_1 = '#59cc33'
-; gradient_color_2 = '#80cc33'
-; gradient_color_3 = '#a6cc33'
-; gradient_color_4 = '#cccc33'
-; gradient_color_5 = '#cca633'
-; gradient_color_6 = '#cc8033'
-; gradient_color_7 = '#cc5933'
-; gradient_color_8 = '#cc3333'
 
 # background = '#191724'
 gradient = 1
@@ -167,23 +157,12 @@ gradient_color_4 = '#ebbcba'
 gradient_color_5 = '#f6c177'
 gradient_color_6 = '#eb6f92'
 
-
 [smoothing]
 
-# Percentage value for integral smoothing. Takes values from 0 - 100.
-# Higher values means smoother, but less precise. 0 to disable.
-# DEPRECATED as of 0.8.0, use noise_reduction instead
-; integral = 77
-
 # Disables or enables the so-called "Monstercat smoothing" with or without "waves". Set to 0 to disable.
 monstercat = 0
 waves = 0
 
-# Set gravity percentage for "drop off". Higher values means bars will drop faster.
-# Accepts only non-negative values. 50 means half gravity, 200 means double. Set to 0 to disable "drop off".
-# DEPRECATED as of 0.8.0, use noise_reduction instead
-; gravity = 100
-
 # In bar height, bars that would have been lower that this will not be drawn.
 # DEPRECATED as of 0.8.0
 ; ignore = 0
@@ -193,16 +172,3 @@ waves = 0
 # 1 will be very slow and smooth, 0 will be fast but noisy.
 noise_reduction = 0.77
 
-
-[eq]
-
-# This one is tricky. You can have as much keys as you want.
-# Remember to uncomment more then one key! More keys = more precision.
-# Look at readme.md on github for further explanations and examples.
-# DEPRECATED as of 0.8.0 can be brought back by popular request, open issue at:
-# https://github.com/karlstav/cava
-1 = 1.6 # bass
-2 = 1.4
-3 = 1.2 # midtone
-4 = 1.2
-5 = 1 # treble
diff --git a/dot-config/cava/shaders/eye_of_phi.frag b/dot-config/cava/shaders/eye_of_phi.frag
new file mode 100644 (file)
index 0000000..e499ee7
--- /dev/null
@@ -0,0 +1,117 @@
+#version 330
+
+// this shader was stolen from shadertoy user ChunderFPV
+
+#define SCALE 8.0
+#define PI radians(180.0)
+#define TAU (PI * 2.0)
+#define CS(a) vec2(cos(a), sin(a))
+#define PT(u, r) smoothstep(0.0, r, r - length(u))
+
+in vec2 fragCoord;
+out vec4 fragColor;
+
+uniform float bars[512];
+
+uniform int bars_count;    // number of bars (left + right) (configurable)
+uniform float shader_time; // shader execution time s
+uniform int bar_width;     // bar width (configurable), not used here
+uniform int bar_spacing;   // space bewteen bars (configurable)
+
+uniform vec3 u_resolution; // window resolution
+
+// colors, configurable in cava config file (r,g,b) (0.0 - 1.0)
+uniform vec3 bg_color; // background color
+uniform vec3 fg_color; // foreground color
+
+uniform int gradient_count;
+uniform vec3 gradient_colors[8]; // gradient colors
+
+// gradient map ( color, equation, time, width, shadow, reciprocal )
+vec3 gm(vec3 c, float n, float t, float w, float d, bool i) {
+  float g = min(abs(n), 1.0 / abs(n));
+  float s = abs(sin(n * PI - t));
+  if (i)
+    s = min(s, abs(sin(PI / n + t)));
+  return (1.0 - pow(abs(s), w)) * c * pow(g, d) * 6.0;
+}
+
+// denominator spiral, use 1/n for numerator
+// ( screen xy, spiral exponent, decimal, line width, hardness, rotation )
+float ds(vec2 u, float e, float n, float w, float h, float ro) {
+  float ur = length(u);          // unit radius
+  float sr = pow(ur, e);         // spiral radius
+  float a = round(sr) * n * TAU; // arc
+  vec2 xy = CS(a + ro) * ur;     // xy coords
+  float l = PT(u - xy, w);       // line
+  float s = mod(sr + 0.5, 1.0);  // gradient smooth
+  s = min(s, 1.0 - s);           // darken filter
+  return l * s * h;
+}
+
+void main() {
+  float t = shader_time / PI * 2.0;
+  vec4 m = vec4(0, 0, 0, 0);                 // iMouse;
+  m.xy = m.xy * 2.0 / u_resolution.xy - 1.0; // ±1x, ±1y
+  if (m.z > 0.0)
+    t += m.y * SCALE; // move time with mouse y
+  float z = (m.z > 0.0) ? pow(1.0 - abs(m.y), sign(m.y)) : 1.0; // zoom (+)
+  float e = (m.z > 0.0) ? pow(1.0 - abs(m.x), -sign(m.x))
+                        : 1.0;                   // screen exponent (+)
+  float se = (m.z > 0.0) ? e * -sign(m.y) : 1.0; // spiral exponent
+  vec3 bg = vec3(0);                             // black background
+
+  float aa = 3.0; // anti-aliasing
+
+  for (float j = 0.0; j < aa; j++)
+    for (float k = 0.0; k < aa; k++) {
+      vec3 c = vec3(0);
+      vec2 o = vec2(j, k) / aa;
+      vec2 uv = (fragCoord * u_resolution.xy - 0.5 * u_resolution.xy + o) /
+                u_resolution.y * SCALE * z; // apply cartesian, scale and zoom
+      if (m.z > 0.0)
+        uv =
+            exp(log(abs(uv)) * e) * sign(uv); // warp screen space with exponent
+
+      float px = length(fwidth(uv)); // pixel width
+      float x = uv.x;                // every pixel on x
+      float y = uv.y;                // every pixel on y
+      float l = length(uv);          // hypot of xy: sqrt(x*x+y*y)
+
+      float mc = (x * x + y * y - 1.0) / y;  // metallic circle at xy
+      float g = min(abs(mc), 1.0 / abs(mc)); // gradient
+      vec3 gold = vec3(1.0, 0.6, 0.0) * g * l;
+      vec3 blue = vec3(0.3, 0.5, 0.9) * (1.0 - g);
+      vec3 rgb = max(gold, blue);
+
+      float w = 0.1;                                      // line width
+      float d = 0.4;                                      // shadow depth
+      c = max(c, gm(rgb, mc, -t, w * bars[0], d, false)); // metallic
+      c = max(c, gm(rgb, abs(y / x) * sign(y), -t, w * bars[1], d,
+                    false)); // tangent
+      c = max(c, gm(rgb, (x * x) / (y * y) * sign(y), -t, w * bars[2], d,
+                    false)); // sqrt cotangent
+      c = max(c, gm(rgb, (x * x) + (y * y), t, w * bars[3], d,
+                    true)); // sqrt circles
+
+      c += rgb * ds(uv, se, t / TAU, px * 2.0 * bars[4], 2.0, 0.0); // spiral 1a
+      c += rgb * ds(uv, se, t / TAU, px * 2.0 * bars[5], 2.0, PI);  // spiral 1b
+      c +=
+          rgb * ds(uv, -se, t / TAU, px * 2.0 * bars[6], 2.0, 0.0); // spiral 2a
+      c += rgb * ds(uv, -se, t / TAU, px * 2.0 * bars[7], 2.0, PI); // spiral 2b
+      c = max(c, 0.0); // clear negative color
+
+      c += pow(max(1.0 - l, 0.0), 3.0 / z); // center glow
+
+      if (m.z > 0.0) // display grid on click
+      {
+        vec2 xyg = abs(fract(uv + 0.5) - 0.5) / px; // xy grid
+        c.gb += 0.2 * (1.0 - min(min(xyg.x, xyg.y), 1.0));
+      }
+      bg += c;
+    }
+  bg /= aa * aa;
+  bg *= sqrt(bg) * 1.5;
+
+  fragColor = vec4(bg, 1.0);
+}
\ No newline at end of file
diff --git a/dot-config/cava/shaders/spectrogram.frag b/dot-config/cava/shaders/spectrogram.frag
new file mode 100644 (file)
index 0000000..ccb79ae
--- /dev/null
@@ -0,0 +1,53 @@
+#version 330
+
+in vec2 fragCoord;
+out vec4 fragColor;
+
+// bar values. defaults to left channels first (low to high), then right (high
+// to low).
+uniform float bars[512];
+
+uniform int bars_count;  // number of bars (left + right) (configurable)
+uniform int bar_width;   // bar width (configurable), not used here
+uniform int bar_spacing; // space bewteen bars (configurable)
+
+uniform vec3 u_resolution; // window resolution
+
+// colors, configurable in cava config file (r,g,b) (0.0 - 1.0)
+uniform vec3 bg_color; // background color
+uniform vec3 fg_color; // foreground color
+
+uniform int gradient_count;
+uniform vec3 gradient_colors[8]; // gradient colors
+
+uniform sampler2D inputTexture; // Texture from the first render pass
+
+vec3 normalize_C(float y, vec3 col_1, vec3 col_2, float y_min, float y_max) {
+  // create color based on fraction of this color and next color
+  float yr = (y - y_min) / (y_max - y_min);
+  return col_1 * (1.0 - yr) + col_2 * yr;
+}
+
+void main() {
+  // find which bar to use based on where we are on the y axis
+  int bar = int(bars_count * fragCoord.y);
+  float y = bars[bar];
+  float band_size = 1.0 / float(bars_count);
+  float current_band_min = bar * band_size;
+  float current_band_max = (bar + 1) * band_size;
+
+  int hist_length = 512;
+  float win_size = 1.0 / hist_length;
+
+  if (fragCoord.x > 1.0 - win_size) {
+
+    if (fragCoord.y > current_band_min && fragCoord.y < current_band_max) {
+
+      fragColor = vec4(fg_color * y, 1.0);
+    }
+  } else {
+    vec2 offsetCoord = fragCoord;
+    offsetCoord.x += float(win_size);
+    fragColor = texture(inputTexture, offsetCoord);
+  }
+}
\ No newline at end of file
diff --git a/dot-config/cava/shaders/winamp_line_style_spectrum.frag b/dot-config/cava/shaders/winamp_line_style_spectrum.frag
new file mode 100644 (file)
index 0000000..375ff27
--- /dev/null
@@ -0,0 +1,112 @@
+#version 330
+
+// Emulate the "line style" spectrum analyzer from Winamp 2.
+// Try this config for a demonstration:
+
+/*
+[general]
+bar_width = 2
+bar_spacing = 0
+higher_cutoff_freq = 22000
+
+[output]
+method = sdl_glsl
+channels = mono
+fragment_shader = winamp_line_style_spectrum.frag
+
+[color]
+background = '#000000'
+gradient = 1
+gradient_color_1 = '#319C08'
+gradient_color_2 = '#29CE10'
+gradient_color_3 = '#BDDE29'
+gradient_color_4 = '#DEA518'
+gradient_color_5 = '#D66600'
+gradient_color_6 = '#CE2910'
+
+[smoothing]
+noise_reduction = 10
+*/
+
+in vec2 fragCoord;
+out vec4 fragColor;
+
+// bar values. defaults to left channels first (low to high), then right (high to low).
+uniform float bars[512];
+
+uniform int bars_count;    // number of bars (left + right) (configurable)
+uniform int bar_width;    // bar width (configurable), not used here
+uniform int bar_spacing;    // space bewteen bars (configurable)
+
+uniform vec3 u_resolution; // window resolution
+
+//colors, configurable in cava config file (r,g,b) (0.0 - 1.0)
+uniform vec3 bg_color; // background color
+uniform vec3 fg_color; // foreground color
+
+uniform int gradient_count;
+uniform vec3 gradient_colors[8]; // gradient colors
+
+vec3 normalize_C(float y,vec3 col_1, vec3 col_2, float y_min, float y_max)
+{
+    //create color based on fraction of this color and next color
+    float yr = (y - y_min) / (y_max - y_min);
+    return col_1 * (1.0 - yr) + col_2 * yr;
+}
+
+void main()
+{
+    // find which bar to use based on where we are on the x axis
+    float x = u_resolution.x * fragCoord.x;
+    int bar = int(bars_count * fragCoord.x);
+
+    //calculate a bar size
+    float bar_size = u_resolution.x / bars_count;
+
+    //the y coordinate is stretched by 4X to resemble Winamp
+    float y =  min(bars[bar] * 4.0, 1.0);
+
+    // make sure there is a thin line at bottom
+    if (y * u_resolution.y < 1.0)
+    {
+      y = 1.0 / u_resolution.y;
+    }
+
+    vec4 bar_color;
+
+    if (gradient_count == 0)
+    {
+        bar_color = vec4(fg_color,1.0);
+    }
+    else
+    {
+        //find color in the configured gradient for the top of the bar
+        int color = int((gradient_count - 1) * y);
+
+        //find where on y this and next color is supposed to be
+        float y_min = float(color) / (gradient_count - 1.0);
+        float y_max = float(color + 1) / (gradient_count - 1.0);
+
+        //make a solid color for the entire bar
+        bar_color = vec4(normalize_C(y, gradient_colors[color], gradient_colors[color + 1], y_min, y_max), 1.0);
+    }
+
+
+    //draw the bar up to current height
+    if (y > fragCoord.y)
+    {
+        //make some space between bars based on settings
+        if (x > (bar + 1) * (bar_size) - bar_spacing)
+        {
+            fragColor = vec4(bg_color,1.0);
+        }
+        else
+        {
+            fragColor = bar_color;
+        }
+    }
+    else
+    {
+        fragColor = vec4(bg_color,1.0);
+    }
+}
\ No newline at end of file
diff --git a/dot-config/cava/waybarconfig b/dot-config/cava/waybarconfig
new file mode 100644 (file)
index 0000000..9a3e126
--- /dev/null
@@ -0,0 +1,209 @@
+## Configuration file for CAVA. Default values are commented out. Use either ';' or '#' for commenting.
+
+
+[general]
+
+# Smoothing mode. Can be 'normal', 'scientific' or 'waves'. DEPRECATED as of 0.6.0
+; mode = normal
+
+# Accepts only non-negative values.
+framerate = 30
+
+# 'autosens' will attempt to decrease sensitivity if the bars peak. 1 = on, 0 = off
+# new as of 0.6.0 autosens of low values (dynamic range)
+# 'overshoot' allows bars to overshoot (in % of terminal height) without initiating autosens. DEPRECATED as of 0.6.0
+autosens = 1
+; overshoot = 20
+
+# Manual sensitivity in %. If autosens is enabled, this will only be the initial value.
+# 200 means double height. Accepts only non-negative values.
+; sensitivity = 100
+
+# The number of bars (0-200). 0 sets it to auto (fill up console).
+# Bars' width and space between bars in number of characters.
+bars = 24
+bar_width = 1
+bar_spacing = 0
+# bar_height is only used for output in "noritake" format
+; bar_height = 32
+
+# For SDL width and space between bars is in pixels, defaults are:
+; bar_width = 20
+; bar_spacing = 5
+
+
+# Lower and higher cutoff frequencies for lowest and highest bars
+# the bandwidth of the visualizer.
+# Note: there is a minimum total bandwidth of 43Mhz x number of bars.
+# Cava will automatically increase the higher cutoff if a too low band is specified.
+lower_cutoff_freq = 43
+higher_cutoff_freq = 19995
+
+
+# Seconds with no input before cava goes to sleep mode. Cava will not perform FFT or drawing and
+# only check for input once per second. Cava will wake up once input is detected. 0 = disable.
+sleep_timer = 5
+
+
+[input]
+
+# Audio capturing method. Possible methods are: 'pulse', 'alsa', 'fifo', 'sndio' or 'shmem'
+# Defaults to 'pulse', 'alsa' or 'fifo', in that order, dependent on what support cava was built with.
+#
+# All input methods uses the same config variable 'source'
+# to define where it should get the audio.
+#
+# For pulseaudio 'source' will be the source. Default: 'auto', which uses the monitor source of the default sink
+# (all pulseaudio sinks(outputs) have 'monitor' sources(inputs) associated with them).
+#
+# For alsa 'source' will be the capture device.
+# For fifo 'source' will be the path to fifo-file.
+# For shmem 'source' will be /squeezelite-AA:BB:CC:DD:EE:FF where 'AA:BB:CC:DD:EE:FF' will be squeezelite's MAC address
+method = pipewire
+source = auto
+
+; method = alsa
+; source = hw:Loopback,1
+
+# method = fifo
+# source = /tmp/mpd.fifo
+sample_rate = 41000
+sample_bits = 16
+
+; method = shmem
+; source = /squeezelite-AA:BB:CC:DD:EE:FF
+
+; method = portaudio
+; source = auto
+
+
+[output]
+
+# Output method. Can be 'ncurses', 'noncurses', 'raw', 'noritake' or 'sdl'.
+# 'noncurses' uses a custom framebuffer technique and prints only changes
+# from frame to frame in the terminal. 'ncurses' is default if supported.
+#
+# 'raw' is an 8 or 16 bit (configurable via the 'bit_format' option) data
+# stream of the bar heights that can be used to send to other applications.
+# 'raw' defaults to 200 bars, which can be adjusted in the 'bars' option above.
+#
+# 'noritake' outputs a bitmap in the format expected by a Noritake VFD display
+#  in graphic mode. It only support the 3000 series graphical VFDs for now.
+#
+# 'sdl' uses the Simple DirectMedia Layer to render in a graphical context.
+method = ncurses
+
+# Visual channels. Can be 'stereo' or 'mono'.
+# 'stereo' mirrors both channels with low frequencies in center.
+# 'mono' outputs left to right lowest to highest frequencies.
+# 'mono_option' set mono to either take input from 'left', 'right' or 'average'.
+# set 'reverse' to 1 to display frequencies the other way around.
+channels = stereo
+# channels = mono
+; mono_option = average
+; reverse = 0
+
+# Raw output target. A fifo will be created if target does not exist.
+raw_target = /dev/stdout
+
+# Raw data format. Can be 'binary' or 'ascii'.
+data_format = ascii
+
+# Binary bit format, can be '8bit' (0-255) or '16bit' (0-65530).
+; bit_format = 16bit
+
+# Ascii max value. In 'ascii' mode range will run from 0 to value specified here
+ascii_max_range = 9
+
+# Ascii delimiters. In ascii format each bar and frame is separated by a delimiters.
+# Use decimal value in ascii table (i.e. 59 = ';' and 10 = '\n' (line feed)).
+; bar_delimiter = 59
+; frame_delimiter = 10
+bar_delimiter = 0
+
+# sdl window size and position. -1,-1 is centered.
+; sdl_width = 1000
+; sdl_height = 500
+; sdl_x = -1
+; sdl_y= -1
+
+;xaxis = frequency
+
+[color]
+
+# Colors can be one of seven predefined: black, blue, cyan, green, magenta, red, white, yellow.
+# Or defined by hex code '#xxxxxx' (hex code must be within ''). User defined colors requires
+# ncurses output method and a terminal that can change color definitions such as Gnome-terminal or rxvt.
+# if supported, ncurses mode will be forced on if user defined colors are used.
+# default is to keep current terminal color
+; background = default
+; foreground = default
+
+# SDL only support hex code colors, these are the default:
+; background = '#111111'
+; foreground = '#33cccc'
+
+
+# Gradient mode, only hex defined colors (and thereby ncurses mode) are supported,
+# background must also be defined in hex  or remain commented out. 1 = on, 0 = off.
+# You can define as many as 8 different colors. They range from bottom to top of screen
+gradient = 1
+; gradient_count = 8
+; gradient_color_1 = '#59cc33'
+; gradient_color_2 = '#80cc33'
+; gradient_color_3 = '#a6cc33'
+; gradient_color_4 = '#cccc33'
+; gradient_color_5 = '#cca633'
+; gradient_color_6 = '#cc8033'
+; gradient_color_7 = '#cc5933'
+; gradient_color_8 = '#cc3333'
+
+# background = '#191724'
+gradient = 1
+gradient_count = 6
+gradient_color_1 = '#31748f'
+gradient_color_2 = '#9ccfd8'
+gradient_color_3 = '#c4a7e7'
+gradient_color_4 = '#ebbcba'
+gradient_color_5 = '#f6c177'
+gradient_color_6 = '#eb6f92'
+
+
+[smoothing]
+
+# Percentage value for integral smoothing. Takes values from 0 - 100.
+# Higher values means smoother, but less precise. 0 to disable.
+# DEPRECATED as of 0.8.0, use noise_reduction instead
+integral = 0.77
+
+# Disables or enables the so-called "Monstercat smoothing" with or without "waves". Set to 0 to disable.
+monstercat = 0
+waves = 0
+
+# Set gravity percentage for "drop off". Higher values means bars will drop faster.
+# Accepts only non-negative values. 50 means half gravity, 200 means double. Set to 0 to disable "drop off".
+# DEPRECATED as of 0.8.0, use noise_reduction instead
+; gravity = 100
+
+# In bar height, bars that would have been lower that this will not be drawn.
+# DEPRECATED as of 0.8.0
+; ignore = 0
+
+# Noise reduction, float 0 - 1. default 0.77
+# the raw visualization is very noisy, this factor adjusts the integral and gravity filters to keep the signal smooth
+# 1 will be very slow and smooth, 0 will be fast but noisy.
+noise_reduction = 0.77
+
+
+[eq]
+
+# This one is tricky. You can have as much keys as you want.
+# Remember to uncomment more then one key! More keys = more precision.
+# Look at readme.md on github for further explanations and examples.
+# DEPRECATED as of 0.8.0 can be brought back by popular request, open issue at:
+# https://github.com/karlstav/cava
+# 1 = 1.6 # bass
+# 2 = 1.4
+# 3 = 1.2 # midtone
+# 4 = 1.2
+# 5 = 1 # treble