adjust my class, I want it to check the total length of the inputFile and if it's shorter than the fadelength then work within the bounds of the length, basically I want it to make the logic more solid like that and also make any other changes you think should best work I want your opinion, send full script back pls

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

public class SoxVolumeFader
{
    /// <summary>
    /// Applies fade in and fade out volume effect to an audio file using SoX.
    /// </summary>
    /// <param name="inputFile">Full path to the input audio file.</param>
    /// <param name="soxExePath">Full path to Sox executable.</param>
    /// <param name="fadeIn">Fade in duration in seconds.</param>
    /// <param name="fadeOut">Fade out duration in seconds.</param>
    /// <returns></returns>
    public static async Task ApplyFadeAsync(string inputFile, string soxExePath, float fadeIn, float fadeOut)
    {
        if (string.IsNullOrWhiteSpace(inputFile))
            throw new ArgumentException("Input file path is required.", nameof(inputFile));
        if (string.IsNullOrWhiteSpace(soxExePath))
            throw new ArgumentException("SoX executable path is required.", nameof(soxExePath));
        if (!File.Exists(inputFile))
            throw new FileNotFoundException("Input file not found.", inputFile);
        if (!File.Exists(soxExePath))
            throw new FileNotFoundException("SoX executable not found.", soxExePath);
        if (fadeIn < 0 || fadeOut < 0)
            throw new ArgumentOutOfRangeException("Fade durations must be non-negative.");

        string inputDir = Path.GetDirectoryName(inputFile);
        string inputFileName = Path.GetFileName(inputFile);
        string tempOutputFile = Path.Combine(inputDir, Path.GetFileNameWithoutExtension(inputFile) + "_fade_temp" + Path.GetExtension(inputFile));

        // SoX fade effect format: fade [type] fade-in-length stay-length fade-out-length
        // We'll use 't' as type for linear (triangle) fade.
        // 'stay-length' is the duration of the audio minus fadeIn and fadeOut times.
        // Because SoX requires total duration for fade, we will have to get audio duration first.

        var durationSeconds = await GetAudioDurationAsync(inputFile, soxExePath);

        if (durationSeconds < fadeIn + fadeOut)
            throw new InvalidOperationException("Fade durations exceed the length of the audio file.");

        float stayDuration = (float)(durationSeconds - fadeIn - fadeOut);

        // Build SoX arguments:
        // sox inputFile outputFile fade t fadeIn stayDuration fadeOut
        string args = $"\"{inputFile}\" \"{tempOutputFile}\" fade t {fadeIn} {stayDuration} {fadeOut}";

        var processInfo = new ProcessStartInfo
        {
            FileName = soxExePath,
            Arguments = args,
            CreateNoWindow = true,
            UseShellExecute = false,
            RedirectStandardError = true,
            RedirectStandardOutput = true
        };

        using (var process = new Process { StartInfo = processInfo })
        {
            var tcs = new TaskCompletionSource<bool>();

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

            process.Start();

            // Optionally read output/error
            string stdOut = await process.StandardOutput.ReadToEndAsync();
            string stdErr = await process.StandardError.ReadToEndAsync();

            await tcs.Task;

            if (process.ExitCode != 0)
                throw new Exception($"SoX process failed with exit code {process.ExitCode}: {stdErr}");
        }

        // Delete original file
        File.Delete(inputFile);

        // Rename output file to original filename
        File.Move(tempOutputFile, inputFile);
    }

    /// <summary>
    /// Gets the duration of the audio file in seconds using SoX.
    /// </summary>
    /// <param name="inputFile"></param>
    /// <param name="soxExePath"></param>
    /// <returns></returns>
    private static async Task<double> GetAudioDurationAsync(string inputFile, string soxExePath)
    {
        // sox --i outputs info about an audio file
        var processInfo = new ProcessStartInfo
        {
            FileName = soxExePath,
            Arguments = $"--i -D \"{inputFile}\"",
            CreateNoWindow = true,
            UseShellExecute = false,
            RedirectStandardOutput = true,
            RedirectStandardError = true,
        };

        using (var process = new Process { StartInfo = processInfo })
        {
            var tcs = new TaskCompletionSource<bool>();
            process.EnableRaisingEvents = true;
            process.Exited += (sender, e) => tcs.SetResult(true);

            process.Start();

            string output = await process.StandardOutput.ReadToEndAsync();
            string error = await process.StandardError.ReadToEndAsync();

            await tcs.Task;

            if (process.ExitCode != 0)
                throw new Exception($"SoX failed to get audio duration: {error}");

            if (double.TryParse(output.Trim(), out double duration))
            {
                return duration;
            }
            else
            {
                throw new Exception("Failed to parse audio duration from SoX output.");
            }
        }
    }
}