Snack sound extension commands v1.6

(Last updated June 21, 1999)

Manual for version 1.5

The command package require snack gives you access to all commands described below.
The command package require sound only gives you the sound and audio commands.


audio
sound
spectrogram canvas item
spectrum section canvas item
waveform canvas item

NAME

audio - Get/set properties of the audio device

SYNOPSIS

audio property ?arg?

DESCRIPTION

audio channels mixer audio formats audio frequencies audio input ?jack? audio inputs audio mixers audio output ?jack? audio outputs audio play_gain ?value? audio record_gain ?value? audio volume mixer ?varName? ?varName? audio update

BUGS

        This command is not fully implemented on all platforms. Solaris, Linux, and HP-UX have the most complete implementation.



NAME
        sound - Create and manipulate sounds
SYNOPSIS
        sound ?name? ?options?
DESCRIPTION
CREATING SOUNDS
        sound ?name? ?-load filename?  ?-file filename?  ?-channel channelname? ?-frequency f? ?-channels n? ?-format fmt?
SOUND COMMAND
soundName append variable ?-frequency f? ?-channels n? ?-format fmt? ?-skiphead n? ?-byteorder endianess? ?-start start? ?-end end?
soundName byteswap
soundName cget option
soundName concatenate sound
soundName configure option value ...
soundName convert option value
soundName copy sound ?-start start? ?-end end?
soundName cut sound
soundName crop start end
soundName data variable ?-frequency f? ?-channels n? ?-format fmt? ?-skiphead n? ?-byteorder endianess? ?-start start? ?-end end?
soundName data ?-start start? ?-end end??-fileformat fileformat?-byteorder ?endianess?
soundName destroy
soundName fft -startpos sample -fftlength length -winlength length -channel value -preemphasis factor
soundName flush
soundName info
soundName insert sound sample ?-start start? ?-end end?
soundName max
soundName min
soundName length ?n? ?-units u?
soundName pause
soundName play ?-start start? ?-end end? ?-output jack? ?-blocking boolean? -command ?callback?
soundName read filename ?-frequency f? ?-channels n? ?-format fmt? ?-skiphead n? ?-byteorder endianess??-start start? ?-end end?
soundName record ?-input jack? ?-append boolean?
soundName sample n ?value? ...
soundName stop
soundName write filename ?-start start? ?-end end?


NAME

sound - Create and manipulate sounds

SYNOPSIS

sound soundName

soundName option ?arg arg ...?

DESCRIPTION

A sound is an object which handles audio data. Sound objects can interact with files, variables, canvas items and the audio hardware.

CREATING SOUNDS

The sound command is used to create, delete, and operate on sound objects. It can take several different forms, depending on the option argument. The legal forms are:

sound ?soundName? ?-load filename?  ?-file filename?  ?-channel channelname? ?-frequency f? ?-channels n? ?-format fmt? ?-fileformat fmt?

soundName specifies the name of the sound. If it is omitted then Snack picks a name of the form soundn, where n is an integer. The -load option specifies that the file filename should be read into memory after creating the sound. The -file option specifies an on-disk file which should be linked to the sound. The -channel options specifies that audio data resides on a channel which should be linked to the sound. In these cases the audio data is not loaded into memory, which is useful when playing large files or when using streaming audio. However, the Snack canvas item types, e.g. waveform, can not be linked to sounds of these types. -fileformat works as for the read command.

SOUND COMMAND

When a sound is created, Tcl also creates a new command whose name is the same as the sound name specified. This command may be used to invoke various operations on the sound. The following commands are possible for sounds:

soundName append variable ?-frequency f? ?-channels n? ?-format fmt? ?-skiphead n? ?-byteorder endianess? ?-start start? ?-end end? ?-fileformat fmt?

soundName byteswap soundName cget option soundName concatenate sound soundName configure option value ... soundName convert option value ... soundName copy sound ?-start start? ?-end end? soundName crop start end soundName cut start end soundName data ?variable? ?option value? ... soundName destroy soundName fft -startpos sample -fftlength length -winlength length -channel value -preemphasis factor soundName flush soundName info soundName insert sound sample ?-start start? ?-end end? soundName length ?n? ?-units u? soundName max soundName min soundName pause soundName play ?option value? ... soundName read filename ?-frequency f? ?-channels n? ?-format fmt? ?-skiphead n? ?-byteorder endianess??-start start? ?-end end? ?-fileformat fmt?
  soundName record ?option value? ... soundName sample n ?value? ... soundName stop soundName write filename ?-start start? ?-end end? ?-fileformat fileformat?


NAME

spectrogram - Spectrogram canvas item

SYNOPSIS

pathName create spectrogram x y ?options value option value ...?

OPTIONS

-height size
-width size
-sound name
-winlength length
-fftlength length
-preemphasisfactor factor
-pixelspersecond value
-tags tagList
-start sample
-end sample
-channel value
-brightness value
-contrast value
-topfrequency frequency
-gridtspacing value
-gridfspacing value
-gridcolor color
-colormap colorlist

DESCRIPTION

The option -fftlength specifies the number of FFT points (8, 16, 32, 64, 128, 256, 512, 1024, 2048, or 4096), -winlength specifies the size of the hamming window, which should be equal to or less than the number of FFT points. -start and -end controls which part of the sound to display. -pixelspersecond determines the scaling factor in the x-direction. The -width option is specifies the width of the spectrogram. If both -width and -pixelspersecond are specified the spectrogram will be cut at one end depending on if a -start or -end option was also given. Use the -channel option to select which channel to show for multichannel sounds. Use left, right, both, all, -1 (all) or a channel number counting from 0 (left).  -brightness and -contrast takes values beteween -100.0 and 100.0. -topfrequency is the frequency value at the top of the spectrogram. -gridtspacing is the spacing between markers in seconds (default 0 means no grid) and -gridfspacing is the frequency spacing in Hz (default 0 means no grid). -gridcolor specifies the color of the grid. A colormap for the spectrogram is given with the -colormap option. It takes a list of colors as parameter and at least two must be specified. The first color is used for the lowest intensity in the spectrogram. An empty list gives the default 32 level grey scale. Currently spectrograms have a width limit of 32768 pixels. See also the code examples in the widget demonstration.


NAME

section - Spectrum section canvas item

SYNOPSIS

pathName create section x y ?options value option value ...?

OPTIONS

-height size
-width size
-sound name
-winlength length
-fftlength length
-preemphasisfactor factor
-tags tagList
-start sample
-end sample
-channel value
-fill value
-stipple value
-topfrequency frequency
-frame boolean

DESCRIPTION

The option -fftlength specifies the number of FFT points (8, 16, 32, 64, 128, 256, 512, 1024, 2048, or 4096), -winlength specifies the size of the hamming window, which should be equal to or less than the number of FFT points. -start and -end controls which part of the sound to display. -topfrequency is the frequency value at the right end of the section. Use the -channel option to select which channel to show for multichannel sounds. Use left, right, both, all, -1 (all) or a channel number counting from 0 (left). -frame specifies whether a frame will be drawn. See also the code examples in the widget demonstration.


NAME

waveform - Waveform canvas item

SYNOPSIS

pathName create waveform x y ?option value option value ...?

OPTIONS

-height size
-width size
-sound name
-fill color
-stipple bitmap
-start sample
-end sample
-channel value
-pixelspersecond value
-zerolevel boolean
-tags tagList
-frame boolean
-limit value
-subsample value

DESCRIPTION

The options -start and -end controls which part of the sound to display. -pixelspersecond determines the scaling factor in the x-direction which also gives the width. The -width option is specifies the width of the waveform. If both -width and -pixelspersecond are specified the waveform will be cut at one end depending on if a -start or -end option was also given. Use the -channel option to select which channel to show for multichannel sounds. Use left, right, both, all, -1 (all) or a channel number counting from 0. Use -limit to specify the maximal shown value for the sound amplitude. -zerolevel specifies whether the zero level will be displayed and -frame whether a frame will be drawn. See also the code examples in the widget demonstration. The -subsample option is useful for large sounds to specify how precisely they should be analyzed for shape calculation. The default value 1 uses every sample in the sound to draw the waveform envelope, which can be slow for large sounds. A value of 10 uses every 10th. Care should be used when specifying values because too large values may lead to incorrect envelope shapes.



Snack home