File: radio.py

package info (click to toggle)
python 1.5.1-4
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 11,592 kB
  • ctags: 32,695
  • sloc: ansic: 90,267; python: 73,993; makefile: 2,423; lisp: 2,097; sh: 702
file content (21 lines) | stat: -rwxr-xr-x 418 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#! /usr/bin/env python

# radio [port]
#
# Receive audio packets broadcast by "broadcast.py" on another SGI machine.
# Use apanel to set the output sampling rate to match that of the broadcast.

import sys, al
from socket import *

port = 5555
if sys.argv[1:]: port = eval(sys.argv[1])

s = socket(AF_INET, SOCK_DGRAM)
s.bind('', port)

p = al.openport('radio', 'w')

while 1:
	data = s.recv(1400)
	p.writesamps(data)