1 #! /usr/local/bin/python
5 # Broadcast audio input on the network as UDP packets;
6 # they can be received on any SGI machine with "radio.py".
7 # This uses the input sampling rate, input source etc. set by apanel.
8 # It uses the default sample width and #channels (16 bit/sample stereo).
9 # (This is 192,000 Bytes at a sampling speed of 48 kHz, or ~137
10 # packets/second -- use with caution!!!)
16 if sys
.argv
[1:]: port
= eval(sys
.argv
[1])
18 s
= socket(AF_INET
, SOCK_DGRAM
)
21 p
= al
.openport('broadcast', 'r')
23 address
= '<broadcast>', port
25 # 700 samples equals 1400 bytes, or about the max packet size!
26 data
= p
.readsamps(700)
27 s
.sendto(data
, address
)