adjust my script and send it back fixed don't break anything please: I need you to make the script not listen to all audio all over the PC that's just pointless for what I asked for sadly but uh, what I really need is to be able to pass a naudio waveout in the class usage example itself that way I only target the one I need not the whole systems sound.

using System;
using System.Drawing;
using System.Windows.Forms;
using NAudio.CoreAudioApi;
using NAudio.Dsp;
using NAudio.Wave;

public class AudioVisualizer : IDisposable
{
    private readonly Panel _panel;
    private readonly Color _barColor;
    private readonly int _barCount;
    private readonly int _fftLength = 1024; // power of two for FFT

    private readonly Complex[] _fftComplexBuffer;
    private readonly float[] _fftBuffer;
    private float[] _previousBarHeights;

    private WasapiLoopbackCapture _capture;
    private BufferedWaveProvider _bufferedWaveProvider;

    private System.Windows.Forms.Timer _refreshTimer;

    private Bitmap _offscreenBitmap;

    private const float DecayFactor = 0.05f; // controls how fast bars fall

    public AudioVisualizer(Panel panel, Color barColor, int barCount = 32)
    {
        if (panel == null) throw new ArgumentNullException(nameof(panel));
        _panel = panel;
        _barColor = barColor;
        _barCount = barCount;

        _fftComplexBuffer = new Complex[_fftLength];
        _fftBuffer = new float[_fftLength];
        _previousBarHeights = new float[_barCount];

        SetupAudioCapture();
        SetupTimer();

        EnableDoubleBuffering(_panel);
        _panel.BackColor = Color.Black;

        // Hook Paint event for rendering
        _panel.Paint += Panel_Paint;
        _panel.Resize += Panel_Resize;
    }

    private void SetupAudioCapture()
    {
        try
        {
            _capture = new WasapiLoopbackCapture();
            _capture.DataAvailable += Capture_DataAvailable;
            _bufferedWaveProvider = new BufferedWaveProvider(_capture.WaveFormat)
            {
                BufferLength = _fftLength * 4,
                DiscardOnBufferOverflow = true,
            };
            _capture.StartRecording();
        }
        catch (Exception ex)
        {
            MessageBox.Show($"Audio capture initialization failed:\n{ex.Message}");
        }
    }

    private void SetupTimer()
    {
        _refreshTimer = new System.Windows.Forms.Timer();
        _refreshTimer.Interval = 15; // ~66 FPS smooth animation
        _refreshTimer.Tick += (s, e) => _panel.Invalidate();
        _refreshTimer.Start();
    }

    private void Capture_DataAvailable(object sender, WaveInEventArgs e)
    {
        _bufferedWaveProvider?.AddSamples(e.Buffer, 0, e.BytesRecorded);
    }

    private void Panel_Resize(object sender, EventArgs e)
    {
        _offscreenBitmap?.Dispose();
        _offscreenBitmap = new Bitmap(_panel.ClientSize.Width, _panel.ClientSize.Height);
    }

    private void Panel_Paint(object sender, PaintEventArgs e)
    {
        if (_panel.ClientSize.Width == 0 || _panel.ClientSize.Height == 0)
            return; // nothing to paint

        if (_offscreenBitmap == null ||
            _offscreenBitmap.Width != _panel.ClientSize.Width ||
            _offscreenBitmap.Height != _panel.ClientSize.Height)
        {
            _offscreenBitmap?.Dispose();
            _offscreenBitmap = new Bitmap(_panel.ClientSize.Width, _panel.ClientSize.Height);
        }

        // Read audio bytes from buffer
        byte[] audioBytes = new byte[_fftLength * 4];
        int bytesRead = _bufferedWaveProvider.Read(audioBytes, 0, audioBytes.Length);
        if (bytesRead == 0)
        {
            // No data, smooth decay bars to zero
            DecayBars(_panel.ClientSize.Height);
            DrawBars(e.Graphics, _panel.ClientSize.Width, _panel.ClientSize.Height);
            return;
        }

        int samplesRead = bytesRead / 4; // 4 bytes per 32-bit float

        // Convert bytes to floats
        for (int i = 0; i < _fftLength; i++)
        {
            if (i < samplesRead)
                _fftBuffer[i] = BitConverter.ToSingle(audioBytes, i * 4);
            else
                _fftBuffer[i] = 0f;
        }

        for (int i = 0; i < _fftLength; i++)
        {
            _fftComplexBuffer[i].X = (float)(_fftBuffer[i] * FastFourierTransform.HammingWindow(i, _fftLength));
            _fftComplexBuffer[i].Y = 0f;
        }

        // FFT in-place transform
        FastFourierTransform.FFT(true, (int)Math.Log(_fftLength, 2.0), _fftComplexBuffer);

        UpdateBarHeights(_panel.ClientSize.Height);

        using (var g = Graphics.FromImage(_offscreenBitmap))
        {
            g.Clear(Color.Transparent);
            DrawBars(g, _panel.ClientSize.Width, _panel.ClientSize.Height);
        }

        e.Graphics.DrawImageUnscaled(_offscreenBitmap, 0, 0);
    }

    private void UpdateBarHeights(int panelHeight)
    {
        int bars = _barCount;
        int binsPerBar = (_fftLength / 2) / bars;

        for (int bar = 0; bar < bars; bar++)
        {
            int start = bar * binsPerBar;
            int end = (bar + 1) * binsPerBar;

            double avgMagnitude = 0;

            for (int bin = start; bin < end; bin++)
            {
                float re = _fftComplexBuffer[bin].X;
                float im = _fftComplexBuffer[bin].Y;
                double mag = Math.Sqrt(re * re + im * im);
                avgMagnitude += mag;
            }
            avgMagnitude /= binsPerBar;

            double db = 20 * Math.Log10(avgMagnitude);
            if (double.IsInfinity(db) || db < -100)
                db = -100;

            double norm = (db + 100) / 100; // 0..1

            float targetHeight = (float)(norm * panelHeight);
            if (targetHeight > _previousBarHeights[bar])
            {
                // Jump up immediately
                _previousBarHeights[bar] = targetHeight;
            }
            else
            {
                // Smooth decay
                _previousBarHeights[bar] -= DecayFactor * panelHeight;
                if (_previousBarHeights[bar] < 0)
                    _previousBarHeights[bar] = 0;
            }
        }
    }

    // Called when no data is available to smoothly decay bars down to zero
    private void DecayBars(int panelHeight)
    {
        for (int i = 0; i < _previousBarHeights.Length; i++)
        {
            _previousBarHeights[i] -= DecayFactor * panelHeight;
            if (_previousBarHeights[i] < 0)
                _previousBarHeights[i] = 0;
        }
    }

    private void DrawBars(Graphics g, int width, int height)
    {
        int barWidth = Math.Max(width / _barCount, 2);
        float spacing = 2;

        using (Brush brush = new SolidBrush(_barColor))
        {
            for (int i = 0; i < _barCount; i++)
            {
                float x = i * (barWidth + spacing);
                float barHeight = _previousBarHeights[i];
                float y = height - barHeight;

                if (barHeight > 0)
                    g.FillRectangle(brush, x, y, barWidth, barHeight);
            }
        }
    }

    private void EnableDoubleBuffering(Control control)
    {
        var prop = typeof(Control).GetProperty("DoubleBuffered", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
        prop?.SetValue(control, true);
    }

    public void Dispose()
    {
        if (_capture != null)
        {
            _capture.DataAvailable -= Capture_DataAvailable;
            _capture.StopRecording();
            _capture.Dispose();
            _capture = null;
        }
        _refreshTimer?.Stop();
        _refreshTimer?.Dispose();
        _refreshTimer = null;
        _offscreenBitmap?.Dispose();
        _offscreenBitmap = null;

        _panel.Paint -= Panel_Paint;
        _panel.Resize -= Panel_Resize;
    }
}