Skip to content

Instantly share code, notes, and snippets.

@Silenoid
Created April 21, 2023 13:44
Show Gist options
  • Save Silenoid/f796d0148a0ef89b4b1360a97aa544fe to your computer and use it in GitHub Desktop.
Save Silenoid/f796d0148a0ef89b4b1360a97aa544fe to your computer and use it in GitHub Desktop.
A Powershell script to normalize audio in bulk using SoX
# Loop through each .wav file in the current directory
$inputFiles = Get-ChildItem -Path . -Filter *.wav
$inputFiles | ForEach-Object -Parallel {
$newFilename = $_.BaseName + ".wav"
Write-Output ("Processing $newFilename")
$outputFile = Join-Path $_.DirectoryName "converted" $newFilename
# If the "converted" directory doesn't exists, create it
if (!(Test-Path "converted")) {
New-Item -ItemType Directory -Path "converted"
}
# interesting effects
# compand 0.3,1 6:-70,-60,-20 -1 0 0.2
& sox --norm=+8 $_.FullName $outputFile pitch -80 bass +8
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment