INTERACT FORUM

Please login or register.

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

Author Topic: Discussion about NEW: Improved Expression Language  (Read 625 times)

wynnytsky

  • Recent member
  • *
  • Posts: 17
Discussion about NEW: Improved Expression Language
« on: May 01, 2020, 08:12:12 am »

about a year ago I created an expression column that would take a stab at scoring a track's recording quality by giving weights to the two R128 values

Code: [Select]
ifelse(
    isempty([Dynamic Range (R128)]) or isempty([Volume Level (R128)]),
   
    -20,
   
    Math(
        RemoveRight([Dynamic Range (R128)], 3)
        +
        RemoveRight([Volume Level (R128)], 3)
        *
        if(
            isequal(Math(sign(RemoveRight([Volume Level (R128)], 3))), 1, 1),
           
            -0.5,
           
            2
        )
    )
)

I still reserve the star system for scoring tracks by how much you like them, and recording quality takes a back seat in that regard
Logged

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2033
Re: Discussion about NEW: Improved Expression Language
« Reply #1 on: May 01, 2020, 09:18:00 am »

Code: [Select]
ifelse(
    isempty([Dynamic Range (R128)]) or isempty([Volume Level (R128)]),
   
    -20,
   
    Math(
        RemoveRight([Dynamic Range (R128)], 3)
        +
        RemoveRight([Volume Level (R128)], 3)
        *
        if(
            isequal(Math(sign(RemoveRight([Volume Level (R128)], 3))), 1, 1),
           
            -0.5,
           
            2
        )
    )
)
Matt can correct me if I'm wrong but I don't think you can use "or" operator like that with MC's expression language. I would say that above probably only checks the first IsEmpty.
With new Number() function you don't need RemoveRight anymore although I suspect that Number() doesn't reserve sign.
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42388
  • Shoes gone again!
Re: Discussion about NEW: Improved Expression Language
« Reply #2 on: May 01, 2020, 09:26:57 am »

Matt can correct me if I'm wrong but I don't think you can use "or" operator like that with MC's expression language. I would say that above probably only checks the first IsEmpty.
With new Number() function you don't need RemoveRight anymore although I suspect that Number() doesn't reserve sign.

There's no support for that, but I'm adding an Or(...) function right now because it's a good idea.  It will just test all the parameters listed and output true if any of them hit.

Here's the history:
NEW: Added the expression function Or(...) to test a list of values and output true if any are set.
Logged
Matt Ashland, JRiver Media Center

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2033
Re: Discussion about NEW: Improved Expression Language
« Reply #3 on: May 01, 2020, 09:42:32 am »

There's no support for that, but I'm adding an Or(...) function right now because it's a good idea.  It will just test all the parameters listed and output true if any of them hit.

Here's the history:
NEW: Added the expression function Or(...) to test a list of values and output true if any are set.
This is a good addition, thanks!
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42388
  • Shoes gone again!
Re: Discussion about NEW: Improved Expression Language
« Reply #4 on: May 01, 2020, 09:47:10 am »

And because I just wanted to be complete:
NEW: Added the expression function And(...) to test a list of values and output true if all are set.
Logged
Matt Ashland, JRiver Media Center

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2033
Re: Discussion about NEW: Improved Expression Language
« Reply #5 on: May 01, 2020, 09:57:45 am »

Like this?
If(Or(IsEqual([Subtitles],Finnish,8), IsEqual([Subtitles],English,8)),TRUE, FALSE)
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42388
  • Shoes gone again!
Re: Discussion about NEW: Improved Expression Language
« Reply #6 on: May 01, 2020, 10:13:57 am »

Like this?
If(Or(IsEqual([Subtitles],Finnish,8), IsEqual([Subtitles],English,8)),TRUE, FALSE)

Exactly.  I added ,1 to the end of the Or and it went from FALSE to TRUE on my test.
Logged
Matt Ashland, JRiver Media Center

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2033
Re: Discussion about NEW: Improved Expression Language
« Reply #7 on: May 01, 2020, 10:18:41 am »

Cool, this will surely prettify some long chains
Logged

wer

  • Citizen of the Universe
  • *****
  • Posts: 2640
Re: Discussion about NEW: Improved Expression Language
« Reply #8 on: May 01, 2020, 01:02:43 pm »

Matt maybe it would be a good idea to lock this thread and make it a sticky, just for documentary purposes.  Your first post was a great summary! 
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42388
  • Shoes gone again!
Re: Discussion about NEW: Improved Expression Language
« Reply #9 on: May 01, 2020, 01:04:27 pm »

I'll branch the discussion.
Logged
Matt Ashland, JRiver Media Center

wer

  • Citizen of the Universe
  • *****
  • Posts: 2640
Re: Discussion about NEW: Improved Expression Language
« Reply #10 on: May 01, 2020, 01:19:08 pm »

Matt about the new AND() and OR() functions.  It's not quite the same as the boolean support I was suggesting in the other thread because it can't be used infix, but my question is, is there any difference between using these new functions and just using Math() or are they just more readable shortcuts to the same thing?
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42388
  • Shoes gone again!
Re: Discussion about NEW: Improved Expression Language
« Reply #11 on: May 01, 2020, 01:21:46 pm »

Matt about the new AND() and OR() functions.  It's not quite the same as the boolean support I was suggesting in the other thread because it can't be used infix, but my question is, is there any difference between using these new functions and just using Math() or are they just more readable shortcuts to the same thing?

Math(...) is probably pretty similar.
Logged
Matt Ashland, JRiver Media Center
Pages: [1]   Go Up