I tweaked this a bit to deal with effective bit rates higher than 3 places. (999)
I also did away with the CBR table.
$noop(############## Determine Bit Rate Integer Value #############)
$if($eq(%_devMode%,1),$set(_intBitRate,$rreplace(%_biitrate%,\\.\\d*\$,)),$set(_intBitRate,$rreplace(%_bitrate%,\\.\\d*\$,)))
$if($eq(%_devMode%,1),$set(_bitRateSpeed,%_saample_rate%KHz),$set(_bitRateSpeed,%_sample_rate%KHz))
$if($eq(%_devMode%,1),$set(_bitsPerSample,[%_biits_per_sample%]bit),$set(_bitsPerSample,[%_bits_per_sample%]bit))
$if($eq(%_devMode%,1),$set(_audioChannels,%_chaannels%ch),$set(_audioChannels,%_channels%ch))
$if($eq(%_devMode%,1),$set(_titleForFilename,%_tiitle%),$set(_titleForFilename,%title%))
$set(_bitRateType,$if($eq_any(%_intBitRate%,320,256,224,192,160,128,112,96,80,64,48,40,32,24,16,8),CBR$set(_cbrRateValue,%_intBitRate%)$set(_fileCBRRate,%_intBitRate%),VBR$set(_vbrRateValue,%_intBitRate%)))
$noop(Bitrate factors of 8.0 are most likely CBR with the remainder being VBR)
$if($eq(%_bitRateType%,VBR),
$if($gt(%_vbrRateValue%,339),$set(_fileVBRRate,320+),
$if($gt(%_vbrRateValue%,319),$set(_fileVBRRate,320),
$if($gt(%_vbrRateValue%,260),$set(_fileVBRRate,V0+),
$if($gt(%_vbrRateValue%,220),$set(_fileVBRRate,V0),
$if($gt(%_vbrRateValue%,191),$set(_fileVBRRate,V1),
$if($gt(%_vbrRateValue%,170),$set(_fileVBRRate,V2),
$if($gt(%_vbrRateValue%,150),$set(_fileVBRRate,V3),
$if($gt(%_vbrRateValue%,140),$set(_fileVBRRate,V4),
$if($gt(%_vbrRateValue%,130),$set(_fileVBRRate,V5),
$if($gt(%_vbrRateValue%,120),$set(_fileVBRRate,V6),
$set(_fileVBRRate,%_intBitRate%)
)))))))))))
$noop(######### File Naming Structure Variables Complete #########)
$noop(★ Pathname Generation Starts Here ★)
To Display values higher than what I’m calling ‘V0+’, 320, etc. You’ll need to add in an additional if-greater-than
line with it’s accompanying parenthesis closing on the )))))))
line… and modify the ranges as desired.
Since Bit Rate is most commonly associated with MP3, I’m just accounting for those effective ranges when I’m applying the value to other than MP3 encoded files.
It’s generally assumed that an M4A of similar BR Value is going to be of no less quality than the MP3 format.
Of course, all of this only absolutely comparable if you have control of the bit stream from the moment it’s sourced and the quality of that source.
You can encode a flexi-disc off the back of a cereal box using an apparatus consisting of a Dixie Cup attached to a sewing pin … being manually dragged around in a circle on the medium… using a full on Lossless format and it’s still going to sound just as atrocious. e.g.: Overkill.
So we just have to ‘trust’ our ‘sources’ of data streams … that someone didn’t take a 16K bit rate file and transcode it to 128K
$noop(############## Determine Bit Rate Integer Value #############)
$if($eq(%_devMode%,1),$set(_intBitRate,$rreplace(%_biitrate%,\\.\\d*\$,)),$set(_intBitRate,$rreplace(%_bitrate%,\\.\\d*\$,)))
$if($eq(%_devMode%,1),$set(_bitRateSpeed,%_saample_rate%KHz),$set(_bitRateSpeed,%_sample_rate%KHz))
$if($eq(%_devMode%,1),$set(_bitsPerSample,[%_biits_per_sample%]bit),$set(_bitsPerSample,[%_bits_per_sample%]bit))
$if($eq(%_devMode%,1),$set(_audioChannels,%_chaannels%ch),$set(_audioChannels,%_channels%ch))
$if($eq(%_devMode%,1),$set(_titleForFilename,%_tiitle%),$set(_titleForFilename,%title%))
$set(_bitRateType,$if($eq_any(%_intBitRate%,320,256,224,192,160,128,112,96,80,64,48,40,32,24,16,8),CBR$set(_cbrRateValue,%_intBitRate%)$set(_fileCBRRate,%_intBitRate%),VBR$set(_vbrRateValue,%_intBitRate%)))
$noop(Bitrate factors of 8.0 are most likely CBR with the remainder being VBR)
$if($eq(%_bitRateType%,VBR),
$if($gt(%_vbrRateValue%,339),$set(_fileVBRRate,320+),
$if($gt(%_vbrRateValue%,319),$set(_fileVBRRate,320),
$if($gt(%_vbrRateValue%,260),$set(_fileVBRRate,V0+),
$if($gt(%_vbrRateValue%,220),$set(_fileVBRRate,V0),
$if($gt(%_vbrRateValue%,191),$set(_fileVBRRate,V1),
$if($gt(%_vbrRateValue%,170),$set(_fileVBRRate,V2),
$if($gt(%_vbrRateValue%,150),$set(_fileVBRRate,V3),
$if($gt(%_vbrRateValue%,140),$set(_fileVBRRate,V4),
$if($gt(%_vbrRateValue%,130),$set(_fileVBRRate,V5),
$if($gt(%_vbrRateValue%,120),$set(_fileVBRRate,V6),
$if($gt(%_vbrRateValue%,95),$set(_fileVBRRate,V7),
$if($gt(%_vbrRateValue%,69),$set(_fileVBRRate,V8),
$if($gt(%_vbrRateValue%,44),$set(_fileVBRRate,V9),
$set(_fileVBRRate,%_intBitRate%)
))))))))))))))
$noop(######### File Naming Structure Variables Complete #########)
$noop(★ Pathname Generation Starts Here ★)
I added an additional line denoting ‘320’ vs. greater than 320 as well as filled in the lower values of V7,V8,V9 and anything lower just shows the actual number.
Just fill out the table as desired.
The “Dev Mode” is so you can see what your script is doing while using the Scripting Editor on the File Naming Option Pane.
The VBR Values correspond with LAME encoding presets. For CBR, the only values we actually care about per the specification are those ones. Anything over 320 you’ll need to make an entry in the VBR table to have them show the Integer value.
$if($gt(%_vbrRateValue%,500),$set(_fileVBRRate,%_intBitRate%)
If you want to see the actual file rate including anything past the decimal then put:
$if($gt(%_vbrRateValue%,500),$set(_fileVBRRate,%_bitrate%)
I’ve added a whole bunch of stuff for final sorting to the
MBP YA Magic-Script that does more stuff too.
script since what was posted above. It’s currently v2.6a