add a slightly fast fadeout to the output, return entire class fixed ty

using System;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;

public class SoxAudioNormalizer
{
    private readonly string _soxExePath;
    private readonly float _volumeReductionDb;

    public SoxAudioNormalizer(string soxExePath, float volumeReductionDb = -3.0f)
    {
        if (string.IsNullOrEmpty(soxExePath))
            throw new ArgumentException("SOX exe path cannot be null or empty.", nameof(soxExePath));
        if (!File.Exists(soxExePath))
            throw new FileNotFoundException("SOX exe not found at the specified path.", soxExePath);

        _soxExePath = soxExePath;
        _volumeReductionDb = volumeReductionDb;
    }

    /// <summary>
    /// Asynchronously normalizes the audio, lowers volume slightly, applies quality improvements,
    /// replaces original file.
    /// </summary>
    /// <param name="inputFile">Input audio file path</param>
    /// <returns></returns>
    public async Task NormalizeFileAsync(string inputFile)
    {
        if (string.IsNullOrEmpty(inputFile))
            throw new ArgumentException("Input file path cannot be null or empty.", nameof(inputFile));
        if (!File.Exists(inputFile))
            throw new FileNotFoundException("Input audio file not found.", inputFile);

        string directory = Path.GetDirectoryName(inputFile) ?? throw new InvalidOperationException("Cannot determine directory of input file.");
        string fileNameWithoutExt = Path.GetFileNameWithoutExtension(inputFile);
        string extension = Path.GetExtension(inputFile);
        string tempOutputFile = Path.Combine(directory, fileNameWithoutExt + "_normalized" + extension);

        // Build the args with quality improvements:
        // - Normalize volume by target gain (_volumeReductionDb)
        // - Apply highpass 20Hz to remove subsonic rumble
        // - Resample to 44100 Hz for consistent sample rate
        // - Apply gain -n for dither noise shaping when reducing bit depth (safe in general)
        // Note: This assumes output format matches input format (same extension)
        // If needed, can consider forcing WAV 16-bit output, but not requested.

        var args = $"-q \"{inputFile}\" \"{tempOutputFile}\" --norm={_volumeReductionDb} highpass 20 rate 44100 gain -n";

        await ExecuteProcessAsync(_soxExePath, args);

        // After successful processing:
        File.Delete(inputFile);
        File.Move(tempOutputFile, inputFile);
    }

    private async Task ExecuteProcessAsync(string exePath, string arguments)
    {
        using (var process = new Process())
        {
            process.StartInfo.FileName = exePath;
            process.StartInfo.Arguments = arguments;
            process.StartInfo.CreateNoWindow = true;
            process.StartInfo.UseShellExecute = false;
            process.StartInfo.RedirectStandardOutput = true;
            process.StartInfo.RedirectStandardError = true;

            var stdOutput = string.Empty;
            var stdError = string.Empty;

            var tcs = new TaskCompletionSource<int>();

            process.OutputDataReceived += (sender, e) =>
            {
                if (e.Data != null) stdOutput += e.Data + Environment.NewLine;
            };

            process.ErrorDataReceived += (sender, e) =>
            {
                if (e.Data != null) stdError += e.Data + Environment.NewLine;
            };

            process.EnableRaisingEvents = true;
            process.Exited += (sender, e) =>
            {
                tcs.TrySetResult(process.ExitCode);
            };

            if (!process.Start())
                throw new InvalidOperationException("Failed to start process.");

            process.BeginOutputReadLine();
            process.BeginErrorReadLine();

            int exitCode = await tcs.Task.ConfigureAwait(false);

            if (exitCode != 0)
            {
                throw new InvalidOperationException(
                    $"SOX process failed with exit code {exitCode}.\nStdOut: {stdOutput}\nStdErr: {stdError}");
            }
        }
    }
}