Blog: 2026-05-02

From razwiki
Revision as of 02:17, 2 May 2026 by Razzi (talk | contribs) (Created page with "<pre> set -U mid_time $last_time set -U last_time $now_time set -U now_time (gdate +%s.%3N) set diff (math $now_time - $last_time) set diff2 (math $last_time - $mid_time) set avg (math "($diff + $diff2) / 2") set bps (math 1 / $avg) set bpm (math "$bps * 60") # echo -n $mid_time $last_time $now_time if test $bpm -gt 55 echo -n "$bpm " end </pre> bpm counter in the terminal. Might end up popping up when I don't want it...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
    set -U mid_time $last_time
    set -U last_time $now_time
    set -U now_time (gdate +%s.%3N)

    set diff (math $now_time - $last_time)
    set diff2 (math $last_time - $mid_time)
    set avg (math "($diff + $diff2) / 2")
    set bps (math 1 / $avg)
    set bpm (math "$bps * 60")
    # echo -n $mid_time $last_time $now_time
    if test $bpm -gt 55
        echo -n "$bpm "
    end

bpm counter in the terminal. Might end up popping up when I don't want it. Also it's a naive 3-value diff average, doesn't stop if there's a break