snack::filter
command.
The snack::filter
command is similar to the
snack::sound
command. The snack::sound
command creates a new command to play sounds. The
snack::filter
command creates a new argument you can use
with the command that snack::sound
created.
The snack::filter
command has a lot of arguments. One
that's useful for making games is the map
argument.
The map
argument creates a filter that changes the volume
of a sound being played.
A filter
that will make a sound quieter looks like this:
set quiet [snack::filter map .3]
|
# Create a new sound command named music
snack::sound music
# Read the background music into the music command
music read background.mp3 -fileformat mp3
# Create a filter - save the new filter argument
# in a variable named quiet
set quiet [snack::filter map .3]
# Play the music, using the quiet argument
music play -filter $quiet
|
snack
package can do many things with sounds. Here's
a
link to the full documentation for the package.