A synchronous generator is an electric machine generating alternating emf ( Electromotive force or voltage ) of constant frequency .