Introductory examples
Using Tcl/Tk
The Snack toolkit adds the command
snack::sound
to the Tcl language. It is used to create and handle sound objects. The
following three statements shows how to create a sound object, read audio
data from a WAV-file into it and finally play the sound:
snack::sound snd
snd read ex1.wav
snd play
To get a graphical representation
of this sound you can draw its waveform using these statements:
canvas .c
pack .c
.c create waveform 0 0 -sound snd
Using
Python
The same
functions with Snack and Python would be
snd = Sound()
snd.read('ex1.wav')
snd.play()
And
for the graphics
c = SnackCanvas()
c.pack()
c.create_waveform(0, 0, sound=snd)