README for tkSound release
1997feb26 dpwe@icsi.berkeley.edu
Interim release of tcl7.6 (8.0?)-compatible version for
Jean Piche. Make procedure is very different due to
shared library support. Does not reference iostream.
Improved dpwelib.
dpwe 1995jan21, 1995may10
1995nov01 - release of tcl7.4 / tk4.0 compatible versions
Intro
This is an early release of the tools advertised in <a href="http://sound.media.mit.edu/~dpwe/tkSound.html"> my web site.</a>
Basically, there are a few extension functions to tcl/tk that create a sound file object, and provide widgets to draw sound waveforms and grayscale images. There is also a short-time Fourier analysis program that will analyse a soundfile into a data file so that the tcl script 'tsoundg' will be able to load both the sound file and the STFT file and display them alongside each other.
The point of all this is not so much to allow you to look at soundfile waveforms and spectrograms, but to provide the basic building blocks so that any reasonably curious user can build a soundfile viewer of their own design using the tk widgets and the wonderful tcl scripting language.
I got a bit carried away in the tsoundg script, implementing auto-scroll at the edge of the select regions and dynamic panel resizing. But I've tried to make it fairly clear.
Regrettably, I don't have time right now to document the widgets that have been added. I can list them; they are:
tclSound.cc:
sound creates a `sound' object from a sound file name
tkDpweMisc.cc:
xorrect xor's a rectangle in the root window regardless of subwindows
(for the draggable line when resizing panes)
tkImg.cc:
image create the widget that displays grayscale images
tkSndWvfm.cc:
sndwvfm create the widget that displays sound time-domain waveforms
tkTimeline.cc:
timeline create a widget to display a time-axis text labelling
tclFloatArray.cc:
farray create an object that holds a 2D matrix of float values.
This is the interface between data files and the display
widget, image.
Directories
tksound/dat contains the MIT-SIPG DAT file interface for multidimensional
data. But you don't need to use this - I've configured
it to use the dumb ascii-hex format by default.
tksound/dpwelib is an excerpted version of my personal library.
Mainly this is the soundfile interface. By manipulating
the includes in sndf.c, you can compile this to read/write
the following soundfile types: AIFF Sun/NeXT.au WAV CsoundIRC
By default, it reads AIFFs. Only one format at a time,
I'm afraid.
The library also provides for sound output on SGIs,
DECstations and DEC-Alphas. But the default is audIOfake.c,
which stubs out the sound IO capabilities.
Installation
You need a couple of things to build this:
- Installed TCL (7.4) and TK (4.0)
- Optionally, GNU libreadline.a e.g. from gdb-4.13/readline This gives you command-line editing in the wish shell, which is highly desirable. However, if you don't have the lib, you'll have to make changes in the Makefile to undefine the GNU symbols and include -DUSESTDIN
You need to edit tksound/Makefile to point to your tcl7.4 and tk4.0 directories, as well as your equivalent of /usr/gnu/{lib,include}
Then just 'make tohex all'. Should handle it.
Usage
First find a soundfile - AIFF for the default config - such as the included 'spch.aif'. You can recreate the STFT analysis file for it with 'tohex spch.aif', although its expected output, the DATfile directory 'spch.dat/' is included in the package. You can then view them both with 'tsoundg.tcl sound.aif'.
Left mouse button selects a region in either panel. Top panel always shows whole sound; next panel shows zoomed in bit. Middle mouse button zooms to current selected region. Right mouse button extends current selection. You can grab the thin bars under each pane to resize its height.
'tsound.tcl sound.aif' just looks at the time waveform, no image stuff.
Tested on
IRIX 5.3 using cc and CC - works
IRIX 5.3 using gcc 2.6.3 - works
SunOS 4.1.3_U1 using gcc 2.6.3 - works
DEC Alpha OSF/1 using gcc 2.6.3 - couldn't get the dat/ gcc varargs to work
-- DAn Ellis <dpwe@media.mit.edu>
MIT Media Lab Perceptual Computing - Machine Listening group.
- - - - - - - - - standard copyright notice - - - - - - - - - - -
Copyright (c) 1994-5 Dan Ellis & MIT Media Lab. All rights reserved.
Permission to use, copy, or modify these programs for educational and
research purposes only and without fee is hereby granted, provided that
this copyright and permission notice appear on all copies. For any other
uses of this software, in original or modified form, including but not
limited to distribution in whole or in part, specific prior permission
from M.I.T. must be obtained. M.I.T. makes no representations about the
suitability of this software for any purpose. It is provided 'as is',
without express or implied warranty.
