home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pyos2bin.zip / Demo / sgi / al / radio.py < prev    next >
Text File  |  1996-11-27  |  418b  |  22 lines

  1. #! /usr/bin/env 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.