INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Needing an expression for max album headroom  (Read 2984 times)

Chipicui

  • Junior Woodchuck
  • **
  • Posts: 52
Needing an expression for max album headroom
« on: July 01, 2021, 02:57:42 pm »

Hi
i have a custom calculated field called hdrm18 that i use to store headroom (distance in dB from peak to 0dBFS) value of a file after applying replaygain corrections (0VU=-18dB FS)
Media Center when using volume leveling, applies a volume correction that is equal to [(-23dB) - (integrated r128 value of the file)].
But it is too low for my use...i don’t need 23dB of dynamics, so after Media Center volume leveling, I apply a fixed +5dB offset of gain with a fader plugin  to climb to the -18dBFS level of replaygain that i consider more in line with popular music

My question is... how can i make an expression that evaluates the maximum value of hdrm18 on a “per album” basis so i can be sure that my offset is not clipping any file in the album?
I want to have a single value that represents the maximum gain I can apply to an ALBUM without clipping, to use it in a Track Info panel or something like that, or maybe store it into another custom field.
I’ve tried with GroupSummary... but I can’t obtain the max of a custom field for a -specific- album

Thanks a lot and excuse my lenghty explanation but english is not my native language so its hard to be concise
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2674
Re: Needing an expression for max album headroom
« Reply #1 on: July 01, 2021, 03:22:52 pm »

Assuming your hdrm18 field contains only numbers (no "dB" string), try this:
Code: [Select]
ListMath(FieldQuery(Artist - Album /(Year/), [Artist - Album (Year)], hdrm18, 1, 0),1)
This gets the maximum of the HDRM18 field for all files sharing the same [Artist - Album (Year)] value.
Note that these GroupQuery/FieldQuery functions are relatively slow.
Logged

Chipicui

  • Junior Woodchuck
  • **
  • Posts: 52
Re: Needing an expression for max album headroom
« Reply #2 on: July 01, 2021, 06:11:09 pm »

Wow thank you zybex!! that was fast!...
Works perfectly.
I think I’ll use this result to populate a custom field and read it from there to avoid a hit on perfomance.
Thanks a lot  :)
Logged

Chipicui

  • Junior Woodchuck
  • **
  • Posts: 52
Re: Needing an expression for max album headroom
« Reply #3 on: July 01, 2021, 10:10:10 pm »

zybex, sorry to bother you again.
In JRiver I made a custom column in a view with this simplified expression that worked ok

ListMath(FieldQuery(Album, [Album], hdrm18, 1, 0),1)

Unfortunately latter, while I tried to replace that simpler expression in jriver with the full one and hit ok I had an instant and severe crash and could no longer start JRiver.
Had to uninstall, reinstall and load an older backup library.
Any idea what can be causing such catastrophic result?... never had such behaviour before with expression language code.
I'm attaching an image of the results of your expression in zelda... could be that red area what's causing the problem.
I don't know what's different between those albums that's causing this bad behaviour.

Thank you!
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2674
Re: Needing an expression for max album headroom
« Reply #4 on: July 02, 2021, 05:01:15 am »

Looks like you have some values in that Album which are triggering some MC bug. Perhaps a division by zero... the album is called 'Infinitude' after all  ;)

Does this work to get the values for that album? If this works, then the bug is in ListMath:
FieldQuery(Artist - Album /(Year/), [Artist - Album (Year)], hdrm18, 1, 0)

Please let me know what are the values in HDRM18 for those files, we can probably write a workaround for the crash.
You can also add the HDRM18 column to Zelda and take another screenshot.
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42441
  • Shoes gone again!
Re: Needing an expression for max album headroom
« Reply #5 on: July 02, 2021, 06:47:48 am »

I can't see how ListMath in mode one could crash.

Could you post the full crashing expression?  It would be nice to figure it out.

Thanks.
Logged
Matt Ashland, JRiver Media Center

Chipicui

  • Junior Woodchuck
  • **
  • Posts: 52
Re: Needing an expression for max album headroom
« Reply #6 on: July 02, 2021, 09:12:50 am »

Thanks zybex & Matt.
I’ll send you the information later, when I come back home.
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42441
  • Shoes gone again!
Re: Needing an expression for max album headroom
« Reply #7 on: July 02, 2021, 09:22:45 am »

I just reproduced the crash.  Give me a while to debug...
Logged
Matt Ashland, JRiver Media Center

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42441
  • Shoes gone again!
Re: Needing an expression for max album headroom
« Reply #8 on: July 02, 2021, 09:28:09 am »

Coming next build:
Fixed: The ListMath expression could crash if an empty string was passed in.

When we'd initialize the list, we wouldn't do well if the list was an empty string.

Thanks for the help.
Logged
Matt Ashland, JRiver Media Center

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2674
Re: Needing an expression for max album headroom
« Reply #9 on: July 02, 2021, 10:57:41 am »

Thanks, nice catch :)

Chipicui, this means it would crash if none of the files in a given album had an hdrm18 value.
You can use this workaround until next build is out:
Code: [Select]
ListMath(-999;FieldQuery(Artist - Album /(Year/), [Artist - Album (Year)], hdrm18, 1, 0),1)
Logged

Chipicui

  • Junior Woodchuck
  • **
  • Posts: 52
Re: Needing an expression for max album headroom
« Reply #10 on: July 02, 2021, 11:19:42 am »

That’s strange because although I can’t verify it right now, I’m pretty sure that all the hdrm18 values in this specific playlist were populated... in fact i seem to remember that all tags had values because i’m anal about it.   ;D
The only thing that can be different between albums (apart from codec) here is that some albums have a full date (xxxx-xx-xx) tag and some only year.
And the other thing is that artist tag is multivalue, in the case of the errored album artists are separated with “;” and some are single artist.
Nothing more is different.

Ahhh... wait!... I have several conected hard disks, some internal always active and some very slow usb externals that are sleeping most of the time.
Could that interfere in the calculation and somehow make jriver crash?
I don’t think so but while using zelda, sometimes it briefly evaluates ALL files as “jriver exception” and then it gives the correct value of the tag
Logged

Chipicui

  • Junior Woodchuck
  • **
  • Posts: 52
Re: Needing an expression for max album headroom
« Reply #11 on: July 02, 2021, 01:26:42 pm »

Home again...
Look at this result; you were right... with your new expression I didn't get the "JRiver Exception"
The ONLY thing I can see differing between tags is that those that don't display exp2 result, have more than one artist separated by ";"
But look that every one displays a a correct hdrm18 value and artist tags.
I've checked on by one in jriver and every file has a correctly populated hdrm18 tag which I've defined as:

sum(replace(RemoveCharacters([Volume Level (R128)],/ LU,0), /,, .),5,left([Peak Level (R128)],7))

Maybe that the multivalue artist tag is causing this issue?
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2674
Re: Needing an expression for max album headroom
« Reply #12 on: July 02, 2021, 01:45:25 pm »

Yeah, looks like FieldQuery() doesn't behave as expected with those multi-artist albums. I understand why it does that: FieldQuery() can take a list of values in the second argument, and treats it differently than what you want in this case.

As a workaround, try using the [Year - Album] field instead, which won't contain semicolons:
Code: [Select]
ListMath(-999;FieldQuery(Year - Album, [Year - Album], hdrm18, 1, 0),1)
Hopefully you don't have many albums with same name and same year but from different artists :)
Logged

Chipicui

  • Junior Woodchuck
  • **
  • Posts: 52
Re: Needing an expression for max album headroom
« Reply #13 on: July 02, 2021, 01:51:27 pm »

This expression works absolutely fine :
ListMath(FieldQuery(Album, [Album], hdrm18, 1, 0),1)   //{first image}

With your suggestion:
ListMath(-999;FieldQuery(Artist - Album /(Year/), [Artist - Album (Year)], hdrm18, 1, 0),1)   //{second image}

It's clear that lack of a list of values in FieldQuery for hdrm18 in a file is what's causing the problem.
But the reason for this is eluding me.
Something is interfering because every file has a correctly populated hdrm18 tag
Logged

Chipicui

  • Junior Woodchuck
  • **
  • Posts: 52
Re: Needing an expression for max album headroom
« Reply #14 on: July 02, 2021, 01:55:34 pm »

Yeah, looks like FieldQuery() doesn't behave as expected with those multi-artist albums. I understand why it does that: FieldQuery() can take a list of values in the second argument, and treats it differently than what you want in this case.

As a workaround, try using the [Year - Album] field instead, which won't contain semicolons:
Code: [Select]
ListMath(-999;FieldQuery(Year - Album, [Year - Album], hdrm18, 1, 0),1)
Hopefully you don't have many albums with same name and same year but from different artists :)

Sorry, you had posted the solution just before I send more screens..
Yes!, don't worry about it!, I've been thinking and I have every version of same album differentiated by Album [xxx.....] in the tag so it wont be an issue.
I don't want to make you or Matt loose more time with this minimal issue.
I want to say a BIG thanks for your time and generousity!!
Logged
Pages: [1]   Go Up