<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Brightness on Carlos Vaz</title>
    <link>https://carlosvaz.com/tags/brightness/</link>
    <description>Recent content in Brightness on Carlos Vaz</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-US</language>
    <managingEditor>carlos@carjorvaz.com (Carlos Vaz)</managingEditor>
    <webMaster>carlos@carjorvaz.com (Carlos Vaz)</webMaster>
    <lastBuildDate>Sun, 28 Apr 2024 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://carlosvaz.com/tags/brightness/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Exponential/logarithmic adjustment scales for audio and brightness in Linux</title>
      <link>https://carlosvaz.com/posts/exponential-logarithmic-adjustment-scales-for-audio-and-brightness-in-linux/</link>
      <pubDate>Sun, 28 Apr 2024 00:00:00 +0000</pubDate><author>carlos@carjorvaz.com (Carlos Vaz)</author>
      <guid>https://carlosvaz.com/posts/exponential-logarithmic-adjustment-scales-for-audio-and-brightness-in-linux/</guid>
      <description>&lt;p&gt;In my Human-Machine Interfaces course at university, I learned that humans many times perceive changes better in exponential increments as opposed to linear increments.&lt;/p&gt;&#xA;&lt;p&gt;Allegedly, Apple is aware of this, although I couldn&amp;rsquo;t easily find concrete confirmation online, and implements audio and brightness increments exponentially. This perhaps explains why the brightness and volume sliders in macOS don&amp;rsquo;t have percentages next to them, as the strange steps could freak out more casual users.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>In my Human-Machine Interfaces course at university, I learned that humans many times perceive changes better in exponential increments as opposed to linear increments.</p>
<p>Allegedly, Apple is aware of this, although I couldn&rsquo;t easily find concrete confirmation online, and implements audio and brightness increments exponentially. This perhaps explains why the brightness and volume sliders in macOS don&rsquo;t have percentages next to them, as the strange steps could freak out more casual users.</p>
<p>Now that I&rsquo;m returning to Linux, I was getting frustrated with this not being the default behaviour, possibly because the developers are not aware of this phenomenon.
Both in brightness and audio, at higher values I needed many steps to perceive changes and at lower values it was always either too high or too low.</p>
<h2 id="audio-volume">Audio volume</h2>
<p>When looking at the documentation for the sound block in i3status-rust, there was this option of <code>natural_mapping</code>, which enabled this logarithmic/exponential behaviour in ALSA.
I was not aware that ALSA was capable of that, so it seemed like good news. Now I just needed the same behaviour in PulseAudio/PipeWire, which turned out to not be so easy.</p>
<p>I finally found a thread on Reddit where a user commented that you can change the audio in PulseAudio by dBs instead of percentage points in the linear scale.
As decibels have an exponential/logarithmic scale, this solved my problem.</p>
<p>Then, to have this behaviour, I mapped the <code>XF86AudioLowerVolume</code> and <code>XF86AudioRaiseVolume</code> keys in my window manager to the following, respectively:</p>





<pre tabindex="0"><code class="language-nil" data-lang="nil">pactl set-sink-volume @DEFAULT_SINK@ +2dB&#39;&#34;;
pactl set-sink-volume @DEFAULT_SINK@ -2dB&#39;&#34;;</code></pre><h2 id="backlight-brightness">Backlight brightness</h2>
<p>As for backlight, I&rsquo;ve had this behaviour for a few years and can&rsquo;t recall where I originally found it.
The trick is to use a program for managing the backlight brightness that can take multipliers as arguments, like <a href="https://haikarainen.github.io/light/">light</a>.</p>
<p>Again, I mapped the <code>XF86MonBrightnessDown</code> and <code>XF86MonBrightnessUp</code> keys to:</p>





<pre tabindex="0"><code class="language-nil" data-lang="nil">light -T 0.618&#34;;
light -T 1.618&#34;;</code></pre><h2 id="references">References</h2>
<ul>
<li><a href="https://www.reddit.com/r/linux/comments/18ka8ok/comment/kdrjxbs/">https://www.reddit.com/r/linux/comments/18ka8ok/comment/kdrjxbs/</a></li>
</ul>
]]></content:encoded>
    </item>
  </channel>
</rss>
