INTERACT FORUM

Please login or register.

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

Author Topic: View for Album Dynamic Range (DR)  (Read 24355 times)

InflatableMouse

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3978
View for Album Dynamic Range (DR)
« on: August 16, 2013, 02:30:47 am »

Now that analysis also calculates DR values I guess it would be nice to have a view that filters average Album DR.

A while back MrC created expressions to filter a view on average bitrate (which I find very useful and still use a lot), so you can thank him for this. It was very simple to adjust them to calculate average DR.

The 'Set Rules for display' expression:
Code: [Select]
[Media Type]=[Audio] [=save(0,v_tracks[album artist (auto)][album])1]=1 [=save(math(1+load(v_tracks[album artist (auto)][album])),v_tracks[album artist (auto)][album])1]=1 [=save(0,v_drsum[album artist (auto)][album])1]=1 [=if(compare([Dynamic Range (DR)],=,0),save(-1,v_drsum[album artist (auto)][album]),)1]=1 [=if(compare(load(v_drsum[album artist (auto)][album]),>,-1),save(math([Dynamic Range (DR)]+load(v_drsum[album artist (auto)][album])),v_drsum[album artist (auto)][album]),)1]=1 ~sort=[Album Artist (auto)],[Album],[Track #],[Media Type],[Disc #],[Name]

The filter 'Panes' expression:
Code: [Select]
if(isequal(
if(compare(load(v_drsum[album artist (auto)][album]), >, 0),
   formatnumber(
      math( load(v_drsum[album artist (auto)][album]) / load(v_tracks[album artist (auto)][album]) ),
      2
   ),
0),10,3),< 10,> 10)

The show all 'Panes' expression:
Code: [Select]
if(compare(load(v_drsum[album artist (auto)][album]), >, 0),
   formatnumber(
      math( load(v_drsum[album artist (auto)][album]) / load(v_tracks[album artist (auto)][album]) ),
      2
   ),
0)

How to use these
Create a new library view, choose Panes and give it a name. Right click it, customize view, click 'set rules for display'. Use the Import/Export button and paste the 'Set Rules for display' expression in the smartlist rules data. Click Ok, Ok, Ok.

Add a pane to the most left, choose Expression, name something like 'Average DR more/less than 16'. Paste the filter 'Panes' expression at 'Expression to group by:'. Note the final line, 0),10,3),< 10,> 10). Edit the 3 red numbers to '16'.

Repeat the add pane but use the show all expression (no edit necessary).

You can add extra panes with higher/lower values to add granularity. I start with 16, next is 10 and final is 6. All you have to do is add the panes in the correct order and edit the three red numbers.

I'm reanalyzing for DR now, highest album of 34 done is Stings 'The Lazarus Heart' with a value of 14.92.

Lowest is 3 Doors Down, all tracks have a DR of 6 except track 12 (DR8). The Cure 4:13 Dream with 4.62 :-X.

Logged

InflatableMouse

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3978
Re: View for Album Dynamic Range (DR)
« Reply #1 on: August 16, 2013, 02:37:58 am »

I wonder if its possible to add a relational field to the library to store the calculated album DR so I can use it in other views.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: View for Album Dynamic Range (DR)
« Reply #2 on: August 16, 2013, 10:17:46 pm »

It should be, I have several fields that are calculated this way.  So long as the view is called up once, the values are valid until changed.  The view needs to be revisited to refresh.

I have some calculations performed at the Audio level, so that all sub-views inherit the calculations. This slows down things sometimes, so beware.

MC19 has some new features which may help with this post, and in general.  I'll take a look later at the post if you want to see what can be done.
Logged
The opinions I express represent my own folly.

InflatableMouse

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3978
Re: View for Album Dynamic Range (DR)
« Reply #3 on: August 17, 2013, 01:50:24 am »

I was thinking about the result only, a static number. Not something that recalculates each time I refresh a view.

These numbers don't change so there's no need to recalculate them.

Do you think that's possible?

Logged

InflatableMouse

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3978
Re: View for Album Dynamic Range (DR)
« Reply #4 on: August 17, 2013, 10:47:37 am »

In addition to the above.

I was trying to create a similar view for [Dynamic Range (R128)] using RemoveRight([Dynamic Range (R128)],3) but its not working.

When I create a new calculated field [DR (R128)] and use the RemoveRight from above, it works fine. I also tried using the calculated field in the rules for display, doesn't work either.

What am I doing wrong? Is the commas again?
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: View for Album Dynamic Range (DR)
« Reply #5 on: August 17, 2013, 04:23:12 pm »

Since the Dynamic Range (R128) is decimal, you'll have to do the comma --> period conversion where Math() is being used.

Yes, you can save the output of your Album DR into an album-relational field.  You can either use a calculated field (as per our discussion above), or make it a non-calculated field and just assign the value once manually.

I took a quick look at your expressions above, and here are some reworkings to employ new MC19 features:

Code: [Select]
[Media Type]=[Audio] [=1save(0,v_tracks_albumkey())]=1 [=1saveadd(v_tracks_albumkey(),1)]=1 [=1save(0,v_drsum_albumkey())]=1 [=1ifelse(compare([Dynamic Range (DR)],=,0),save(-1,v_drsum_albumkey()))]=1 [=1ifelse(compare(load(v_drsum_albumkey()),>,-1),saveadd(v_drsum_albumkey(), [Dynamic Range (DR)]))]=1 ~sort=[Album Artist (auto)],[Album],[Track #],[Media Type],[Disc #],[Name]
which is:

   [Media Type]=[Audio]
   
    save(0,v_tracks_albumkey())
    saveadd(v_tracks_albumkey(),1)
    save(0,v_drsum_albumkey())
    ifelse(compare([Dynamic Range (DR)],=,0),
         save(-1, v_drsum_albumkey()))
    ifelse(compare(load(v_drsum_albumkey()),>,-1),
         saveadd(v_drsum_albumkey(), [Dynamic Range (DR)]))

    ~sort=[Album Artist (auto)],[Album],[Track #],[Media Type],[Disc #],[Name]

This uses the new saveadd() function, and the old albumkey() function which produces [album artist (auto)] - [Album].

For the first pane, I combined the output of your second pane and pushed those values into a hierarchy.  It also employs the new Math() function trunc() to eliminate the FormatNumber() call.  There is a new MC18 feature used, that you can reference simple global variables after set using a [var] shortcut (no functions inside).  Finally, you only need to change the first "16" at the top of the expression:

save(16,drsize)/
if(isempty([Dynamic Range (DR),0]), * No DR,
   save(math(trunc((load(v_drsum_albumkey()) / load(v_tracks_albumkey()) + .005),2)),tmp)/
   ifelse(
      compare(load(v_drsum_albumkey()), >=, [drsize]), >= [drsize]\[tmp],
      compare(load(v_drsum_albumkey()),   <, [drsize]), < [drsize]\[tmp]
  )
)&datatype=[list]
Logged
The opinions I express represent my own folly.

InflatableMouse

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3978
Re: View for Album Dynamic Range (DR)
« Reply #6 on: August 18, 2013, 03:00:00 am »

Thanks for the help.

The new versions aren't working though. My first pane is set to 14. When I choose <14 it only returns 6 files (not even albums). The >=14 shows everything minus those 6 files and their DR ranges from 3.3 to 16.5.

What I notice is that all numbers have 2 decimals, except 3 have 6 decimals. They are not the highest numbers but close, 16.129999, 16.379999 and 16.540001. I thought maybe its a hint of what's going wrong.

I suspected maybe the new (old) albumkey() function isn't working as expected so I tried changing them to the old '[album artist (auto)][album]'. Although that works, it doesn't resolve the issue.

ps. I couldn't help but notice the + .005, what is that for?



I also prefer the panes not to fold open but none of the data types change that.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: View for Album Dynamic Range (DR)
« Reply #7 on: August 18, 2013, 01:36:13 pm »

Neither of the solutions works reliably.  The problem has to do with how values are being calculated using Set rules for file display.

Essentially, each rule evaluates as TRUE for all files.  Even though the rules generate a set of numbers, and those numbers are displayed in a pane column, many when selected produce no results.

While you can rely on the values that are shown, selection is not guaranteed to produce the correct file set.

The Set rules for file display relies on a sequenced set of steps to work:

  1. evaluate each rule in order
  2. run the panes expressions afterwards using the values calculated from (1)

But step 2 isn't guaranteed, and this is a limitation of the technique.  If it works for you, use it.

Re: the .005 was to round the second decimal place, since trunc(x,2) just truncates to two decimal places.

   Math(trunc(3.115, 2))  = 3.11
   Math(trunc(3.115 + .005, 2)) = 3.12
Logged
The opinions I express represent my own folly.

InflatableMouse

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3978
Re: View for Album Dynamic Range (DR)
« Reply #8 on: August 18, 2013, 03:39:19 pm »

No worries I'll continue to use the "old" ones, they seem to work fine.
Logged

InflatableMouse

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3978
Re: View for Album Dynamic Range (DR)
« Reply #9 on: August 30, 2013, 04:44:37 am »

I've created a new library field [Album DR] with the following expression:
Code: [Select]
formatnumber(math(load(v_drsum[album artist (auto)][album]) / load(v_tracks[album artist (auto)][album])),2)

This works fine, I can add panes and collumns in views or add it to thumbnail text in an Album view.

However, I think this needs to go through the calculations each time a view is refreshed. I am wondering if there is something equal to Excel's paste value. You copy a cell's contents to the clipboard and if the cell contains a formula, Excel pastes the outcome of that formula into the destination cell.

In other words, I simply want the [Album DR] expression output and store the result, a plain number, not an expression that is required to be recalculated.

Is this possible?
Logged

InflatableMouse

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3978
Re: View for Album Dynamic Range (DR)
« Reply #10 on: August 30, 2013, 04:45:59 am »

OT: For fun, look at the screenshot. You'd almost think they did it on purpose.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: View for Album Dynamic Range (DR)
« Reply #11 on: August 30, 2013, 09:06:51 am »

I've created a new library field [Album DR] with the following expression:
Code: [Select]
formatnumber(math(load(v_drsum[album artist (auto)][album]) / load(v_tracks[album artist (auto)][album])),2)

This works fine, I can add panes and collumns in views or add it to thumbnail text in an Album view.

However, I think this needs to go through the calculations each time a view is refreshed. I am wondering if there is something equal to Excel's paste value. You copy a cell's contents to the clipboard and if the cell contains a formula, Excel pastes the outcome of that formula into the destination cell.

In other words, I simply want the [Album DR] expression output and store the result, a plain number, not an expression that is required to be recalculated.

Is this possible?

Assign this field's value to another field:

   =[Album DR]
Logged
The opinions I express represent my own folly.

InflatableMouse

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3978
Re: View for Album Dynamic Range (DR)
« Reply #12 on: August 30, 2013, 09:19:07 am »

That simple huh?  ;D

Thanks.
Logged
Pages: [1]   Go Up