Skip to content

Instantly share code, notes, and snippets.

@urbanhusky
Last active December 23, 2016 16:53
Show Gist options
  • Save urbanhusky/9dc836a1e52df148e6ec05e158421174 to your computer and use it in GitHub Desktop.
Save urbanhusky/9dc836a1e52df148e6ec05e158421174 to your computer and use it in GitHub Desktop.
Foobar 2000 Columns UI style script for a column that displays dynamic range similar to http://dr.loudness-war.info/
// For there to be any display/colouration of the dynamic range, there needs to be a DYNAMIC RANGE tag set
// This can be generated with the foobar 2000 component from http://dr.loudness-war.info/
// Dynamic range can be a value between 1 (really bad) and 20 (really good)
//
// This style partitions the dynamic range into 3 bands: bad, in-between and good.
// The colours for in-between are blended between bad and good
// *** CUSTOMISATION STARTS HERE ***
// Set your preferred colours below :) - only edit the lines that start with $puts(
// Colour notation is: red,green,blue or red,green,blue,red,green,blue
// First set of rgb is for normal text, second set for highlighted text (if you want to set it)
// Examples:
// $rgb(255,0,0) is pure red
// $rgb(255,0,0,255,0,0) is pure red, regardless if highlighted or not
// Important: do not add any spaces!
// Colour for bad DR
$puts(bad,$rgb(192,0,0))
// Colur for good DR
$puts(good,$rgb(0,255,0))
// Set where the transition from bad to good starts. This is a dynamic range value (anything below this is 100% bad)
$puts(transitionstart,8)
// Set where the transition from bad to good ends. This is a dynamic range value (anything above this 100% good)
$puts(transitionend,13)
// *** CUSTOMISATION ENDS HERE ***
// Here be dragons :)
// Calculation for the 3 rating bands
// values for the blending.
// The result must be inclusive for transitionstart, i.e. not yield 0 for transitionstart
$puts(result,$add($sub([%DYNAMIC RANGE%],$get(transitionstart)),1))
// The total for the blend must be so that transitionend is inclusive in the blend (plus respect the +1 from the result to offset it)
$puts(total,$add($sub($get(transitionend),$get(transitionstart)),2))
// possbile bug with blend: values outside 0 and total do not yield color1 or color2
// Fix: values below 0 are 0
$puts(result,$max($get(result),0))
// Fix: values above "total" are total
$puts(result,$min($get(result),$get(total)))
// Set colour blend
$puts(fg,$blend($get(bad),$get(good),$get(result),$get(total)))
// apply
$set_style(text,$get(fg))
@urbanhusky
Copy link
Author

New version allows you to set where the blending between good and bad DR happens

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment