If your voiceprint fails when logging in, you can still log in using a typed password. This should be your File Sharing password, not your voiceprint phrase.
There are a number of reasons why your password may not work. It could be that there is too much extraneous noise in your Mac's environment. If it's a portable, go elsewhere. If not, you might just not be able to use voiceprint security. Or just tell everyone in the classroom to shut up for a second (I'm presuming you're the teacher).
You might not be using the same microphone with which you recorded your voiceprint. The differences between microphones can be very subtle, but the Mac is sensitive enough to be finicky about them. If you can't use the same mic you used to make your voiceprint, you'll have to go back and re-record your voiceprint.
If you change your password in the File Sharing control panel, all bets are off for voiceprints. Even though your voiceprint phrase is not the same as your File Sharing password (or shouldn't be), it won't work once your File Sharing password is changed. Your voiceprint also won't work if you change your name in File Sharing. In either case, you'll have to go back and re-do the voiceprints.
Finally, the lucky owners of fanless iMacs may have problems using voiceprints, because - ironically - their computers are too quiet. The voice recognition software is fairly tolerant of a bit of constant background noise, such as the hum of a fan. What it can't handle is sudden bursts of sound, even small ones, as may be produced by the whirring of a hard drive. Normally the fan would cover these. If you have such an iMac, your best bet is just to keep trying and hope the drive stays quiet for a few seconds while you enter your voiceprint.