I have a unity editor script that inferences with a server it works and everything but I need to make it accept text asset files instead of string text for references and take audio clips as audio references instead of loading a file please make adjustments and send entire script back fixed.

// Save as Assets/Editor/OAS1MEditorWindow.cs
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using UnityEditor;
using UnityEngine;

public class OAS1MEditorWindow : EditorWindow
{
    // Params
    private string _url = "http://127.0.0.1:8032/v1/tts";
    private string _text = "Hello World";
    private string _apiKey = "YOUR_API_KEY";
    private string _format = "wav";
    private int chunkLength = 0;
    private int maxNewTokens = 0;
    private float topP = 0.9f;
    private float temperature = 0.9f;
    private float repetitionPenalty = 1.1f;
    private int seed = 0;
    private List<string> referenceTexts = new List<string> { "Reference text" };
    private List<byte[]> referenceAudios = new List<byte[]>();
    private string outputFilePath = "";

    private Vector2 scroll;

    private Texture2D logoTexture;

    [MenuItem("Tools/OAS1M TTS")]
    public static void ShowWindow()
    {
        var window = GetWindow<OAS1MEditorWindow>("OAS1M TTS");
        window.minSize = new Vector2(400, 600);
    }

    private void OnEnable()
    {
        outputFilePath = Path.Combine(Application.persistentDataPath, $"output.{_format}");
        LoadLogo();
    }

    void LoadLogo()
    {
        // Load a logo from Resources folder (place your logo as Assets/Resources/oas1m_logo.png)
        logoTexture = Resources.Load<Texture2D>("oas1m_logo");
    }

    private void OnGUI()
    {
        scroll = EditorGUILayout.BeginScrollView(scroll);

        GUILayout.Space(10);

        if (logoTexture != null)
        {
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.Label(logoTexture, GUILayout.Width(256), GUILayout.Height(128));
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
        }

        GUILayout.Space(10);
        EditorGUILayout.LabelField("TTS Configuration", EditorStyles.boldLabel);
        EditorGUILayout.Space();

        _url = EditorGUILayout.TextField("URL", _url);
        _text = EditorGUILayout.TextField("Text", _text);
        _apiKey = EditorGUILayout.TextField("API Key", _apiKey);
        _format = EditorGUILayout.TextField("Format", _format);

        chunkLength = EditorGUILayout.IntField("Chunk Length", chunkLength);
        maxNewTokens = EditorGUILayout.IntField("Max New Tokens", maxNewTokens);
        topP = EditorGUILayout.Slider("Top P", topP, 0f, 1f);
        temperature = EditorGUILayout.Slider("Temperature", temperature, 0f, 2f);
        repetitionPenalty = EditorGUILayout.FloatField("Repetition Penalty", repetitionPenalty);
        seed = EditorGUILayout.IntField("Seed", seed);

        EditorGUILayout.Space();

        EditorGUILayout.LabelField("Reference Texts", EditorStyles.boldLabel);
        int removeIndex = -1;
        for (int i = 0; i < referenceTexts.Count; i++)
        {
            GUILayout.BeginHorizontal();
            referenceTexts[i] = EditorGUILayout.TextField(referenceTexts[i]);
            if (GUILayout.Button("X", GUILayout.Width(20))) removeIndex = i;
            GUILayout.EndHorizontal();
        }
        if (removeIndex >= 0)
        {
            referenceTexts.RemoveAt(removeIndex);
            referenceAudios.RemoveAt(removeIndex);
        }
        if (GUILayout.Button("+ Add Reference Text"))
        {
            referenceTexts.Add(string.Empty);
            referenceAudios.Add(null);
        }

        EditorGUILayout.Space();

        EditorGUILayout.LabelField("Reference Audios", EditorStyles.boldLabel);
        for (int i = 0; i < referenceAudios.Count; i++)
        {
            GUILayout.BeginHorizontal();
            string label = referenceAudios[i] != null ? $"Audio Byte[{referenceAudios[i].Length}]" : "No audio loaded";
            GUILayout.Label(label);
            if (GUILayout.Button("Load", GUILayout.Width(50)))
            {
                string path = EditorUtility.OpenFilePanel("Select Reference Audio", "", "wav,mp3");
                if (!string.IsNullOrEmpty(path))
                {
                    try
                    {
                        referenceAudios[i] = File.ReadAllBytes(path);
                    }
                    catch (Exception ex)
                    {
                        UnityEngine.Debug.LogError("Failed to load audio file: " + ex.Message);
                    }
                }
            }
            if (GUILayout.Button("Clear", GUILayout.Width(50)))
            {
                referenceAudios[i] = null;
            }
            GUILayout.EndHorizontal();
        }

        EditorGUILayout.Space();
        EditorGUILayout.LabelField("Output File Path", EditorStyles.boldLabel);
        outputFilePath = EditorGUILayout.TextField(outputFilePath);

        GUILayout.Space(20);

        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Generate Audio", GUILayout.Height(40)))
        {
            _ = GenerateAudioAsync();
        }
        if (GUILayout.Button("Boot OAS1M API Server", GUILayout.Height(40)))
        {
            BootOAS1M();
        }
        GUILayout.EndHorizontal();

        EditorGUILayout.EndScrollView();
    }

    private async Task GenerateAudioAsync()
    {
        if (referenceTexts.Count != referenceAudios.Count)
        {
            UnityEngine.Debug.LogError("Reference texts and reference audios counts do not match.");
            EditorUtility.DisplayDialog("Error", "Reference Texts and Reference Audios count mismatch.", "OK");
            return;
        }

        var client = new TTSClient(
            url: _url,
            text: _text,
            apiKey: _apiKey,
            referenceTexts: referenceTexts,
            referenceAudios: referenceAudios,
            format: _format,
            chunkLength: chunkLength,
            topP: topP,
            temperature: temperature,
            seed: seed,
            maxNewTokens: maxNewTokens,
            repetitionPenalty: repetitionPenalty,
            outputFilePath: outputFilePath
            );

        EditorUtility.DisplayProgressBar("OAS1M", "Sending TTS request...", 0.5f);
        var (success, message) = await client.SendRequestAndSaveAudioAsync();
        EditorUtility.ClearProgressBar();

        if (success)
        {
            EditorUtility.DisplayDialog("Success", $"Audio saved to:\n{message}", "OK");
            UnityEngine.Debug.Log("TTS audio saved: " + message);
            EditorUtility.RevealInFinder(message);
        }
        else
        {
            EditorUtility.DisplayDialog("Failure", message, "OK");
            UnityEngine.Debug.LogError("TTS failed: " + message);
        }
    }

    private void BootOAS1M()
    {
        string command = "cd ~/fish-speech && conda activate fish-speech && python -m tools.api_server --listen 0.0.0.0:8032 --llama-checkpoint-path \"checkpoints/openaudio-s1-mini\" --decoder-checkpoint-path \"checkpoints/openaudio-s1-mini/codec.pth\" --decoder-config-name modded_dac_vq --compile";

        var psi = new ProcessStartInfo
        {
            FileName = "wt.exe",
            Arguments = $"wsl -e bash -li -c \"{command}\"",
            UseShellExecute = true,
            CreateNoWindow = true,
            WindowStyle = ProcessWindowStyle.Hidden
        };

        try
        {
            Process.Start(psi);
            EditorUtility.DisplayDialog("Boot OAS1M", "Launched OAS1M API Server command in WSL terminal.", "OK");
        }
        catch (Exception ex)
        {
            EditorUtility.DisplayDialog("Error", "Failed to launch WSL command:\n" + ex.Message, "OK");
        }
    }
}