By doing this, you make sure you are really hearing the melody in your mind and not only playing it mechanically.
1. Listen to the melody many times until you can sing it together with the record.
2. Sing the melody without listening to the record. Use a metronome at the beginning to check if you are following the form.
3. Last step would be to sing the melody without using a metronome but tapping on your leg instead.