Reanimation of Snack

The last sign of life from the official Snack and Wavesurfer maintainers is from the year 2006 and the last release are from 2005. It would be a pity if this wonderful package dies and so we (UKo and lasselasse and...) want to start a sort of reanimation.


I've done some work to fix Linux/Alsa sound file (wav) playback. Fedora's snack2.2.10-newALSA.patch has a 'return' that severely broke the apps i tested. I have removed it, and tweaked configure (in which the '--disable-alsa' switch is broken) to work much better. This tarball includes the modifed snack2.2.10 source, and the patches i applied. Perhaps someone can really test this change, as i am not an Alsa programmer. For testing, try asteroids.tcl, or our project Scid vs. PC.

EDIT: I have also found that the default sound device on Ubuntu is faulty, and better performance can be got from different devices

set devices [snack::audio outputDevices]
puts "Available output devices are: $devices"
set device [lindex $devices end]
puts "Trying device $device"
snack::audio selectOutput $device

EDIT: After a quick glance at the code, things are obviously broken by design. Flush does not mean drop... So i doubt their exists quick fixes for this software.

SnackAudioFlush(ADesc *A)
  if (A->mode == RECORD) {
  } else {



Available patches

The first patch I will provide is a compile time option, to build snack without mp3-support to make it fully free (in the tcl sense).


DKF: I advise only waiting a finite amount of time for a response from the official maintainers. Better to have a fork (and apologies) than to let something languish for want of the gumption to get on with it.

LV So, what is the situation with mp3? I mean, that format is the most commonly used format, cross platform. Now I see talk about a version of snack which doesn't support it, to be more free. I presume this means that someone in the world has a software patent and wants money from people who write MP3s?

If so, then what formats are being recommended as a replacement? Surely not wav, because who wants to get stuck in that format? And not the itunes default format (also proprietary).

I know about flac, ogg and a few other formats - but they are lossless, which means the files are horrendously larger, and few digial music devices (and for that matter, few programmatic players) support those formats easily.

ZB 23.05.2008: ogg (AKA "ogg-vorbis") is "lossy" format, which has serious advantages over MP3: it produces smaller files (or of the same size, but better quality), it's "variable rate" by default, and it's commonly recognized by about all software players, and by some hardware players (I mean: pocket, portable devices) as well. Because it's present already in snack, it's a replacement for MP3 just "ready for use". Uh, I forgot to add: and it's totally free and open format.

So what alternatives are commonly usable other than these?

lasselasse: Snack comes from the area of speech science. wav is kind of the standard format there exactly because it is lossless. I would consider mp3 support rather a feature to increase popularity.

UKo The alternative I see is: mp3 ;-) To use snack in commercial software (like the rest of tcl) it is necessary to split the mp3 part from the rest. But my plan is to make it an extension like the ones for ogg/vorbis and nist/sphere. And hopefully this will lead to some more extensions like flac.

And it's not a problem with the format (though maybe the patent restrictions will cover it, too) but a problem with the license of the mp3 code used by snack -- here is the relevant part of the snack README:

The only reason for GPL is the MPEG decoding code, see jkFormatMP3.c. If you remove that code it is possible to use a license similar to the one Tcl/Tk uses (BSD style) and to include Snack in any software on the same terms.

WJP 2008-05-23 MP3 is covered by a large set of patents, some but not all of which have expired. MPEG-LA ( ), the outfit that licenses the patent pool, claims that all use of mpeg, both encoding and decoding, requires a license and the payment of royalties.

TFW May 23, 2008 Snack is used by SnackAmp and I continually get a large number of requests to add FLAC support. I simply don't have the time or inclination to add FLAC to Snack, but would be much appreciative if someone else would ;>. Ogg support is already there, but it is not a very clean/modular implementation.

WJP 2008-05-23: Even if Snack were being maintained, there are changes that I would like to see. Snack combines several different functions: (a) audio i/o; (b) signal processing; (c) graphics (drawing of sound-pressure waveforms and spectrograms). I think that it would be best to decouple these. For audio i/o, an alternative to consider is creating a Tcl binding for libsndfile , which handles more formats than Snack does and runs on more platforms (including such odd things as Linux on PowerPC). I have used it in a number of C programs. I've been thinking about trying to wrap libsndfile using swig for some time. lbsndfile is LGPL. That isn't a problem for me but might be for others.

With regard to signal processing and graphics, what Snack provides is handy but there are oodles of other kinds of signal processing one may want to do and other kinds of graphics. If it isn't sufficiently efficient to do the graphics in Tk and one has to add them as a binary extension, I'd rather do it as a generally useful extension than as an addition to Snack.

With regard to formats, as someone mentioned, those of us in linguistic research have no interest in MP3. We want uncompressed linear PCM data or lossless compression such as FLAC. PCM data is most commonly in a WAV container (WAV is not an audio format, it is a file format and can contain audio data in any of several dozen formats, including nasty lossy compressions). Occasionally we get data in lossy compressed formats such as MP3 or ATRAC (used on Sony minidiscs), or for some reason need to provide files in such formats, but there are other tools for doing the necessary conversions. There's no need, from our point of view, to work directly with such formats. It gives you cooties. :)

jbeskow 2008-05-28: Finally - here is a lifesign from one of the WaveSurfer developers;-) First of all, thanks for starting this wiki page, It's good to know that people care about the future of WaveSurfer. In fact we DO know that many people use WaveSurfer on a daily basis (including us), and we too want it to continue to prosper... In a way, you could say that WaveSurfer is mature and works ok so there hasn't been a tremendeous need for updates. On the other hand that's not completely true, there ARE a couple of known bugs, some of them which COULD have been fixed quite easily, I guess there is no better explanaion than that we've both been "kinda busy" on other projects... Of course there is a risk that we'll go on being busy with other stuff (even if I hope that I will be able to put more time into WaveSurfer in the future)... So what to do? Well, the plan is to put WaveSurfer on SourceForge. Kåre and I will remain as maintainers, but there may of course be other developers involved. Kåre actually registered the project a few months ago but we haven't gotten around to sync our versions and upload (and there is a risk that this won't happen until after summer - but we definetly intend to do it). In the meantime, it sounds like a good idea to collect fixes/patches for known problems. Once on SourceForge, it will hopefully be easier to keep track of bugs, issues, fixes, and the people who provide them...

Would that be , then? Is that intended also for Snack? It seems is something quite different.

PCM 2008-06-11

Another alternative is my modification which replaces Snacks proprietary MP3 with libmpg123 (which is LGPL). This implementation (like OGG) is a shared lib and thus removal is just deletion of the lib.