Skip to content

Commit

Permalink
normalize output wav
Browse files Browse the repository at this point in the history
  • Loading branch information
ValdemarOrn committed Sep 3, 2017
1 parent 640f965 commit 10f2510
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,6 @@ packages*/
Build/*
Wavetables/*.wav
Wavetables/*/*.wav
Wavetables.zip
Wavetables.zip
Wav*/
Wav.zip
39 changes: 39 additions & 0 deletions BulkGeneration.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
IrWorkshop.Ui.exe -export -length 256 -samplerate 44100 -source "C:\Src\_Tree\Audio\IrWorkshop\Presets\Mono" -dest "C:\Src\_Tree\Audio\IrWorkshop\Wav\Mono\44.1\256" -mono
IrWorkshop.Ui.exe -export -length 256 -samplerate 48000 -source "C:\Src\_Tree\Audio\IrWorkshop\Presets\Mono" -dest "C:\Src\_Tree\Audio\IrWorkshop\Wav\Mono\48.0\256" -mono

IrWorkshop.Ui.exe -export -length 512 -samplerate 44100 -source "C:\Src\_Tree\Audio\IrWorkshop\Presets\Mono" -dest "C:\Src\_Tree\Audio\IrWorkshop\Wav\Mono\44.1\512" -mono
IrWorkshop.Ui.exe -export -length 512 -samplerate 48000 -source "C:\Src\_Tree\Audio\IrWorkshop\Presets\Mono" -dest "C:\Src\_Tree\Audio\IrWorkshop\Wav\Mono\48.0\512" -mono

IrWorkshop.Ui.exe -export -length 1024 -samplerate 44100 -source "C:\Src\_Tree\Audio\IrWorkshop\Presets\Mono" -dest "C:\Src\_Tree\Audio\IrWorkshop\Wav\Mono\44.1\1024" -mono
IrWorkshop.Ui.exe -export -length 1024 -samplerate 48000 -source "C:\Src\_Tree\Audio\IrWorkshop\Presets\Mono" -dest "C:\Src\_Tree\Audio\IrWorkshop\Wav\Mono\48.0\1024" -mono

IrWorkshop.Ui.exe -export -length 2048 -samplerate 44100 -source "C:\Src\_Tree\Audio\IrWorkshop\Presets\Mono" -dest "C:\Src\_Tree\Audio\IrWorkshop\Wav\Mono\44.1\2048" -mono
IrWorkshop.Ui.exe -export -length 2048 -samplerate 48000 -source "C:\Src\_Tree\Audio\IrWorkshop\Presets\Mono" -dest "C:\Src\_Tree\Audio\IrWorkshop\Wav\Mono\48.0\2048" -mono



IrWorkshop.Ui.exe -export -length 256 -samplerate 44100 -source "C:\Src\_Tree\Audio\IrWorkshop\Presets\StereoSmall" -dest "C:\Src\_Tree\Audio\IrWorkshop\Wav\StereoSmall\44.1\256"
IrWorkshop.Ui.exe -export -length 256 -samplerate 48000 -source "C:\Src\_Tree\Audio\IrWorkshop\Presets\StereoSmall" -dest "C:\Src\_Tree\Audio\IrWorkshop\Wav\StereoSmall\48.0\256"

IrWorkshop.Ui.exe -export -length 512 -samplerate 44100 -source "C:\Src\_Tree\Audio\IrWorkshop\Presets\StereoSmall" -dest "C:\Src\_Tree\Audio\IrWorkshop\Wav\StereoSmall\44.1\512"
IrWorkshop.Ui.exe -export -length 512 -samplerate 48000 -source "C:\Src\_Tree\Audio\IrWorkshop\Presets\StereoSmall" -dest "C:\Src\_Tree\Audio\IrWorkshop\Wav\StereoSmall\48.0\512"

IrWorkshop.Ui.exe -export -length 1024 -samplerate 44100 -source "C:\Src\_Tree\Audio\IrWorkshop\Presets\StereoSmall" -dest "C:\Src\_Tree\Audio\IrWorkshop\Wav\StereoSmall\44.1\1024"
IrWorkshop.Ui.exe -export -length 1024 -samplerate 48000 -source "C:\Src\_Tree\Audio\IrWorkshop\Presets\StereoSmall" -dest "C:\Src\_Tree\Audio\IrWorkshop\Wav\StereoSmall\48.0\1024"

IrWorkshop.Ui.exe -export -length 2048 -samplerate 44100 -source "C:\Src\_Tree\Audio\IrWorkshop\Presets\StereoSmall" -dest "C:\Src\_Tree\Audio\IrWorkshop\Wav\StereoSmall\44.1\2048"
IrWorkshop.Ui.exe -export -length 2048 -samplerate 48000 -source "C:\Src\_Tree\Audio\IrWorkshop\Presets\StereoSmall" -dest "C:\Src\_Tree\Audio\IrWorkshop\Wav\StereoSmall\48.0\2048"



IrWorkshop.Ui.exe -export -length 256 -samplerate 44100 -source "C:\Src\_Tree\Audio\IrWorkshop\Presets\StereoWide" -dest "C:\Src\_Tree\Audio\IrWorkshop\Wav\StereoWide\44.1\256"
IrWorkshop.Ui.exe -export -length 256 -samplerate 48000 -source "C:\Src\_Tree\Audio\IrWorkshop\Presets\StereoWide" -dest "C:\Src\_Tree\Audio\IrWorkshop\Wav\StereoWide\48.0\256"

IrWorkshop.Ui.exe -export -length 512 -samplerate 44100 -source "C:\Src\_Tree\Audio\IrWorkshop\Presets\StereoWide" -dest "C:\Src\_Tree\Audio\IrWorkshop\Wav\StereoWide\44.1\512"
IrWorkshop.Ui.exe -export -length 512 -samplerate 48000 -source "C:\Src\_Tree\Audio\IrWorkshop\Presets\StereoWide" -dest "C:\Src\_Tree\Audio\IrWorkshop\Wav\StereoWide\48.0\512"

IrWorkshop.Ui.exe -export -length 1024 -samplerate 44100 -source "C:\Src\_Tree\Audio\IrWorkshop\Presets\StereoWide" -dest "C:\Src\_Tree\Audio\IrWorkshop\Wav\StereoWide\44.1\1024"
IrWorkshop.Ui.exe -export -length 1024 -samplerate 48000 -source "C:\Src\_Tree\Audio\IrWorkshop\Presets\StereoWide" -dest "C:\Src\_Tree\Audio\IrWorkshop\Wav\StereoWide\48.0\1024"

IrWorkshop.Ui.exe -export -length 2048 -samplerate 44100 -source "C:\Src\_Tree\Audio\IrWorkshop\Presets\StereoWide" -dest "C:\Src\_Tree\Audio\IrWorkshop\Wav\StereoWide\44.1\2048"
IrWorkshop.Ui.exe -export -length 2048 -samplerate 48000 -source "C:\Src\_Tree\Audio\IrWorkshop\Presets\StereoWide" -dest "C:\Src\_Tree\Audio\IrWorkshop\Wav\StereoWide\48.0\2048"
1 change: 0 additions & 1 deletion BulkGeneration.txt

This file was deleted.

8 changes: 8 additions & 0 deletions IrWorkshop/ImpulsePresetProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ public double[][] Process()

output = mixingOutputProcessor.ProcessOutputStage();

// normalize output
var norms= new[] { Math.Abs(output[0].Min()), Math.Abs(output[0].Max()), Math.Abs(output[1].Min()), Math.Abs(output[1].Max()) };
var normalizer = norms.Max();
if (normalizer < 0.01) normalizer = 0.01;
var normInv = 1 / normalizer;
output[0] = output[0].Select(x => x * normInv).ToArray();
output[1] = output[1].Select(x => x * normInv).ToArray();

return new []
{
output[0].Take(preset.ImpulseLengthTransformed).ToArray(),
Expand Down
18 changes: 18 additions & 0 deletions MoveWavFiles.linq
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Query Kind="Statements" />

var files = Directory.GetFiles(@"C:\Src\_Tree\Audio\IrWorkshop\Wav\StereoWide", "*.wav", SearchOption.AllDirectories);

foreach (var file in files)
{
if (file.Contains("-L.wav") || file.Contains("-R.wav"))
{

}
else
{
var dir = Path.GetDirectoryName(file);
dir += "-Stereo";
Directory.CreateDirectory(dir);
File.Move(file, Path.Combine(dir, Path.GetFileName(file)));
}
}

0 comments on commit 10f2510

Please sign in to comment.