How to play audio only when turret rotates?

I have a turret, which rotate to the player’s direction. I want to play audio during it’s rotation, but how can I do it in the script? I need to play it only when turret rotates.

Turret’s script:

public Camera mainCamera;
AudioSource audioTurretMove;

void Start()
{
    audioTurretMove = gameObject.GetComponent<AudioSource>();
}

void Update()
{
    var newRotation = Quaternion.LookRotation(
    Camera.main.transform.position - transform.position).eulerAngles;

    newRotation.x = 270;
    newRotation.z = 0;
        
    transform.rotation = Quaternion.Slerp(
        transform.rotation,
        Quaternion.Euler(newRotation),
        Time.deltaTime);
}

48839-2.jpg

First you would need to measure the movement by committing a variable to its last rotation.

So declare a global variable for the rotation, say, oldRot, then underneath the line that sets the rotation, add this code

if (oldRot != transform.rotation)
		audioTurretMove.Play();
	else
		audioTurretMove.Stop();

	oldRot = transform.rotation;

Thing is, though, this will cause the sound to stop before the turret is at a complete stop, but it should be close enough