def switchOn(sampleRate=48000, outputDevice=None, bufferSize=None):
 t0 = core.getTime()
 try:
  global pyo
  import pyo
  global haveMic
  haveMic = True
 except ImportError:
  msg = 'Microphone class not available, needs pyo; see http://code.google.com/p/pyo/'
  logging.error(msg)
  raise ImportError(msg)
 if pyo.serverCreated():
  sound.pyoSndServer.setSamplingRate(sampleRate)
 else:
  sound.init(rate=sampleRate)
 if outputDevice:
  sound.pyoSndServer.setOutputDevice(outputDevice)
 if bufferSize:
  sound.pyoSndServer.setBufferSize(bufferSize)
 logging.exp(('%s: switch on (%dhz) took %.3fs' % (__file__.strip('.py'), sampleRate, (core.getTime() - t0))))

def switchOn ( sampleRate = 48000 , outputDevice = None , bufferSize = None ) : t0 = core . getTime ( ) try : global pyo import pyo global haveMic haveMic = True except ImportError : msg = 'Microphone class not available, needs pyo; see http://code.google.com/p/pyo/' logging . error ( msg ) raise ImportError ( msg ) if pyo . serverCreated ( ) : sound . pyoSndServer . setSamplingRate ( sampleRate ) else : sound . init ( rate = sampleRate ) if outputDevice : sound . pyoSndServer . setOutputDevice ( outputDevice ) if bufferSize : sound . pyoSndServer . setBufferSize ( bufferSize ) logging . exp ( ( '%s: switch on (%dhz) took %.3fs' % ( __file__ . strip ( '.py' ) , sampleRate , ( core . getTime ( ) - t0 ) ) ) )
you need to switch on the microphone before use .