Version 18 of TclMixer

Updated 2009-05-04 13:40:32 by ihmin

Googie - TclMixer is SDL_mixer [L1 ] bindings for Tcl. It allows to play multiple sounds at the same time using built-in software mixer.

It supports following sound formats: WAV/RIFF, MP3, OGG, MID (midi), MOD (including standart MOD modules, but also S3M, IT, XM).

There are basic effects implemented, which would be very useful, such as individual sound volume level, 3D sound source positioning, stereo balance, fading in/out and sound source distance. All these goodies closed in well known, simple Tcl syntax.

To make this extension work, end-user has to got installed SDL [L2 ] (in version 1.2.x) and SDL_mixer [L3 ] (in version 1.2.x), which are quiet famous and presents on most Unix desktop machines (in future tclmixer.so could be linked statically with these libraries to takes dependencies off).

Generaly, it's low-latency alternative for Snack package. It's excellent for a game sound system, but not only.

Licence is LGPL (same as SDL).

You can download it from http://sqlitestudio.one.pl/tclmixer/

(note: the download URLs at that link are bad) Googie - Right, just fixed :)

ZB 2009-04-21 It seems, there's a need for another fix Googie - Fixed as well :)

Documentation is at above link.

NEW!!! Since 28.03.2005 there is also Windows binary package available at extension homepage!

In-Hak Min TclMixer 1.2.3 Win32 binary : http://tcltk.co.kr/?q=node/1318

Googie 2009-05-01 Can I put this win32 binary at TclMixer homepage?

In-Hak Min Of course. ^_^


Some examples

Get some supported sound file. If it's some effect (gun shot, or explosion or sth) load it as short sound (which gives very low latency):

 #!/usr/bin/env wish
 package require TclMixer
 set snd [tclmixer::sound file.<mp3|wav|ogg>]
 tclmixer::play $snd

if file is big (usually some music), then load it as long sound, to prevent loading it into memory:

 #!/usr/bin/env wish
 package require TclMixer
 set music [tclmixer::music file.<mp3|wav|ogg|mid|mod>]
 tclmixer::play $music

There is 'wish' used, not 'tclsh', becouse we need some event loop, since SDL_mixer hasn't its own. If you want to use 'tclsh', you need to create some event loop, to let SDL_mixer play whole sound. You can use CALLBACK mechanism:

 #!/usr/bin/env tclsh
 package require TclMixer
 set sleep 0
 proc musicFinished {} {
     global sleep
     set sleep 1
 }

 tclmixer::mixConfig -music musicFinished ;# this binds finishing
                                          ;# sound playback to call [musicFinished]

 set music [tclmixer::music file.<mp3|wav|ogg|mid|mod>]
 tclmixer::play $music
 while {$sleep} {after 1000}

[ Category Package | Category Multimedia | Category Sound | Category Music ]