'Task'
Please modify my script to allow for a dropdown option between UI Image and Mesh, when mesh is selected show a mesh selection for references, when a UI Image is selected show a UI Image selection for references. Please adjust the script to be able to do what was asked if it's a mesh selection then render the waveform on the meshes material and use the meshes uv to understand how to render it properly on any mesh based off uvmap. Provide both scripts in full tysm.

'WaveformRenderer.cs'
using UnityEngine;
using UnityEngine.UI;

public class WaveformRenderer : MonoBehaviour
{
    public enum WaveformStyle
    {
        Normal,
        Noisey,
        Blocks
    }

    [Header("References")]

    [Tooltip("UI Image component where the waveform will be displayed.")]
    [SerializeField] private Image waveformImage;

    [Tooltip("Audio clip from which the waveform is generated.")]
    [SerializeField] private AudioClip audioClip;

    [Header("Waveform Settings")]

    [Tooltip("Color used to draw the waveform.")]
    [SerializeField] private Color waveformColor = Color.green;

    [Tooltip("Select waveform rendering style.")]
    [SerializeField] private WaveformStyle waveformStyle = WaveformStyle.Normal;

    [Tooltip("Block size (in pixels) for Blocks (voxel) style.")]
    [SerializeField, Min(1)] private int voxelBlockSize = 4;

    [Tooltip("Chance (0 to 1) that a pixel segment will be skipped in Noisey style.")]
    [Range(0f, 1f)]
    [SerializeField] private float noiseFactor = 0.2f;

    public Image WaveformImage => waveformImage;
    public AudioClip AudioClip => audioClip;
    public Color WaveformColor => waveformColor;
    public WaveformStyle Style => waveformStyle;
    public int VoxelBlockSize => voxelBlockSize;
    public float NoiseFactor => noiseFactor;

    public void RenderWaveform()
    {
        if (audioClip == null)
        {
            Debug.LogError("[WaveformRenderer] AudioClip reference is not assigned.");
            return;
        }

        if (waveformImage == null)
        {
            Debug.LogError("[WaveformRenderer] Waveform Image reference is not assigned.");
            return;
        }

        RectTransform rectTransform = waveformImage.rectTransform;

        Vector2 scaledSize = new Vector2(
            rectTransform.rect.width * rectTransform.lossyScale.x,
            rectTransform.rect.height * rectTransform.lossyScale.y);

        int width = Mathf.Max(1, Mathf.RoundToInt(scaledSize.x));
        int height = Mathf.Max(1, Mathf.RoundToInt(scaledSize.y));

        Texture2D waveformTexture = GenerateWaveformTexture(audioClip, width, height, waveformColor, waveformStyle);

        ApplyTextureToImage(waveformTexture);
    }

    private Texture2D GenerateWaveformTexture(AudioClip clip, int width, int height, Color color, WaveformStyle style)
    {
        Texture2D texture = new Texture2D(width, height, TextureFormat.RGBA32, false);
        texture.filterMode = FilterMode.Point;

        Color32 transparent = new Color32(0, 0, 0, 0);
        Color32[] clearPixels = new Color32[width * height];
        for (int i = 0; i < clearPixels.Length; i++)
            clearPixels[i] = transparent;
        texture.SetPixels32(clearPixels);

        float[] samples = new float[clip.samples * clip.channels];
        clip.GetData(samples, 0);

        int channels = clip.channels;
        int midHeight = height / 2;
        int samplesPerPixel = Mathf.Max((samples.Length / channels) / width, 1);

        System.Random rnd = new System.Random(12345);

        for (int x = 0; x < width; x++)
        {
            int sampleStartIndex = x * samplesPerPixel * channels;
            int sampleEndIndex = Mathf.Min(sampleStartIndex + samplesPerPixel * channels, samples.Length);

            float maxAmplitude = 0f;

            for (int i = sampleStartIndex; i < sampleEndIndex; i += channels)
            {
                float amplitude = Mathf.Abs(samples[i]);
                if (amplitude > maxAmplitude)
                    maxAmplitude = amplitude;
            }

            maxAmplitude = Mathf.Clamp01(maxAmplitude);

            switch (style)
            {
                case WaveformStyle.Normal:
                    DrawVerticalLine(texture, x, midHeight, maxAmplitude, color);
                    break;

                case WaveformStyle.Noisey:
                    DrawNoiseyCutoutLine(texture, x, midHeight, maxAmplitude, color, rnd, noiseFactor);
                    break;

                case WaveformStyle.Blocks:
                    DrawVoxelBlocks(texture, x, midHeight, maxAmplitude, color, voxelBlockSize);
                    break;
            }
        }

        texture.Apply();
        return texture;
    }

    private void DrawVerticalLine(Texture2D texture, int x, int midHeight, float amplitude, Color color)
    {
        int height = texture.height;
        int amplitudeHeight = Mathf.RoundToInt(amplitude * midHeight);
        int startY = Mathf.Clamp(midHeight - amplitudeHeight, 0, height - 1);
        int endY = Mathf.Clamp(midHeight + amplitudeHeight, 0, height - 1);

        for (int y = startY; y <= endY; y++)
            texture.SetPixel(x, y, color);
    }

    private void DrawNoiseyCutoutLine(Texture2D texture, int x, int midHeight, float amplitude, Color color, System.Random rnd, float noiseFactor)
    {
        int height = texture.height;
        int amplitudeHeight = Mathf.RoundToInt(amplitude * midHeight);
        int startY = Mathf.Clamp(midHeight - amplitudeHeight, 0, height - 1);
        int endY = Mathf.Clamp(midHeight + amplitudeHeight, 0, height - 1);

        for (int y = startY; y <= endY; y++)
        {
            if (rnd.NextDouble() < noiseFactor)
                continue;
            texture.SetPixel(x, y, color);
        }
    }

    private void DrawVoxelBlocks(Texture2D texture, int x, int midHeight, float amplitude, Color color, int blockSize)
    {
        int height = texture.height;
        int amplitudeHeight = Mathf.RoundToInt(amplitude * midHeight);

        int blocksCount = amplitudeHeight / blockSize;
        if (blocksCount == 0 && amplitude > 0f)
            blocksCount = 1;

        for (int i = 0; i < blocksCount; i++)
        {
            int blockCenterYTop = midHeight + i * blockSize + blockSize / 2;
            int blockCenterYBottom = midHeight - (i + 1) * blockSize + blockSize / 2;

            DrawBlock(texture, x, blockCenterYTop, blockSize, color);
            DrawBlock(texture, x, blockCenterYBottom, blockSize, color);
        }
    }

    private void DrawBlock(Texture2D texture, int centerX, int centerY, int blockSize, Color color)
    {
        int halfSize = blockSize / 2;
        int xStart = Mathf.Clamp(centerX - halfSize, 0, texture.width - 1);
        int xEnd = Mathf.Clamp(centerX + halfSize, 0, texture.width - 1);
        int yStart = Mathf.Clamp(centerY - halfSize, 0, texture.height - 1);
        int yEnd = Mathf.Clamp(centerY + halfSize, 0, texture.height - 1);

        for (int x = xStart; x <= xEnd; x++)
            for (int y = yStart; y <= yEnd; y++)
                texture.SetPixel(x, y, color);
    }

    private void ApplyTextureToImage(Texture2D texture)
    {
        Sprite waveformSprite = Sprite.Create(
            texture,
            new Rect(0, 0, texture.width, texture.height),
            new Vector2(0.5f, 0.5f));

        waveformImage.sprite = waveformSprite;
        waveformImage.color = Color.white;
        waveformImage.preserveAspect = true;
    }
}

'WaveformRendererEditor'
using UnityEngine;
using UnityEditor;

[CustomEditor(typeof(WaveformRenderer))]
public class WaveformRendererEditor : Editor
{
    SerializedProperty waveformImageProp;
    SerializedProperty audioClipProp;
    SerializedProperty waveformColorProp;
    SerializedProperty waveformStyleProp;
    SerializedProperty voxelBlockSizeProp;
    SerializedProperty noiseFactorProp;

    void OnEnable()
    {
        waveformImageProp = serializedObject.FindProperty("waveformImage");
        audioClipProp = serializedObject.FindProperty("audioClip");
        waveformColorProp = serializedObject.FindProperty("waveformColor");
        waveformStyleProp = serializedObject.FindProperty("waveformStyle");
        voxelBlockSizeProp = serializedObject.FindProperty("voxelBlockSize");
        noiseFactorProp = serializedObject.FindProperty("noiseFactor");
    }

    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        EditorGUILayout.PropertyField(waveformImageProp);
        EditorGUILayout.PropertyField(audioClipProp);
        EditorGUILayout.PropertyField(waveformColorProp);

        EditorGUILayout.PropertyField(waveformStyleProp);

        WaveformRenderer.WaveformStyle style = (WaveformRenderer.WaveformStyle)waveformStyleProp.enumValueIndex;

        if (style == WaveformRenderer.WaveformStyle.Blocks)
        {
            EditorGUILayout.PropertyField(voxelBlockSizeProp);
        }
        else if (style == WaveformRenderer.WaveformStyle.Noisey)
        {
            EditorGUILayout.PropertyField(noiseFactorProp, new GUIContent("Noise Factor"));
        }

        serializedObject.ApplyModifiedProperties();

        GUILayout.Space(10);

        if (GUILayout.Button("Render Waveform"))
        {
            (target as WaveformRenderer).RenderWaveform();
        }
    }
}