How to make audio not playing repeatedly?

Hi, I made a script that will enable an audio when the button is pressed but then audio start playing like maybe on every frame.
here’s my script :

void Update()
{

    if (Input.GetKey("i"))
    {
        engineOn = true;
    }

    if (Input.GetKey("o"))
    {
        engineOn = false;
    }

    if ((engineOn == true) && (!engine.isPlaying))
    {
        engine.Play();
    }
    else
    {
        engine.Stop();
    }

The top part should be:

     if (Input.GetKeyDown("i"))
     {
         engineOn = true;
     }

     if (Input.GetKeyDown("o"))
     {
         engineOn = false;
     }

Input.GetKey() will return as true every update that its held down. Input.GetKeyDown() will only be true once when you press the key.