File: oggstream.tcl

package info (click to toggle)
snack 2.2.10.20090623-dfsg-8
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,764 kB
  • sloc: ansic: 32,662; sh: 8,558; tcl: 1,086; python: 761; makefile: 582
file content (36 lines) | stat: -rwxr-xr-x 862 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh
# the next line restarts using tclsh \
exec wish8.5 "$0" "$@"

# Demonstration that sends a live recorded Ogg/Vorbis stream
# to the Snack sound server, aserver.tcl
# You will have to edit this script to set host and port
# to reflect were the server is run.

package require snack
package require snackogg

# Edit host and port here

set host ior.speech.kth.se
set port 23654

if [catch {set sock [socket $host $port]} res] {
    puts "Error: no aserver.tcl at $host:$port"
    exit
}

# Create sound object and attach it to the opened socket stream
sound s -channel $sock -channels 2 -rate 44100 -fileformat ogg

# Notify the server that a play operation is due
puts -nonewline $sock play

# Set desired bitrate
s config -nominalbitrate 32000

# Start recording
s record

# Keep the event loop alive, necessary for background recording
vwait forever