1#!/bin/sh
2# the next line restarts using tclsh \
3exec wish8.4 "$0" "$@"
4
5# Demonstration that sends a live recorded Ogg/Vorbis stream
6# to the Snack sound server, aserver.tcl
7# You will have to edit this script to set host and port
8# to reflect were the server is run.
9
10package require snack
11package require snackogg
12
13# Edit host and port here
14
15set host ior.speech.kth.se
16set port 23654
17
18if [catch {set sock [socket $host $port]} res] {
19    puts "Error: no aserver.tcl at $host:$port"
20    exit
21}
22
23# Create sound object and attach it to the opened socket stream
24sound s -channel $sock -channels 2 -rate 44100 -fileformat ogg
25
26# Notify the server that a play operation is due
27puts -nonewline $sock play
28
29# Set desired bitrate
30s config -nominalbitrate 32000
31
32# Start recording
33s record
34
35# Keep the event loop alive, necessary for background recording
36vwait forever
37