How to make the music pitch change based on the player position

For a school project I am trying to make a 2D mobile game based on the principle of binaural beats. Binaural beats are pieces of music where a ‘base tone’ is played together with the normal music. There’s a small difference between the pitch of the tone in the left and right ear. The difference between the two ears should match the frequency of brain waves activity (0 - 38 hz).

I am new to programming in Unity and in general. I’m having a hard time trying to write this code based on existing tutorials.

I need to write a script that will change the pitch of one of the tones (left or right ear) based on the position of the player. When the player goes up or down in the 2D game, the difference between the two tones becomes greater or smaller. I just can’t find a way to combine multiple tutorials to fit the exact script I need. Could someone please help me.

I made an Audio Manager using a tutorial. Maybe the code should be incorporated here? Please let me know.

using UnityEngine.Audio;
using UnityEngine;

[System.Serializable]
public class Sound
{
    public string name;
    public AudioClip clip;

    private AudioSource source;

    [Range(0f, 1f)]
    public float volume = 0.7f;
    [Range(0.5f, 1.5f)]
    public float pitch = 1f;
    [Range(-1f, 1f)]
    public float panning = 0f;
    public bool loop = true;

    public void SetSource (AudioSource _source)
    {
        source = _source;
        source.clip = clip;
        source.loop = loop;
    }

    public void Play ()
    {
        source.volume = volume;
        source.pitch = pitch;
        source.panStereo = panning;
        source.Play();
    }

    public void Stop()
    {
        source.Stop();
    }

}

public class AudioManager : MonoBehaviour
{

    public static AudioManager instance;
    


    [SerializeField]
    Sound[] sounds;

    private void Awake()
    {
        if (instance != null)
        {
            if (instance != this)
            {
                Destroy(this.gameObject);
            }
        } else
        {
            instance = this;
            DontDestroyOnLoad(this);
        }
        
    }

    private void Start()
    {
        for (int i = 0; i < sounds.Length; i++)
        {
            GameObject _go = new GameObject("Sound_" + i + "_" + sounds[i].name);
            _go.transform.SetParent(this.transform);
            sounds[i].SetSource (_go.AddComponent<AudioSource>());
        }

        PlaySound("Base");
    }

    void Update ()
    {

    }

    public void PlaySound (string _name) 
    {
        for (int i = 0; i < sounds.Length; i++)
        {
            if (sounds[i].name == _name)
            {
                sounds[i].Play ();
                return;
            }
        }

        // no sound with _name
        Debug.LogWarning ("AudioManager: Sound not found in list, " +  _name);
    }

    public void StopSound(string _name)
    {
        for (int i = 0; i < sounds.Length; i++)
        {
            if (sounds[i].name == _name)
            {
                sounds[i].Stop();
                return;
            }
        }

        // no sound with _name
        Debug.LogWarning("AudioManager: Sound not found in list, " + _name);
    }

}