home *** CD-ROM | disk | FTP | other *** search
/ PC World 2002 May / PCWorld_2002-05_cd.bin / Software / TemaCD / activetcltk / ActiveTcl8.3.4.1-8.win32-ix86.exe / ActiveTcl8.3.4.1-win32-ix86 / demos / Snack / oggstream.tcl < prev    next >
Encoding:
Text File  |  2001-10-22  |  862 b   |  37 lines

  1. #!/bin/sh
  2. # the next line restarts using tclsh \
  3. exec wish8.3 "$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.  
  10. package require snack
  11. package require snackogg
  12.  
  13. # Edit host and port here
  14.  
  15. set host ior.speech.kth.se
  16. set port 23654
  17.  
  18. if [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
  24. sound s -channel $sock -channels 2 -rate 44100 -fileformat ogg
  25.  
  26. # Notify the server that a play operation is due
  27. puts -nonewline $sock play
  28.  
  29. # Set desired bitrate
  30. s config -nominalbitrate 32000
  31.  
  32. # Start recording
  33. s record
  34.  
  35. # Keep the event loop alive, necessary for background recording
  36. vwait forever
  37.