def pyo_init(rate=44100, nchnls=1, buffersize=32, duplex=1):
 global pyo_server
 if (rate < 16000):
  raise ValueError('sample rate must be 16000 or higher')
 if hasattr(pyo_server, 'shutdown'):
  pyo_server.stop()
  sleep(0.25)
  pyo_server.shutdown()
  sleep(0.25)
  pyo_server.reinit(sr=rate, nchnls=nchnls, buffersize=buffersize, duplex=duplex)
 else:
  pyo_server = pyo.Server(sr=rate, nchnls=nchnls, buffersize=buffersize, duplex=duplex)
 pyo_server.boot().start()
 if (sys.platform == 'darwin'):
  z2 = np.zeros(2)
  _sndTable = pyo.DataTable(size=2, init=z2.T.tolist(), chnls=nchnls)
  _snd = pyo.TableRead(_sndTable, freq=rate, mul=0)
  _snd.play()
  time.sleep(0.51)

def pyo_init ( rate = 44100 , nchnls = 1 , buffersize = 32 , duplex = 1 ) : global pyo_server if ( rate < 16000 ) : raise ValueError ( 'sample rate must be 16000 or higher' ) if hasattr ( pyo_server , 'shutdown' ) : pyo_server . stop ( ) sleep ( 0.25 ) pyo_server . shutdown ( ) sleep ( 0.25 ) pyo_server . reinit ( sr = rate , nchnls = nchnls , buffersize = buffersize , duplex = duplex ) else : pyo_server = pyo . Server ( sr = rate , nchnls = nchnls , buffersize = buffersize , duplex = duplex ) pyo_server . boot ( ) . start ( ) if ( sys . platform == 'darwin' ) : z2 = np . zeros ( 2 ) _sndTable = pyo . DataTable ( size = 2 , init = z2 . T . tolist ( ) , chnls = nchnls ) _snd = pyo . TableRead ( _sndTable , freq = rate , mul = 0 ) _snd . play ( ) time . sleep ( 0.51 )
start and boot a global pyo server .