def play(self, utterance, start=0, end=None):
        # Method 1: os audio dev.
        try:
            import ossaudiodev
            try:
                dsp = ossaudiodev.open('w')
                dsp.setfmt(ossaudiodev.AFMT_S16_LE)
                dsp.channels(1)
                dsp.speed(16000)
                dsp.write(self.audiodata(utterance, start, end))
                dsp.close()
            except IOError as e:
                print(("can't acquire the audio device; please "
                                     "activate your audio device."), file=sys.stderr)
                print("system error message:", str(e), file=sys.stderr)
            return
        except ImportError:
            pass

        # Method 2: pygame
        try:
            # FIXME: this won't work under python 3
            import pygame.mixer, StringIO
            pygame.mixer.init(16000)
            f = StringIO.StringIO(self.wav(utterance, start, end))
            pygame.mixer.Sound(f).play()
            while pygame.mixer.get_busy():
                time.sleep(0.01)
            return
        except ImportError:
            pass

        # Method 3: complain. :)
        print(("you must install pygame or ossaudiodev "
                             "for audio playback."), file=sys.stderr)
Play the given audio sample.
dataset/ETHPy150Open nltk/nltk/nltk/corpus/reader/timit.py/TimitCorpusReader.play