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

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?

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”.

Is it possible to batch analyze all of the files in a given folder? and create a report ?

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.

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:

#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)

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): ')

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)
			aboveThreshold_SumOfLoudness += loudness
			aboveThreshold_Quantity += 1
	elif displayInvalidEntries == 'y':
		print("Loudness of "+filename+" could not be read ("+loudnessString+" LUFS)")

print(str(len(filesToProcess))+' files under threshold.')
print('NOTE: Average loudness of files *above* threshold was '+str(aboveThreshold_SumOfLoudness/aboveThreshold_Quantity)+' LUFS')
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:
	cwd = os.getcwd()

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


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.