diff options
author | Guido van Rossum <guido@python.org> | 1991-09-15 21:05:15 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1991-09-15 21:05:15 (GMT) |
commit | 50692d62de3a2aa13aa1ebc56fbe045842a45580 (patch) | |
tree | ddc5e42f1a0693f77d8813f026f4077dd632961d /Demo/sgi/al/broadcast.py | |
parent | 4f5eafb0cf0d5144813c4047d934063b64229804 (diff) | |
download | cpython-50692d62de3a2aa13aa1ebc56fbe045842a45580.zip cpython-50692d62de3a2aa13aa1ebc56fbe045842a45580.tar.gz cpython-50692d62de3a2aa13aa1ebc56fbe045842a45580.tar.bz2 |
Initial revision
Diffstat (limited to 'Demo/sgi/al/broadcast.py')
-rwxr-xr-x | Demo/sgi/al/broadcast.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Demo/sgi/al/broadcast.py b/Demo/sgi/al/broadcast.py new file mode 100755 index 0000000..22452a3 --- /dev/null +++ b/Demo/sgi/al/broadcast.py @@ -0,0 +1,27 @@ +#! /ufs/guido/bin/sgi/python + +# broadcast [port] +# +# Broadcast audio input on the network as UDP packets; +# they can be received on any SGI machine with "radio.py". +# This uses the input sampling rate, input source etc. set by apanel. +# It uses the default sample width and #channels (16 bit/sample stereo). +# (This is 192,000 Bytes at a sampling speed of 48 kHz, or ~137 +# packets/second -- use with caution!!!) + +import sys, al +from socket import * + +port = 54321 +if sys.argv[1:]: port = eval(sys.argv[1]) + +s = socket(AF_INET, SOCK_DGRAM) +s.allowbroadcast(1) + +p = al.openport('broadcast', 'r') + +address = '<broadcast>', port +while 1: + # 700 samples equals 1400 bytes, or about the max packet size! + data = p.readsamps(700) + s.sendto(data, address) |