home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / OPENSTEP / Languages / Python / python-14-src / Demo / sgi / al / radio.py < prev    next >
Encoding:
Python Source  |  1997-01-17  |  420 b   |  22 lines

  1. #! /usr/local/bin/python
  2.  
  3. # radio [port]
  4. #
  5. # Receive audio packets broadcast by "broadcast.py" on another SGI machine.
  6. # Use apanel to set the output sampling rate to match that of the broadcast.
  7.  
  8. import sys, al
  9. from socket import *
  10.  
  11. port = 5555
  12. if sys.argv[1:]: port = eval(sys.argv[1])
  13.  
  14. s = socket(AF_INET, SOCK_DGRAM)
  15. s.bind('', port)
  16.  
  17. p = al.openport('radio', 'w')
  18.  
  19. while 1:
  20.     data = s.recv(1400)
  21.     p.writesamps(data)
  22.