Powershell script to normalize audio to file to 0db using SOX (Sound eXchange)

This script will use SOX to normalize the audio file to 0db with a guard to avoid clipping. The script will make a new directory “Normalised” and save the output normalized file in it. Simply run the Powershell script and Drag & Drop the audio file onto the console, hit Enter, and let the magic happen. SOX Download

# Normalise to 0db v1
# justCurious @2020
# Please download SOX from here https://sourceforge.net/projects/sox/files/sox/ and it to your enviornment variable

Write-Host "Normaliser Pro+ by justCurious `n"

$size = (Get-Host).UI.RawUI.WindowSize
$size.Width = 80
$size.Height = 30
(Get-Host).UI.RawUI.WindowSize = $size

$audio = Read-Host -Prompt 'Drag & Drop the audio file'

$fileNameOnly = [System.IO.Path]::GetFileNameWithoutExtension("$audio")

Write-Host "You video file audio is being analysed"

New-Item -Path . -Name "Normalised" -ItemType "directory"

sox $audio ".\Normalised\$fileNameOnly.wav" --guard --norm

sox ".\Normalised\$fileNameOnly.wav" -n stat