Code:

SOUND* sndEngine = "brumm.wav"; // define your soundfile

function EngineSound()
{
   var vSoundhandle;
   var vFreq;
   vSoundhandle = snd_loop(sndEngine, 100, 0); // play sound in a loop
   while(1)
   {       
      vFreq = plattespeed*-4; // get speed, play with -4
      snd_tune(vSoundhandle, 0, vFreq, 0); // tune sound
      wait(1);
   }
}


Not tested!
Just start the function in your main:

function main()
{
... // other code
EngineSound();
... // other code
}


no science involved