# foobar2k-syntax Here are a few things I've coded for Foobar2000's formatting for various things. ## Columns ### Tech Specs The Tech Specs column just displays some basic information; codec, rate/bitdepth, bitrate, and possibly HDCD info. This converts sample rates in to kHz/MHz despite foobar2000 syntax not supporting decimal. ``` $if($stricmp($right(%filename_ext%,3),iso),%codec%/SACD,%codec%) | $ifgreater(%samplerate%,1000000,$insert($div(%samplerate%,100000),'.',$sub($len($div(%samplerate%,100000)),1)) MHz,$ifgreater($mod(%samplerate%,1000),0,$insert($div(%samplerate%,100),'.',$sub($len($div(%samplerate%,100)),1)) kHz,$div(%samplerate%,1000) kHz))$if($info(bitspersample),/$info(bitspersample)-$ifgreater($info(bitspersample),1,bits,bit)) | %bitrate% kbps) | $if($info(hdcd),'(HDCD:',) $if(%__hdcd%,PE: %__hdcd_peak_extend% LLE: %__hdcd_gain% TF: %__hdcd_transient_filter%')') ``` ### 75fps Timecode Displays the 75fps timecode used in Redbook CD authoring and CUE files. ``` $puts(frm,$div(%samplerate%,75))$puts(rem,$sub(%length_samples%,$mul(%length_seconds_fp%,%samplerate%)))$left(%length_ex%,$sub($len(%length_ex%),4)):$num($div($get(rem),$get(frm)),2)) ``` ## Discord Rich Presence The top line displays "Artist - Track Name (From: Album)" Bottom line displays Codec/samplerate-bitdeth/bitrate. Formatted for kHz/MHz. Will skip album if not tagged. Will also display "Super Audio CD" for SACD ISO playback. ### Top Line ``` [%artist% - ]$if(%title%,%title%,%_filename%) $if(%album%,'['From: %album%']',) ``` ### Bottom Line ``` $if($stricmp($right(%filename_ext%,3),iso),%codec%/SACD,%codec%) | $ifgreater(%samplerate%,1000000,$insert($div(%samplerate%,100000),'.',$sub($len($div(%samplerate%,100000)),1)) MHz,$ifgreater($mod(%samplerate%,1000),0,$insert($div(%samplerate%,100),'.',$sub($len($div(%samplerate%,100)),1)) kHz,$div(%samplerate%,1000) kHz))$if($info(bitspersample),/$info(bitspersample)-$ifgreater($info(bitspersample),1,bits,bit)) | %bitrate% kbps) ``` ## Winamp API Emulation I use Winamp API Emulation with a HexChat plugin so I can spam rooms with junk I'm playing. The Hexchat plugin is set to relay whatever the API emulator is emulating the title bar as. I use this chunk of syntax code for it: ``` [%artist% - ]$if(%title%,%title%,%_filename%) $if(%album%,'('From: %album%')',) '['%length% | $ifgreater(%samplerate%,1000000,$insert($div(%samplerate%,100000),'.',$sub($len($div(%samplerate%,100000)),1))MHz,$ifgreater($mod(%samplerate%,1000),0,$insert($div(%samplerate%,100),'.',$sub($len($div(%samplerate%,100)),1))kHz,$div(%samplerate%,1000)kHz))$if($info(bitspersample),/$info(bitspersample)-$ifgreater($info(bitspersample),1,bits,bit)) | %bitrate%kbps | $if($stricmp($right(%filename_ext%,3),iso),%codec%/Super Audio CD,%codec%)']' ``` It sends these as /me actions to the chat room: ``` * nq4t np: Cannons - Come Alive (From: Fever Dream) [3:22 | 44.1kHz/16-bits | 965kbps | FLAC] * nq4t np: Gordon Lightfoot - Sundown (From: Sundown) [3:37 | 192kHz/24-bits | 5208kbps | FLAC] * nq4t np: Rage Against The Machine - 02 Bulls On Parade (From: Evil Empire) [3:51 | 2.8MHz/1-bit | 5645kbps | DSD64/Super Audio CD] ```