• WANTED: Happy members who like to discuss audio and other topics related to our interest. Desire to learn and share knowledge of science required. There are many reviews of audio hardware and expert members to help answer your questions. Click here to have your audio equipment measured for free!

Offline Loudness (LUFS) plotting

OP
L5730

L5730

Addicted to Fun and Learning
Joined
Oct 6, 2018
Messages
670
Likes
439
Location
East of England
Adding these two for plotting true peaks.
Code:
               '' using ($0/10):( ($6>$7?$6:$7)<0?($6>$7?$6:$7):0 ) with lines lc rgb '#00ff30' lw 1 title 'truePeak', \
               '' using ($0/10):( ($6>$7?$6:$7)>0?($6>$7?$6:$7):0 ) with lines lc rgb '#ff0000' lw 1 title 'truePeak', \

The above takes the highest true peak sample value of the left/right pair. Those at or over 0 dBFS are red, those under are lime green (in this case).
See the horizontal line at 0 dBFS problem, and tiny little indicators of overs.

Data could be formatted before handing over to gnuplot, creating an additional 2 columns of data in the csv. One column for true peak at of over 0 dBFS else "-", and the other for values under 0 dBFS else "-". The plot should then have gaps.

LoudnessPlot.png
 

BethHarmon

Member
Joined
Mar 7, 2021
Messages
12
Likes
0
Thanks so much!

We found a potential issue with the ebur128 tool I was using in that there's an odd high-pass filter line that when commented out then gives correct -1 dBTP readings. However, it turns out that it might not be a bug at all! It takes DC offset into account and basically shows the absolute worst case for peaks. If you don't know the tool, you can find it in the ebumeter package available through most linux distros.
 

BethHarmon

Member
Joined
Mar 7, 2021
Messages
12
Likes
0
Adding these two for plotting true peaks.
Hmm, I get errors after adding these two lines:
Code:
Line |
143 |  "               '' using ($0/10):( ($6>$7?$6:$7)<0?($6>$7?$6:$7):0 )  …
     |                                            ~~~
     | Variable reference is not valid. ':' was not followed by a
     | valid variable name character. Consider using ${} to delimit
     | the name.

I also added quotation marks to the front and back to match the other entries under "plot \"...
 
OP
L5730

L5730

Addicted to Fun and Learning
Joined
Oct 6, 2018
Messages
670
Likes
439
Location
East of England
Code:
"               '' using (`$0/10):( (`$6>`$7?`$6:`$7)<0?(`$6>`$7?`$6:`$7):0 ) with lines lc rgb '#00ff30' lw 1 title 'truePeak', \"
"               '' using (`$0/10):( (`$6>`$7?`$6:`$7)>0?(`$6>`$7?`$6:`$7):0 ) with lines lc rgb '#ff0000' lw 1 title 'truePeak', \"

Apologies. I was pasting the code from the gnuplot instructions text file, rather than the powershell script that creates the instruction file.
The above should now work, all variables now escaped with back ticks, as the PS is here.

The Integrated, Short-term and Momentary starting from silence can be 'cleaned up' when defining the csv data, around line 52:
Just remove -120.7 LU entries, and Integrated at or below -70.0 LUFS.
Code:
        $Momentary = if($array_tmsir[1] -eq "-120.7"){"-"}else{$array_tmsir[1]}
        $Short = if($array_tmsir[2] -eq "-120.7"){"-"}else{$array_tmsir[2]}
        $Integrated = if([decimal]($array_tmsir[3]) -le "-70.0"){"-"}else{$array_tmsir[3]}


LoudnessPlot.png
 
OP
L5730

L5730

Addicted to Fun and Learning
Joined
Oct 6, 2018
Messages
670
Likes
439
Location
East of England
I'd like to process the data for the PLR area. I have a rough colour gradient, but with so many tiny data points it's hard to see if it's dynamic or less dynamic - red shows up easier than green, and orange looks reddish.

Something more akin to Ian Shepherd's (Meterplugs) Dynameter plugin would be nice. Dynameter appears to use PSR (peak to short-term ratio) for it's coloured history plot. This seems to be a better option than PMR currently employed.
Your line 139:
Code:
"               '' using (`$0/10):( (`$6>`$7?(`$6-`$2):(`$7-`$2)) ) : ( (`$6>`$7?(`$6-`$2):(`$7-`$2)) ) with boxes lc palette fs transparent solid 0.1 noborder axes x1y2 title 'tPLR', \"
replace $2 (momentary data column) with $3 (short term data column).

I think some smoothing is in order to make it easier to read. Probably easier to use a sliding averaging window in PS than get gnuplot to manipulate the data.
 

BethHarmon

Member
Joined
Mar 7, 2021
Messages
12
Likes
0
Nicely done. I'm trying hard to keep up with your changes ;) I see you removed the 0 dB red line (I find it is overlapping with the text labels).
 

BethHarmon

Member
Joined
Mar 7, 2021
Messages
12
Likes
0
Also, how to remove the tPLR label from showing? Deleting "title 'tPLR' did not do nice things and deleted half the rest too!

EDIT: title '' did the trick!
 
OP
L5730

L5730

Addicted to Fun and Learning
Joined
Oct 6, 2018
Messages
670
Likes
439
Location
East of England
I messed about with that true peak plot. I have two independent plots now, one for overs one for anything that is below 0 dBFS.
As there is no data in the overs column, gnuplot throws a small warning/error, but it really means there is no data to plot, so doesn't.

In the case of this file, true peak is -1.1 dBFS, so no overs. No red line because of that.


Playing around with true peak plotting:

Splintering off overs and non-overs (unders?) in the csv data building section.

Code:
        $tpk = if([decimal]$tpk_l -gt [decimal]$tpk_r){$tpk_l}else{$tpk_r}
        $over = if([decimal]$tpk -ge "0"){$tpk}else{"-"}
        $under = if([decimal]$tpk -lt "0"){$tpk}else{"-"}

Add these two ($over and $under) to the array of data for each line of the csv creation. Address them as $8 and $9 in the gnuplot data reading. eg.

Code:
"               '' using (`$0/10):9 with lines lc rgb '#00ff30' lw 1 title 'truePeak', \"
"               '' using (`$0/10):8 with lines lc rgb '#ff0000' lw 1 title 'truePeak', \"

That replaces a cluster of greater than, less than, if, else, faff in the gnuplot graphing lines.
These two to replace with the above using columns 8 and 9 instead:
Code:
"               '' using (`$0/10):( (`$6>`$7?`$6:`$7)<0?(`$6>`$7?`$6:`$7):0 ) with lines lc rgb '#00ff30' lw 1 title 'truePeak', \"
"               '' using (`$0/10):( (`$6>`$7?`$6:`$7)>0?(`$6>`$7?`$6:`$7):0 ) with lines lc rgb '#ff0000' lw 1 title 'truePeak', \"

The downside here is that both data sets will have empty values, and gnuplot will just draw a line joining the data points that exist (not "-"). This can be a bit hard to read. I did try having gnuplot change colour when above the 0 dBFS line, but it just didn't work as expected.
 

danadam

Addicted to Fun and Learning
Joined
Jan 20, 2017
Messages
976
Likes
1,519
The downside here is that both data sets will have empty values, and gnuplot will just draw a line joining the data points that exist (not "-"). This can be a bit hard to read. I did try having gnuplot change colour when above the 0 dBFS line, but it just didn't work as expected.
How about something like that:
Code:
0.0   0.99   0.00
0.2   0.98   0.38
0.4   0.92   0.71
0.6   0.83   0.93
0.8   0.70   0.99
1.0   0.54   0.90
1.2   0.37   0.67
1.4   0.18   0.33
1.6  -0.01  -0.05
1.8  -0.21  -0.44
2.0  -0.40  -0.75
2.2  -0.58  -0.95
2.4  -0.73  -0.99
2.6  -0.85  -0.88
2.8  -0.93  -0.63
3.0  -0.98  -0.27
3.2  -0.99   0.11
3.4  -0.96   0.49
3.6  -0.90   0.79
3.8  -0.79   0.96
4.0  -0.66   0.98
4.2  -0.49   0.85
4.4  -0.31   0.58
4.6  -0.12   0.22
4.8   0.07  -0.17
5.0   0.27  -0.54
5.2   0.45  -0.82
5.4   0.62  -0.98
5.6   0.76  -0.97
5.8   0.88  -0.82
6.0   0.95  -0.53
6.2   0.99  -0.16
6.4   0.99   0.23
in gnuplot:
Code:
 '' using 1:3                     title 'sin(2x) under' linetype rgb 'web-blue' lw 2 pt 3, \
 '' using 1:($3 > 0.5)?($3):(1/0) title 'sin(2x) over' linetype rgb 'red' lw 2 pt 3
data.png
 
OP
L5730

L5730

Addicted to Fun and Learning
Joined
Oct 6, 2018
Messages
670
Likes
439
Location
East of England
@danadam Thank you again for your helpful additions.
Yep, that's got it. With a little wrangling (value >= 0) it works.

Instead of slitting the data, just draw the whole lot as green and then overlay the red bits when it's 0 dBFS or over. Sorted.
 

BethHarmon

Member
Joined
Mar 7, 2021
Messages
12
Likes
0
Could you share the addition with your loudness graph? Ideally, I'm looking at -1 dBTP and above to show as overs given the EBU spec.
 

BethHarmon

Member
Joined
Mar 7, 2021
Messages
12
Likes
0
Thanks @danadam! Is there any way i can increase the amount of red for the overs? I can't read the red dots on my graphs and it would be helpful to have a range either side to make it visible.
 

BethHarmon

Member
Joined
Mar 7, 2021
Messages
12
Likes
0
@danadam I managed it (perhaps something of a "hack"):
Code:
"               '' using (`$0/10):((`$10>=-1)?(`$10):(1/0)) with lines lc rgb '#ff0000' lw 5 title 'True Peak Overs', \"

Changed lw to 5 and now it is super clear to see at default zoom level...
11 - Sympathique-flac-ebu-plot.png
 
Last edited:
OP
L5730

L5730

Addicted to Fun and Learning
Joined
Oct 6, 2018
Messages
670
Likes
439
Location
East of England
I see the problem with the true peaks.
I tried using a palette to change colour of the line above -1 dBFS, however, it would change on the way up, but then change back to the other colour on the way down. So only the left side of the crest would be red. We may have to just live with the lack of data points, or interpolate them.
 

MKreroo

Active Member
Joined
Feb 21, 2020
Messages
144
Likes
67
Interesting, I did a few runs but only outputting the data txt and put them into Excel instead.
Seems possible to then setup something write replaygain value based on these info.
 

MKreroo

Active Member
Joined
Feb 21, 2020
Messages
144
Likes
67
Just a heads-up, I tried running it with latest gnuplot and noticed that for some reason, at line

set output '$outplot'
it needs two spaces before the set
set output '$outplot'
I don't know why (no coding experience :)), but that fixed it (it had error where it would read input command like "t output..."

also want to ask how can I name the output PNG to the input file name (track name)

edit: also noticed that non-English track title seems to be a problem
 
Last edited:

MKreroo

Active Member
Joined
Feb 21, 2020
Messages
144
Likes
67
So I spent some time looking through the docs and too much stack overflow, and made a slight change to the script to be able to take/output non-English character (basically encode in UTF8 instead of ASCII)

With-in $gnuplotinstructions, add:
" set encoding utf8"
The two spaces at the start are somehow needed, otherwise is the line will become "t encoding utf8" in the console, don't know why.

at
$gnuplotinstructions | Out-File $gnuplotcommandfile -Encoding ASCII
change ASCII to UTF8NoBOM
The only problem is now the default Powershell doesn't work, and need PS6 or higher for the NoBOM (whyyyyyyyy)

Also made a change (mainly for my own preference) so that the output png is named after the input file name.

$filename=[System.IO.Path]::GetFileNameWithoutExtension("$infile") if(!$outplot){$outplot = "D:[Your location]\$filename.png"}
I put this right before
Write-Host "Running GNUPlot..." but I don't think the location matter that much

One more point is that, in Control Panel -> Change date, time... -> Administrative -> Change system locale
there is an option that says Beta: use Unicode UTF8 for ........ This needs to be checked too otherwise some of the characters get messed up still.

I think there's better way but I don't really know that much, most of these are just gathered from the internet.
 

alinsa

New Member
Joined
Sep 19, 2022
Messages
1
Likes
0
Thought I'd mention, in case it's useful to anyone, that I also built a tool based on the absolutely excellent work here. Built on python, so was easier for me to wrangle, but YMMV, etc. Needs ffmpeg in your path, and then python+numpy+matplotlib. Works on windows and macOS, and should work on linux (though I was too lazy to test).

Find it here: https://github.com/alinsavix/random-scripts/blob/main/lufsplot/lufsplot.py

And again, absolutely excellent work here ... and it's still shocking to me that this kind of not-as-a-realtime-VST tool just didn't seem to really exist before your script here!
 
OP
L5730

L5730

Addicted to Fun and Learning
Joined
Oct 6, 2018
Messages
670
Likes
439
Location
East of England
Update:

I just threw this together today. It is just using ffmpeg to generate its own ebur128 plot. Less control over the visuals.
I've managed to set the size of the graph width dynamically with file duration. For some reason lavfi leaves a lot of dead space to the right and it's not the same amount each time as a percentage of screen. So I've dealt with it by saying create a plot 10px per second, then just crop it to half width later.

It could do with labelled axis. and the dynamic image sizing is a nuisance. However this is quicker than the multi-pass processing with the GNUPlot project above.
The scale can be expanded instead of 0 to -120 have it to -60 then remove some of the axis points and shift 'em down. Quick and customisable.

Again Powershell, though it could be made with batch script I guess if someone really loves a tough challenge.
Code:
Function MakePlot ($file){

    $filepath = $file

    # define output plot image file
    $outplot = $env:TEMP + $("\r128Plot" + $(Get-Date -format 'yyyyMMdd_HHmmss') + ".png")

    #find file duration in nearest 0.1s, use as img width
    $ffmpegOutput = & ffmpeg.exe -hide_banner -i $filepath 2>&1 -codec copy -f null -
    $durationStr = $($ffmpegOutput -split',' | ?{$_ -match "Duration:"}) -split' ' | ?{$_ -match "[0-9]:"}
    $width = [TimeSpan]::Parse($durationStr).TotalMilliseconds -replace'.{2}$'

    $height=600;$rExt=50
    & ffmpeg.exe -hide_banner -i $filepath -filter_complex `
    "ebur128=dualmono=true:metadata=1:framelog=verbose,asplit[r128data0][r128data1];`

    [r128data0]adrawgraph=slide=picture:min=-120:max=0:s=$($width)x$($height):`
    m1=lavfi.r128.M:fg1=0xff0000d0:`
    m2=lavfi.r128.S:fg2=0xff00ff00:`
    m3=lavfi.r128.I:fg3=0xffa00000[r128plot0];`

    [r128data1]adrawgraph=slide=picture:min=-5:max=25:s=$($width)x$($height):`
    m1=lavfi.r128.LRA:fg1=0xff00d000:bg=0xff000000[r128plot1];`

    color=c=#[email protected]:s=$($width)x$($height),format=argb,split=2[bg0][bg1];`

    [bg0]drawgrid=width=50:height=ih/120:color=#[email protected]:replace=1,`
    drawgrid=width=50*6:height=ih/12:color=#[email protected]:replace=1[grid];`

    [bg1]drawtext=text='Loudness Plot':x=(w/4)-(text_w/2):y=(h/2)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=30:fontcolor=black,`
    drawtext=text='01\:00':x=(300*1)-(text_w/2):y=(h-20)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='02\:00':x=(300*2)-(text_w/2):y=(h-20)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='03\:00':x=(300*3)-(text_w/2):y=(h-20)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='04\:00':x=(300*4)-(text_w/2):y=(h-20)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='-10':x=(w/2-30+$rExt)-(text_w/2):y=(h/12*1)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='-20':x=(w/2-30+$rExt)-(text_w/2):y=(h/12*2)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='-30':x=(w/2-30+$rExt)-(text_w/2):y=(h/12*3)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='-40':x=(w/2-30+$rExt)-(text_w/2):y=(h/12*4)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='-50':x=(w/2-30+$rExt)-(text_w/2):y=(h/12*5)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='-60':x=(w/2-30+$rExt)-(text_w/2):y=(h/12*6)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='-70':x=(w/2-30+$rExt)-(text_w/2):y=(h/12*7)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='-80':x=(w/2-30+$rExt)-(text_w/2):y=(h/12*8)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='-90':x=(w/2-30+$rExt)-(text_w/2):y=(h/12*9)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='-100':x=(w/2-30+$rExt)-(text_w/2):y=(h/12*10)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='-110':x=(w/2-30+$rExt)-(text_w/2):y=(h/12*11)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='20':x=(w/2-40)-(text_w/2):y=(h/12*2)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='15':x=(w/2-40)-(text_w/2):y=(h/12*4)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='10':x=(w/2-40)-(text_w/2):y=(h/12*6)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='5':x=(w/2-40)-(text_w/2):y=(h/12*8)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='0':x=(w/2-40)-(text_w/2):y=(h/12*10)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black[text];`


    [r128plot0][r128plot1]overlay=format=auto[r128plot];`
    [r128plot][grid]overlay=main_w-overlay_w-1:main_h-overlay_h-1:format=auto[gfx];`
    [gfx][text]overlay=format=auto,`
    crop=$($width/2+$rExt):$($height):0:0"`
    -update 1 -frames:v 1 -y $outplot
}

MakePlot -file <some file>

Dua Lipa - "Don't Start Now" for comparison to the above plot.
r128Plot20230814_195711.png
 
OP
L5730

L5730

Addicted to Fun and Learning
Joined
Oct 6, 2018
Messages
670
Likes
439
Location
East of England
index.php

Above is the earlier GNUplot version for easy comparison viewing:
r128Plot20230815_131611.png


Powershell script (save as a .ps1)
Can be used as a SendTo in Windows:
After saving the script, navigate to "shell:sendto" (winkey + r).
Create a link to the script (shift-ctrl drag n drop script into SendTo).
Edit properties of the link:
After Powershell.exe add
Code:
 -ExecutionPolicy bypass -File
after the .ps1 file path add
Code:
 -infile
Then right click any audio file > sendto and this script will be in the list.

Code:
# Powershell script
# Uses ffmpeg to auto calculate image size from duration *
# Uses ffmpeg to generate loudness plot using lavfi ebur128 filter
# * ~5 px per 1s - filter auto generates images that have wasted space.


Function MakePlot ($file){


    # define output plot image file
    $outplot = $($env:TEMP + "\r128Plot" + $(Get-Date -format 'yyyyMMdd_HHmmss') + ".png")

    $filepath = $file

    # capture ffmpeg read file output by dumping a stream copy to null
    $ffmpegOutput = & ffmpeg.exe -hide_banner -i $filepath 2>&1 -codec copy -f null -

    # format graph title from metadata else use filepath
    # replace escape chars for drawtext filter
    $artist = $($($ffmpegOutput.Exception.Message | ?{$_ -match '    ARTIST' })[0]).Substring(22)
    $album = $($($ffmpegOutput.Exception.Message | ?{$_ -match '    ALBUM' })[0]).Substring(22)
    $track = $($($ffmpegOutput.Exception.Message | ?{$_ -match '    TITLE' })[0]).Substring(22)

    if($track){
        $title = $track
        }
    if($album){
        $title = $($album + " - " + $track)
        }
    if($artist){
        $title = $($artist + " : " + $album + " / " + $track)
        } else {
        $title = $filepath
        }
    $title = $title -replace('\\','\\\\') -replace([regex]::Escape(':'),'\\\:') -replace([regex]::escape("'"),"'\\\''") -replace(' ','\ ')
    Write-host $title


    # find file duration in nearest 0.1s, use as output image width, which later is halved.
    # blame the adrawgraph filter for the odd behaviour or right side dead space.
    $durationStr = $($ffmpegOutput -split',' | ?{$_ -match "Duration:"}) -split' ' | ?{$_ -match "\d\d:\d\d:\d\d.\d\d"}
    Write-host $durationStr
    $width = $($([TimeSpan]::Parse($durationStr)).TotalMilliseconds) -replace'.{2}$'

    $height=600;$rExt=50
    & ffmpeg.exe -hide_banner -i $filepath -filter_complex `
    "ebur128=dualmono=true:metadata=1:framelog=verbose,asplit[r128data0][r128data1];`

    [r128data0]adrawgraph=slide=picture:min=-60:max=0:s=$($width)x$($height):`
    m1=lavfi.r128.M:fg1=0x900000ff:`
    m2=lavfi.r128.S:fg2=0xff51b400:`
    m3=lavfi.r128.I:fg3=0xffff9000[r128plot0];`

    [r128data1]adrawgraph=slide=picture:min=-5:max=25:s=$($width)x$($height):`
    m1=lavfi.r128.LRA:fg1=0xff00d000:bg=0xff000000[r128plot1];`

    color=c=#[email protected]:s=$($width)x$($height),format=argb,split=3[bg0][bg1][bg2];`

    [bg0]drawgrid=width=50:height=ih/60:color=#[email protected]:replace=1,`
    drawgrid=width=50*6:height=ih/12:color=#[email protected]:replace=1[grid];`

    [bg1]drawtext=text='$($title.toString())':x=(w/4)-(text_w/2):y=(h/2)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=30:fontcolor=black,`
    drawtext=text='Time (mm\\\:ss)':x=(w/4)-(text_w/2):y=(h-10)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=12:fontcolor=black,`
    drawtext=text='01\:00':x=(300*1)-(text_w/2):y=(h-25)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='02\:00':x=(300*2)-(text_w/2):y=(h-25)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='03\:00':x=(300*3)-(text_w/2):y=(h-25)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='04\:00':x=(300*4)-(text_w/2):y=(h-25)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='-5':x=(w/2-35+$rExt)-(text_w/2):y=(h/12*1)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='-10':x=(w/2-35+$rExt)-(text_w/2):y=(h/12*2)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='-15':x=(w/2-35+$rExt)-(text_w/2):y=(h/12*3)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='-20':x=(w/2-35+$rExt)-(text_w/2):y=(h/12*4)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='-25':x=(w/2-35+$rExt)-(text_w/2):y=(h/12*5)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='-30':x=(w/2-35+$rExt)-(text_w/2):y=(h/12*6)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='-35':x=(w/2-35+$rExt)-(text_w/2):y=(h/12*7)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='-40':x=(w/2-35+$rExt)-(text_w/2):y=(h/12*8)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='-45':x=(w/2-35+$rExt)-(text_w/2):y=(h/12*9)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='-50':x=(w/2-35+$rExt)-(text_w/2):y=(h/12*10)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='-55':x=(w/2-35+$rExt)-(text_w/2):y=(h/12*11)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='20':x=(w/2-40)-(text_w/2):y=(h/12*2)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='15':x=(w/2-40)-(text_w/2):y=(h/12*4)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='10':x=(w/2-40)-(text_w/2):y=(h/12*6)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='5':x=(w/2-40)-(text_w/2):y=(h/12*8)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black,`
    drawtext=text='0':x=(w/2-40)-(text_w/2):y=(h/12*10)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=15:fontcolor=black[text0];`


    [bg2]drawtext=text='Loudness Range LRA (LU)':x=(w/2)-(text_w/2):y=(h/2-10)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=12:fontcolor=black,`
    drawtext=text='Loudness Units Full Scale (LUFS)':x=(w/2)-(text_w/2):y=(h/2+40)-(text_h/2):fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=12:fontcolor=black[text1];`

    [r128plot0][r128plot1]overlay=format=auto[r128plot];`
    [r128plot][grid]overlay=main_w-overlay_w-1:main_h-overlay_h-1:format=auto[gfx];`
    [text1]rotate=-90*PI/180:fillcolor=none[textrot];`
    [text0][textrot]overlay=format=auto[text];`
    [gfx][text]overlay=format=auto,`
    crop=$($width/2+$rExt):$($height):0:0"`
    -update 1 -frames:v 1 -y $outplot

    return $outplot
}

ForEach ($i in $args){
    if(!(Test-Path $i)){continue}
    Write-host $i
    $outplot = MakePlot -file $i
    & $outplot
}
 
Top Bottom