Guido van Rossum | 50692d6 | 1991-09-15 21:05:15 +0000 | [diff] [blame^] | 1 | #! /ufs/guido/bin/sgi/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 = 54321 | ||||
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) |