1Snack v2.2 - a sound toolkit for scripting languages 2 3K�re Sj�lander 4 5Email address: 6There are several anti-spam methods between me and anybody trying to contact 7me by e-mail. If you don't hear anything try to contact me again. One option 8is also to use this forum 9http://www1.speech.kth.se/prod/wavesurferforum/phpBB2/index.php 10which can be used to discuss Snack issues. 11Also, please start the subject line with the word "snack" in any e-mail 12correspondence in order to clearly indicate that it is an important message. 13<kare@speech.kth.se> 14 15 16Introduction 17------------------------------------------------------------------- 18 19Snack is a sound processing toolkit designed as an extension 20to a scripting language. Snack currently works with the scripting 21languages Tcl/Tk, Python, and Ruby. 22Snack has commands to play, record, process, and visualize sound. 23Snack provides high level sound objects, with flexible storage management, 24and streaming support. It handles most common sound file formats. 25The visualization canvas item types update in real-time and can output 26postscript. The same scripts run on Unix (Linux, Solaris, HP-UX, IRIX, 27FreeBSD, NetBSD), Macintosh, and Windows 95/98/NT/2000/XP. 28Several example scripts can be found in the demos directory. 29 30For more information on Tcl/Tk and Python see 31Tcl/Tk: http://tcl.activestate.com/ 32Python: http://www.python.org/ 33 34In order to use Snack you must have Tcl and Tk version 8.0 or later. Always 35use the latest stable release, currently 8.4.8, which can be downloaded from 36ftp.activestate.com/ActiveTcl/html/. 37 38Tcl/Tk is often included with Python distributions. Snack has been tested 39with Python 1.5.2 - 2.3 on Linux and Windows. See the Python 40section below. 41 42The Snack package has been tested on the following platforms: 43Windows 95/98/NT/2000/XP 44Linux 2.0.35 (OSS 3.5) - 2.4.20-31.9 (OSS 3.8.2/ALSA 0.9.0) (x86 & PowerPC) 45SunOS 5.5.1 (Sparc and x86), Solaris 8 (Sparc) 46HP-UX B.10.20/11.00 47IRIX 6.2, 6.3 & 6.4 (even runs under SoftWindows, although slowly) 48NetBSD-current/i386 using the OSS emulation library 49BSD/OS-4.1 50Mac OS X, MacOS 8.6 and later 51 52Make sure you have the latest Snack version available at 53http://www.speech.kth.se/snack/ before proceeding with the installation. 54 55 56 57Compilation instructions for Snack on Unix (see mac/README for OS X) 58------------------------------------------------------------------- 59 60You must have Tcl/Tk installed on your system. Both Tcl and Tk must have 61been configured with the "--enable-shared" flag at build time (this is 62default for the 8.4 versions). Build them before Snack. 63 64Unpack Snack and change directory to the snack2.2.10/unix directory. 65 66Type "./configure". 67 68If you get this error message "Can't find Tcl configuration definitions", 69you have to specify their locations using the options "--with-tcl" and 70"--with-tk" when running configure. For example, use 71"--with-tcl=/usr/lib --with-tk=/usr/lib" if Tcl/Tk was 72installed in "/usr/lib", or "--with-tcl=../tcl8.4.8/unix" if you use that 73version. 74 75Linux users who have the ALSA sound driver installed should specify the configure flag --enable-alsa in order to enable native ALSA support. 76 77Type "make". 78 79If the make fails you will have to edit the Makefile and possibly also the 80configure script. TCL_INCPATH should be the path to the directory which 81contains the Tcl header file (tcl.h). The same goes for TK_INCPATH (tk.h). 82XINCLUDES should be the path to the directory containing the X11 include 83files. 84 85If you use Tcl/Tk 8.0 to 8.0.5 you will have to use the flag 86--disable-stubs, when configuring Snack. 87 88Summary in case you download Tcl, Tk, and Snack and build from scratch: 89You should place the distributions in the same directory and unpack them. 90Build Snack using the following commands: 91cd tcl8.4.8/unix 92./configure --enable-shared 93cd ../../tk8.4.8/unix 94./configure --enable-shared 95cd ../../snack2.2.10/unix 96./configure 97make 98 99 100Testing 101------------------------------------------------------------------- 102 103When you have succesfully compiled Snack it's time to look at the demos. 104In order to run these you will have to set the environment variable 105TCLLIBPATH to the directory containing the Snack library files (you don't 106need this step if you install Snack as described below). If you have 107compiled Snack in /u/kare/snack2.2.10/unix, this would be: 108 109setenv TCLLIBPATH /u/kare/snack2.2.10/unix 110 111Change to the demos/tcl/ directory and type ./widget.tcl: 112 113cd ../demos/tcl/ 114./widget.tcl 115 116this runs the Snack widget demonstration. 117 118You should also try the Snack test suite. Type: 119 120make test 121 122in the build directory. You should then see a printout of the test files 123processed. If any errors occur, you'll see a much more substantial printout 124for each error. Please report any problems to the author. 125 126 127 128System wide installation 129------------------------------------------------------------------- 130 131The recommended installation directory is the standard Tcl package directory. 132You can determine this by typing: 133 134tclsh 135puts $tcl_pkgPath 136 137If you choose this directory you don't have to set the TCLLIBPATH variable. 138Edit the Makefile if necessary. SNACK_INSTALL_PATH should be the path to the 139directory where you want to install the Snack package (e.g. /usr/local/lib). 140 141Install using: 142 143make install 144 145 146 147Compilation instructions for Snack on Windows 148------------------------------------------------------------------- 149 150The MSVC++ 6.0 workspace and project files necessary to build Snack on Windows 151are located in the win directory of the source distribution. 152 153In order to use Snack you will have to install Tcl/Tk 8.4 first. 154 155Snack's project files are set up for use with Tcl installed in C:\Tcl\, it 156might be easiest to change such paths by editing all *.dsp files in a text 157editor. 158Don't forget to copy the files snack.tcl and pkgIndex.tcl.dll from the 159unix directory to C:\Tcl\lib\snack2.2\ and rename the last file pkgIndex.tcl 160 161 162Compilation instructions for Snack on Windows using Mingw 163------------------------------------------------------------------- 164 165Mingw users (gcc for Windows) can now compile Snack under Windows. 166 167The win subdirectory contains a configure script that can be 168used to compile snack with Mingw compiled versions of Tcl and Tk. 169Users will first need to download Tcl and Tk sources along with 170the msys_mingw package from the following URL: 171 172http://sourceforge.net/project/showfiles.php?group_id=10894 173 174At this point, the DirectX 6 headers and lib files will need 175to be downloaded and installed into /mingw/dx6. If you change 176the location of the DirectX install, the Makefile will need 177to be updated after configure is run. 178 179http://people.montana.com/%7Ebowman/Software/ming.zip 180 181To build, run the configure script and pass the --with-tcl=DIR and 182--with-tk=DIR arguments that correspond to the build directories 183for Tcl and Tk. Tcl/Tk 8.4 or newer is required, OGG and NIST 184format options are not currently supported with the Mingw build. 185 186The typical configure-make cycle looks like: 187./configure --with-tcl=$TCL_DIR --with-tk=$TK_DIR --prefix=$INST_DIR 188make 189make install 190 191The above will create a snack directory in $INST_DIR/lib, which should 192be the same --prefix that you passed to the Tcl and Tk configure scripts. 193 194Using Snack with Python 195------------------------------------------------------------------- 196 197Snack must currently be used in conjunction with Tkinter. You need to have a 198matching installation of Snack and Tcl. For example, Python 1.5.2 uses 199Tcl8.0.5 and Python 1.6-2.3 uses Tcl8.3 on Windows. For Unix you have to 200edit Modules/Setup before building Python to specify which Tcl version to use. 201The default is Tcl8.0. You can check this by typing the following lines 202at the Python prompt: 203 204import Tkinter 205Tkinter.Tk().tk.eval('info tclversion') 206 207Snack is accessed using the tkSnack module located in the python directory. 208You need to put the file tkSnack.py in your Python path. 209 210Some demos can be found in demos/python/. 211 212Documentation is found in doc/python-man.html 213 214 215 216Using Snack with NIST/Sphere file formats 217------------------------------------------------------------------- 218 219It is possible to configure Snack to create an additional package for 220handling the NIST/Sphere file formats. Use the configure options 221--with-nist-include and --with-nist-lib to specify the locations of 222the corresponding directories of the NIST/Sphere distribution, 223which can be downloaded at 224ftp://jaguar.ncsl.nist.gov/pub/sphere_2.6a.tar.Z. In the Sphere 225distribution you will have to modify the file src/scripts/install.sh and add 226the compilation flag to create position independent code in some cases. Look 227at the Snack Makefile for these. 228 229On HP-UX with HP cc use: -Ae +z 230Linux users should specify platform: 10 (Custom), 231compiler flags: -O -Wall -fPIC, architecture: INTEL,and comment the 232line "extern char *sys_errlist[];" in nist/src/lib/sp/exit.c 233See SphereFile.txt for more info. 234 235Windows users can get a compiled dll at the address 236http://www.speech.kth.se/~kare/libsnacksphere.dll 237Put it in ..Tcl\lib\Snack2.2 (together with libsnack.dll). 238 239Linux users get a compiled library at the address 240http://www.speech.kth.se/~kare/libsnacksphere.so 241Put it in the Snack installation directory (together with libsnack.so). 242 243 244 245Using Snack with the OGG/Vorbis file format 246------------------------------------------------------------------- 247 248It is possible to configure Snack to create an additional package for 249handling the OGG/Vorbis file format. Use the configure options 250--with-ogg-include and --with-ogg-lib to specify the locations of an 251existing OGG/Vorbis installation. 252More information about OGG/Vorbis available at http://www.vorbis.com/ 253 254Windows users can get a compiled dll at the address 255http://www.speech.kth.se/~kare/ogg.tar.gz 256Put libsnackogg.dll in ..Tcl\lib\Snack2.2 (together with libsnack.dll). 257 258Linux users can get a compiled library at the address 259http://www.speech.kth.se/~kare/ogg.tar.gz 260Put libsnackogg.so in the Snack installation directory (together 261with libsnack.so). 262 263When building Ogg/Vorbis from source on Unix note that some modifications 264to the Makefiles might be necessary. Specify 265"AM_CPPFLAGS=-I$prefix/include" "LDFLAGS=-L$exec_prefix/lib" 266to get them to find their own installed headers and libraries. 267On Solaris force libvorbis to use the native compiler and add 268-Dalloca=__builtin_alloca 269to prevent the system from using a non-existing alloca. 270 271 272 273Dynamic linking problems 274------------------------------------------------------------------- 275 276(Sun, Linux, and SGI) 277The loader must be able to find the "libsnack.so" shared object. You may 278have to set the environment variable LD_LIBRARY_PATH to point the directory 279where it is located. This variable is a colon separated list of paths which 280can be modified using setenv. If you, for example, have compiled Snack in 281the directory /u/kare/snack/unix and have the shared objects libtcl8.4.so 282and libtk8.4.so in /usr/local/bin you would use the following command at the 283terminal prompt or in your .cshrc file: 284 285setenv LD_LIBRARY_PATH /u/kare/snack/unix:/usr/local/bin:$LD_LIBRARY_PATH 286 287(HP) 288The corresponding environment variable on HP-UX systems is SHLIB_PATH and 289shared objects use ".sl" as file extension. 290 291 292License 293------------------------------------------------------------------- 294 295Snack is currently licensed under GPL, see the file COPYING. 296Contact the author if this kind of license is a problem. 297The only reason for GPL is the MPEG decoding code, see jkFormatMP3.c. 298If you remove that code it is possible to use a license similar to the one 299Tcl/Tk uses (BSD style) and to include Snack in any software on the same 300terms. 301 302 303 304Acknowledgements 305------------------------------------------------------------------- 306The following people have contributed code, suggestions, and/or other help. 307 308Roger Lindell 309Jonas Beskow 310Claude Barras 311Mel 312Alexandre Ferrieux 313Daryl Vertigan 314David van Leeuwen 315Stefan Karneb�ck 316Simon Arnfield 317Magnus Lundeberg 318Zhibiao Wu 319Qiru Zhou 320Philippe Langlais 321Dan Ellis 322Holger Kanwischer 323Egbert Ammicht 324Richard Donselius 325Seymour Shlien 326Leonid Spektor 327Frederic Bonnet 328Andreas Gustafsson 329Jeffrey Hobbs 330Johan Dahl 331Erhard Rank 332Richard Ross-Langley 333Uwe Koloska 334Kevin Russell 335Nicolas Garbe 336Tom Wilkason 337Jonas Ekeroot 338Peter Kabal 339Ted Dunning 340Andreas Kupries 341Erik Allaert 342Christian Wegehaupt 343Alex Barnes 344Steve Davis 345Oriol Pique 346Athanassios Hatzis 347Scott McSpadden 348Albert Visagie 349Helmut Hissen 350Daniel A. Steffen 351Hans Werner Strube 352David McClosky 353Russell Owen 354Benjamin Baudoux 355Steve Renals 356Michel Scheffers 357Reinhard Max 358Brian Theado 359H�kan Melin 360Scott T. Silliman 361Mo DeJong 362Richard Dobson 363Alan Schnarr 364Lorenzo Seno 365Edouard Hinard 366