home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Applications / Python 1.3 / source code / Demo / sgi / al / radio.py < prev    next >
Encoding:
Python Source  |  1995-12-17  |  420 b   |  22 lines  |  [TEXT/R*ch]

  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.