Adding files to batch process via XML filter based on a defined loudness threshold

All topics on WaveLab 9 and WaveLab Elements 9
Post Reply
diode303
New Member
Posts: 17
Joined: Wed Sep 18, 2013 2:43 am
Location: Melbourne, Australia
Contact:

Adding files to batch process via XML filter based on a defined loudness threshold

Post by diode303 » Thu May 02, 2019 2:41 am

I have a large number of files, and I want to perform loudness normalization ONLY on files that are below a set integrated loudness threshold.
I have used the Audio Analyzer plugin to generate an XML report of the all the files in question with the integrated loudness of each. I can also see that the batch processor accepts XML files, and that there is an "Optional Parameters" field for (presumably) filtering results. From here I'm not entirely sure how to proceed. The documentation seems a bit light on details.

Can I actually filter for results where loudness is below a set threshold? If so, how would I go about doing this?

Thanks in advance.

EDIT: I might be barking up the wrong tree with the XML tab. Is this for generating an XML report on the results of the batch process?

PG
Moderator
Posts: 6747
Joined: Wed Dec 15, 2010 6:15 pm
Contact:

Re: Adding files to batch process via XML filter based on a defined loudness threshold

Post by PG » Thu May 02, 2019 7:52 am

Can I actually filter for results where loudness is below a set threshold?
No, there is no way.
You are not the first one to ask.

The batch processor is able to accept XML files as input. That is, one XML file can tell what (single) audio file to process.
The "XML Audio Description" dialog is to describe how WaveLab should interpret that XML file.

The XML tab is for advanced use, for people to transform the input XML file, or generate one, from the input XML file.

In your case, the easiest path would be to create a file list (not XML) of all the files you want to process, and use the batch function "Insert List of File Names".
Philippe

Jtransition
New Member
Posts: 32
Joined: Fri Jan 24, 2014 4:18 pm
Contact:

Re: Adding files to batch process via XML filter based on a defined loudness threshold

Post by Jtransition » Mon May 13, 2019 3:06 pm

Is it possible to batch analyze all of the files in a given folder? and create a report ?
Pc Spec
Intel i7 Kayblake 4.2GHz (turbo boost) 4 Core 8 Thread
Asus B250+ Motherboard, PCI and PCIe
8GB DDR4 12666MHz RAM
500GB SSD OS/Current Projects
1TB HDD Storage

www.transitionmastering.uk

PG
Moderator
Posts: 6747
Joined: Wed Dec 15, 2010 6:15 pm
Contact:

Re: Adding files to batch process via XML filter based on a defined loudness threshold

Post by PG » Mon May 13, 2019 3:35 pm

Yes, there is the Audio Analysis plugin made for this, which is a batch specific plugin.
And of course, the batch can be fed with the contents of a folder.
Philippe

diode303
New Member
Posts: 17
Joined: Wed Sep 18, 2013 2:43 am
Location: Melbourne, Australia
Contact:

Re: Adding files to batch process via XML filter based on a defined loudness threshold

Post by diode303 » Fri May 24, 2019 6:31 am

Thanks Philippe, that's a shame - hopefully something for a future version!
I ended up writing a python script which does the job. Here it is:

Code: Select all

#Takes XML output from WaveLab's Audio Analyzer plugin, reads integrated loudness for each entry
#and then generates a text file of all audio files below a user defined threshold.
#This text file can then be read in to WaveLab's batch processor for importing analyzed files
#that were below threshold.

import xml.etree.ElementTree as ET
import os

path = input('Drag and drop input WaveLab XML file (or enter absolute path): ')

tree = ET.parse(path)
root = tree.getroot()

filesToProcess = []
aboveThreshold_Quantity = float(0)
aboveThreshold_SumOfLoudness = float(0)

print()
loudnessThreshold = input('Enter integrated loudness threshold in LUFS: ')
loudnessThreshold = float(loudnessThreshold)
displayInvalidEntries = input('Display invalid entries (typically these will be files that were too short to obtain integrated loudness)? (y/n): ')
print()

for file in root:
	filename = file[0].text
	loudnessString = (file[1].text).partition(" ")[0]
	loudness = float()
	
	if loudnessString != '-∞':
		loudness = float(loudnessString)
		
		if loudness < loudnessThreshold:
			print('('+loudnessString+' LUFS) '+filename)
			filesToProcess.append(filename)
		else:
			aboveThreshold_SumOfLoudness += loudness
			aboveThreshold_Quantity += 1
	
	elif displayInvalidEntries == 'y':
		print("Loudness of "+filename+" could not be read ("+loudnessString+" LUFS)")

print()
print(str(len(filesToProcess))+' files under threshold.')
print('NOTE: Average loudness of files *above* threshold was '+str(aboveThreshold_SumOfLoudness/aboveThreshold_Quantity)+' LUFS')
print()
logToFile = input('Log under-threshold results to WaveLab batch processor input file? (y/n): ')

if logToFile == 'y':
	outputFilename = input('Enter output filename (.txt will be appended): ')
	outputFilename = outputFilename+".txt"
	
	writeFile = open(outputFilename,"w+")
	
	for file in filesToProcess:
		writeFile.write(file+"\n")
	
	cwd = os.getcwd()

	if os.path.isfile(cwd+'\\'+outputFilename):
		print('Successfully wrote to '+cwd+'\\'+outputFilename)

print('\n')

PG
Moderator
Posts: 6747
Joined: Wed Dec 15, 2010 6:15 pm
Contact:

Re: Adding files to batch process via XML filter based on a defined loudness threshold

Post by PG » Sun May 26, 2019 1:10 pm

This is great if you could use WaveLab's output to achieve your goal. This is one intent of XML output to be able to achieve this kind of thing, and I am happy to see some realization.
Philippe

Post Reply

Return to “WaveLab Pro 9 | WaveLab Elements 9”

Who is online

Users browsing this forum: No registered users and 1 guest