[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Audio editing



Abin,

It may be easier to do this in a scriptable environment like Praat instead of Audition. I have attached a script that you can use in Praat to scale the intensities of all sounds in a folder to a selected level. If the sounds clip, it will alert you and offer you the option of decreasing your target intensity level. This way, you can prevent any clipping in the output files. In the end, you will have a folder full of normalized sounds and an info text file to let you know what changes were applied. None of the original sounds are altered.

This is designed to use for a folder full of short sounds (i.e. words), and might not be ideal for longer sounds. It does not perform compression. 

 

Regarding naturalness - you should be aware that compression and (to a lesser extent) normalization actually decrease the naturalness of the signals by altering each of them in different ways. There are some inherent volume differences between some speech sounds (e.g. /s/ is louder than /f/, /a/ is louder than /u/), so normalizing levels for these sounds would decrease naturalness to some extent. 



Good luck,

Matt


On Mon, Dec 17, 2012 at 5:05 PM, Abin Kuruvilla Mathew <amat527@xxxxxxxxxxxxxxxxx> wrote:
Dear All,

I have a set of audio files (consonants and vowels) to be editied in Adobe audition and was wondering to what extent and how much of Normalization (RMS) and dynamic compression (if necessary) would be needed so that the naturalness is preserved and clipping doesn't occur.

kind regards,
Abin

--
Abin K. Mathew
Doctoral student
Department of Psychology (Speech Science)
Tamaki Campus, 261 Morrin Road, Glen Innes
The University of Auckland
Private Bag 92019
Auckland- 1142
New Zealand


## Scale intensity fo all sounds in a Directory
##### Check for clipped extrema

## Matthew B. Winn
## December 2012

## NOTE: It helps to have the Praat info window open as you run this script,
###### as it will update info for you as it proceeds. 

## Once the script is done and you choose to save the files, 
#### Look in the original sound directory - there you will find a new sub-folder of normalized sounds. 

form Input Enter specifications for Intensity scaling
    comment Enter desired intensity (dB):
    	real intensity 75
    comment Enter directory where the ORIGINAL sound files will be retrieved:
    	sentence soundDir C:\Enter-Your-Directory-Here
    comment Enter filename to which the info should be written
    	sentence outFile intensity_info.txt
endform



call changeIntensities


procedure changeIntensities
	clearinfo
	clippedSounds = 0

	# Reads in a list of files
	Create Strings as file list... list 'soundDir$'\*.wav
	numberOfFiles = Get number of strings

	for ifile to numberOfFiles
	   select Strings list
	      fileName$ = Get string... ifile
	      name$ = fileName$ - ".wav"

		# Reads in all sound (wav) files
		Read from file... 'soundDir$'\'name$'.wav

		old_Int = Get intensity (dB)
			print 'name$' intensity was 'old_Int:2'   

		Scale intensity... 'intensity'
		int_diff = 'intensity' - 'old_Int'
			print and was changed by 'int_diff:2' to reach 'intensity:2' 'tab$'

		max = Get absolute extremum... 0 0 Sinc70
		if max >= 1
			clippedSounds = clippedSounds + 1
			print CLIPPED
		endif
		
		print 'newline$'

	endfor

	call userSelectSave
endproc

procedure userSelectSave
	choice = 1

   beginPause ("'clippedSounds' sounds have been clipped")
   	comment ("'clippedSounds' sounds have been clipped")
	comment ("Do you want to save the files?")
       optionMenu ("Choice", choice)
          option ("Yes - save the sounds")
          option ("No - Quit")
          option ("Lower level by 1 dB and try again")
          option ("Lower level by 2 dB and try again")
          option ("Lower level by 3 dB and try again")
          option ("Lower level by 4 dB and try again")
          option ("Lower level by 5 dB and try again")

       comment ("Then click Continue.")

endPause ("Continue", 1)
 	if choice = 1
 		call saveSounds

 	elsif choice = 2
 		select all
 		Remove
 	else
 	 	select all
 		Remove
	 	intensity = intensity-(choice-2)
	 	call changeIntensities
	endif
endproc

procedure saveSounds
	# makes a directory
	system mkdir 'soundDir$'\Intensity'intensity'

	# first deletes any existing output file
		filedelete 'soundDir$'\'outFile$'

	# creates simple header		
		fileappend Step 'tab$' Duration 'tab$' 'newline$'

	for ifile to numberOfFiles
	   select Strings list
	      fileName$ = Get string... ifile
	      name$ = fileName$ - ".wav"
		select Sound 'name$'
		Save as WAV file... 'soundDir$'\Intensity'intensity'\'name$'.wav
	endfor


	call saveInfoWindow "'soundDir$'\Intensity'intensity'" IntensityInfo

select Strings list
Remove
endproc

procedure saveInfoWindow outputDirectory$ outputFileName$
	filedelete 'outputDirectory$'\'outputFileName$'.txt
	fappendinfo 'outputDirectory$'\'outputFileName$'.txt
endproc

# # ## ### ##### ######## ############# ##################### ##################################