Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: Post Take/Item properties item loudness ReaScript Functions #957

Closed
X-Raym opened this issue Mar 5, 2018 · 18 comments
Closed

FR: Post Take/Item properties item loudness ReaScript Functions #957

X-Raym opened this issue Mar 5, 2018 · 18 comments

Comments

@X-Raym
Copy link
Contributor

X-Raym commented Mar 5, 2018

Hi,

the current Loudness ReaScript functions return loudness pre-fades and pre volume envelopes.

It would be nice if it could returns loudness after all take properties (fades, gain, volumes etc...)

As shown on the Loudness signal flow there:
http://wiki.cockos.com/wiki/index.php/Measure_and_normalize_loudness_with_SWS

This was originally discussed on this issue:
#953 (comment)

Thanks for listening !

@nofishonfriday
Copy link
Collaborator

nofishonfriday commented Mar 7, 2018

@X-Raym
Hm, from a few tests it seems that even SWS/BR: Analyze loudness... doesn't properly take takes volume envelopes into account. Can you confirm ? (You can test by analyzing selected item, right-clicking an entry there -> Go to true peak, while having e.g. a curved / ramped take vol. env. active in the analyzed item. You need to have "Analyze true peak" enabled in the options.)

If yes, seems there may be a bug and nothing I can do about regarding this request.
Which leads to next question...Breeder seems to use Envelope_Evaluate() for accounting for the envelops, have you ever used this and can confirm it's working correctly ?

@X-Raym
Copy link
Contributor Author

X-Raym commented Mar 7, 2018

@nofishonfriday Here is what I get from SWS/BR; Analyse Loudness... with two analyses of the same item (first with volume envelope at 0, then volume envelope -10dB).

1 - Epic Battle Dark.mp3: -17.0 LUFS, Range: 16.5 LU, True peak: -0.4 dBTP
1 - Epic Battle Dark.mp3: -26.8 LUFS, Range: 16.5 LU, True peak: -10.4 dBTP

As you can see, it seems that it works as expected.


Envelope_Evaluate() is working fine with other scripts of mine. You can try with Script: X-Raym_Copy envelope values at edit cursor and insert at time selection.lua

@nofishonfriday
Copy link
Collaborator

nofishonfriday commented Mar 7, 2018

But in this scenario, the ReaScript loudness functions should already give the same results, don't they ?
At least they seem to do here:

Alt Text

What I meant was when you do something like this:

Alt Text

then

Alt Text

This is a scenario I can't account for I think.

@X-Raym
Copy link
Contributor Author

X-Raym commented Mar 7, 2018

@nofishonfriday which SWS do you use ? I use the official v2.9.8.0.

Ok I notice something weird.

It does seems to works post env and post fades.... But only if item pos is 0.

Look

Can you confirm ?

@nofishonfriday
Copy link
Collaborator

Interesting find ! Thanks.
When going to true peak from SWS/BR: Analyze loudness... directly it shows the exact same behaviour when item has vol env - only correct if item pos is 0.
Looks like bug hunting, sigh...

@X-Raym
Copy link
Contributor Author

X-Raym commented Mar 7, 2018

@nofishonfriday
If you dont want to bug hunt, just put the item at pos 0 within the function and restore to init pos after analyses :P

That would be a dirty solution though.

@nofishonfriday
Copy link
Collaborator

Haha good one.
I'm trying to be not this dirty though, if there's another way. :D

@X-Raym
Copy link
Contributor Author

X-Raym commented Mar 8, 2018

@nofishonfriday
Yes :P the SWS source code shoulf be logical for third party devs and not full of dirty reaper specific hacks ^^ else, it will be quite hard to handle for newcomers :P

@X-Raym X-Raym changed the title FR: Post Take/Item properties item loudnes ReaScript Functions FR: Post Take/Item properties item loudness ReaScript Functions Mar 8, 2018
@nofishonfriday
Copy link
Collaborator

nofishonfriday commented Mar 13, 2018

Seems I found the issue:
https://forum.cockos.com/showthread.php?t=129415

Actually a Reaper bug I'd think, created a BR:
https://forum.cockos.com/showthread.php?t=204397

Let's see what comes out of it, could maybe also worked around it in SWS if it doesn't get fixed (or not classified as bug).

edit:
Ok, schwa has spoken no bug. :D
Then hopefully finding a way to fix in SWS.

@nofishonfriday
Copy link
Collaborator

May have it fixed, please test:
https://www.dropbox.com/s/haynxbr2w8tx20x/reaper_sws64_LoudnessVsTakeEnvFix01.dll?dl=1

I couldn't make it fail so far with complex take vol. env's also if item pos not 0.0.
Seems also work correctly if a take start offset set.
Maybe fails if stretch markers involved, but couldn't do anything in this case anyway...

@X-Raym
Copy link
Contributor Author

X-Raym commented Mar 14, 2018

@nofishonfriday Nice !

truePeakPos, shortTermMaxPos, momentaryMaxPos doesn't seems to be consistent (some are relative, some are absolute).

(also, NF_GetMediaItemMaxPeakAndMaxPos() is absolute now ?)

@nofishonfriday
Copy link
Collaborator

You're right, currently TPpos: relative, shortTermMaxPos, momentaryMaxPos: absolute.
When I started doing these functions I admit I didn't check and just returned what these functions returned internally (clearly a lack of coding experience!). I know it's not ideal, but I tend to leaving it this way (for not breaking existing scripts, mine for example :D) and put a note about it in the ReaScript doc.

NF_GetMediaItemMaxPeakAndMaxPos() should still be realtive though, it's here at least, could you recheck pls ?

Btw., the bug was quite hard to find (for me anyway), the crucial key was your observation working correctly if item pos = 0.0, so thanks for this again. :)

@X-Raym
Copy link
Contributor Author

X-Raym commented Mar 14, 2018

@nofishonfriday Oh sorry for NF_GetMediaItemMaxPeakAndMaxPos() , my bad, it do works as expected.

Ok for not breaking compatibility with previous scripts and for update in the doc. but maybe in this case TPpos should be absolute too ? At least it would be consistent within this function.

@nofishonfriday
Copy link
Collaborator

nofishonfriday commented Mar 15, 2018

I follow the thought but it would be the same problem with potentially breaking existing scripts as it's been relative from the beginning (as you stated) so I think I'd rather leave it like this and try to do better next time. :)

@X-Raym
Copy link
Contributor Author

X-Raym commented Mar 15, 2018

@nofishonfriday backward compatibility is more important that consitency. And it is not as if the fix was hard to fix on the script side :P

At least the post fades and envelopes is fixed now :P The pull request can be proposed and the issue closed.
At least the post fades

@nofishonfriday
Copy link
Collaborator

nofishonfriday commented Mar 15, 2018

Pull request coming shortly... :)
Post takes vol. envelopes yes, but are you sure it takes item fades also into account ?
According to the Signal flow it doesn't (we're using the Take analysis with the ReaScript functions) and in my test so far it also seems it doesn't, or did you observe otherwise ?
Anyway, that's also something I couldn't account for anyway...

@X-Raym
Copy link
Contributor Author

X-Raym commented Mar 15, 2018

@nofishonfriday You are right.

  • NF_AnalyzeTakeLoudness2 is pre-fades.
  • NF_GetMediaItemMaxPeakAndMaxPeakPos is post fades.

I think I'm starting to be confused by all these subtleties :P It definitely deserves to be in the doc for clarity.

(that said, GetMediaItemMaxPeakAndMaxPeakPos being post fades, it may be possible at some point to make a Loudness function which take cares of fades. But maybe another day... 😸 )

nofishonfriday added a commit to nofishonfriday/sws that referenced this issue Mar 15, 2018
@nofishonfriday
Copy link
Collaborator

Thanks for confirming. I've now linked to the Signal flow chart for the ReaScript Loudness functions so it should make it clear.

nofishonfriday added a commit to nofishonfriday/sws that referenced this issue Oct 28, 2018
nofishonfriday added a commit to nofishonfriday/sws that referenced this issue Dec 12, 2018
 - Revert (mistakenly) changing integrated Loudness relative gate threshold from -10.0 LU to -20.0 LU in SWS v2.9.8
 - Fix getting project sample rate
- Don't apply item vol. and pan/vol. envelope correction beyond actual audio data (fixes reaper-oss#1074)
- Fix item Loudness analysis if take contains volume envelope (closes reaper-oss#957)
nofishonfriday added a commit to nofishonfriday/sws that referenced this issue Dec 12, 2018
 - Revert (mistakenly) changing integrated Loudness relative gate threshold from -10.0 LU to -20.0 LU in SWS v2.9.8
 - Fix getting project sample rate
- Don't apply item vol. and pan/vol. envelope correction beyond actual audio data (fixes reaper-oss#1074)
- Fix item Loudness analysis if take contains volume envelope and item pos. not 0.0 (closes reaper-oss#957)
@swstim swstim closed this as completed in 40f494c Feb 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants