Go Back   Cockos Incorporated Forums > REAPER Forums > ReaScript, JSFX, REAPER Plug-in Extensions, Developer Forum

Reply
 
Thread Tools Display Modes
Old 10-11-2017, 02:28 AM   #1
Hippocratic Mastering
Human being with feelings
 
Join Date: Sep 2016
Posts: 42
Default Script request: normalise all items to LUFS of loudest/quietest item

Hi,

I'm interested in a script that could normalise all items to the LUFS (integrated) level of the loudest or quietest selected item. I'm happy to pay someone a little for their time.

Or, if this script already exists somewhere or there is some way to make a custom action that accomplishes this, please let me know.

Tom
Hippocratic Mastering is offline   Reply With Quote
Old 10-11-2017, 03:28 AM   #2
Jonas Ekstrom
Human being with feelings
 
Jonas Ekstrom's Avatar
 
Join Date: Feb 2017
Location: Stockholm
Posts: 98
Default

Quote:
Originally Posted by Hippocratic Mastering View Post
Hi,

I'm interested in a script that could normalise all items to the LUFS (integrated) level of the loudest or quietest selected item. I'm happy to pay someone a little for their time.

Or, if this script already exists somewhere or there is some way to make a custom action that accomplishes this, please let me know.

Tom
Should work with the Sws extension.
__________________
Jonas Ekstrom
www.northmastering.com
Jonas Ekstrom is offline   Reply With Quote
Old 10-11-2017, 03:32 AM   #3
Hippocratic Mastering
Human being with feelings
 
Join Date: Sep 2016
Posts: 42
Default

Yes, I have the SWS extensions but, unless I'm missing something, there's no way to perform this task with a single action - I have to normalise all the items to a common value (say -20 LUFS) and then manually bring everything back to the original level of the loudest/quietest item.

I'm after a script that can leave the loudest/quietest item untouched (it doesn't really matter to me whether it's the loudest or quietest, but a choice would be nice) and bring everything else to that level, without any extra thought or action.
Hippocratic Mastering is offline   Reply With Quote
Old 10-11-2017, 10:32 AM   #4
Jonas Ekstrom
Human being with feelings
 
Jonas Ekstrom's Avatar
 
Join Date: Feb 2017
Location: Stockholm
Posts: 98
Default

Quote:
Originally Posted by Hippocratic Mastering View Post
Yes, I have the SWS extensions but, unless I'm missing something, there's no way to perform this task with a single action - I have to normalise all the items to a common value (say -20 LUFS) and then manually bring everything back to the original level of the loudest/quietest item.

I'm after a script that can leave the loudest/quietest item untouched (it doesn't really matter to me whether it's the loudest or quietest, but a choice would be nice) and bring everything else to that level, without any extra thought or action.
True. Would be cool to do this for sure.
Don´t know if sws can output data of lufs levels. Someone brilliant here will certainly come along with a cool solution.
__________________
Jonas Ekstrom
www.northmastering.com
Jonas Ekstrom is offline   Reply With Quote
Old 10-11-2017, 10:59 AM   #5
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 7,268
Default

Yes this is possible with the latest SWS extension and a script or two, one for maximum and one for minimum. I've been recently doing some coding for LUFS normalizations
heda is offline   Reply With Quote
Old 10-11-2017, 11:43 AM   #6
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

Quote:
Originally Posted by Hippocratic Mastering View Post
Hi,

I'm interested in a script that could normalise all items to the LUFS (integrated) level of the loudest or quietest selected item. I'm happy to pay someone a little for their time.

Or, if this script already exists somewhere or there is some way to make a custom action that accomplishes this, please let me know.

Tom
All items in project or all selected items?
All takes of items or just active take?

I guess the second for both questions.. but just to be sure...
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 10-11-2017, 12:22 PM   #7
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

Normalize all selected items' active takes to the LUFS of the loudest one

Code:
local reaper, math = reaper, math

local cnt = reaper.CountSelectedMediaItems( 0 )
local LUFS = -1000
local takes = {}
if cnt > 1 then
  for i = 0, cnt-1 do
    local selitem = reaper.GetSelectedMediaItem( 0, i )
    local acttake = reaper.GetActiveTake(selitem)
    if acttake then
      local takevolenv = 20*math.log(reaper.GetMediaItemTakeInfo_Value( acttake, "D_VOL"), 10)
      local _, lufsIntegrated = reaper.NF_AnalyzeTakeLoudness_IntegratedOnly( acttake )
      takes[i+1] = {take = acttake, lufs = lufsIntegrated - takevolenv }
      if lufsIntegrated > LUFS then LUFS = lufsIntegrated end
    end
  end
  for i = 1, #takes do
    if takes[i].lufs ~= LUFS then
      reaper.SetMediaItemTakeInfo_Value(takes[i].take, "D_VOL", 10^((LUFS - takes[i].lufs)/20) )
    end
  end
  reaper.UpdateArrange()
end
reaper.Undo_OnStateChange( "Normalize all selected items to the LUFS of the loudest one" )
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 10-14-2017, 02:09 AM   #8
Jonas Ekstrom
Human being with feelings
 
Jonas Ekstrom's Avatar
 
Join Date: Feb 2017
Location: Stockholm
Posts: 98
Default

Quote:
Originally Posted by amagalma View Post
Normalize all selected items' active takes to the LUFS of the loudest one

Code:
local reaper, math = reaper, math

local cnt = reaper.CountSelectedMediaItems( 0 )
local LUFS = -1000
local takes = {}
if cnt > 1 then
  for i = 0, cnt-1 do
    local selitem = reaper.GetSelectedMediaItem( 0, i )
    local acttake = reaper.GetActiveTake(selitem)
    if acttake then
      local takevolenv = 20*math.log(reaper.GetMediaItemTakeInfo_Value( acttake, "D_VOL"), 10)
      local _, lufsIntegrated = reaper.NF_AnalyzeTakeLoudness_IntegratedOnly( acttake )
      takes[i+1] = {take = acttake, lufs = lufsIntegrated - takevolenv }
      if lufsIntegrated > LUFS then LUFS = lufsIntegrated end
    end
  end
  for i = 1, #takes do
    if takes[i].lufs ~= LUFS then
      reaper.SetMediaItemTakeInfo_Value(takes[i].take, "D_VOL", 10^((LUFS - takes[i].lufs)/20) )
    end
  end
  reaper.UpdateArrange()
end
reaper.Undo_OnStateChange( "Normalize all selected items to the LUFS of the loudest one" )
Awesome!
But how do i run this code?
__________________
Jonas Ekstrom
www.northmastering.com
Jonas Ekstrom is offline   Reply With Quote
Old 10-14-2017, 05:13 AM   #9
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,108
Default

Show action list, click on ReaScript: New... button

Give it a name in the "New script" save dialog. (Make sure it's saved as .lua filetype)

Paste the code to the ReaScript Development Environment window that comes up, press Ctrl + S to save it. Now you can run the script from the action list.
nofish is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 07:07 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.