Snd

Snd is a sound editor.  It currently runs on the SGI, Sun, UnixWare,
OpenServer, HPUX, DEC Alpha, Linux, LinuxPPC, FreeBSD, Mac OS-X (XDarwin),
and BSD (BSDI 4.2). To build Snd, get the sources from

  ftp://ccrma-ftp.stanford.edu/pub/Lisp/snd-5.tar.gz

  gzip -d snd-5.tar.gz
  tar xf snd-5.tar
  cd snd-5
  ./configure
  make
  make install

The configure program has several Snd-related arguments:

   --with-motif          use Motif (the default)
     --with-static-motif same, but load Motif statically (for RPM)
     --with-motif-prefix set Motif location (will append lib and include)
   --with-gtk            use Gtk+	
   --with-gtk-extra      use the file selection widget from libgtkextra
   --with-alsa           use ALSA if possible
     --with-static-alsa  use ALSA statically loaded (for RPM generation)
   --with-html           include the XmHTML or mozilla browser library
   --with-big-colormap   use big colormap (default = yes)
   --with-snd-as-widget  make Snd a loadable widget, not a standalone program
   --with-doubles        use doubles throughout (default is floats)
   --with-float-samples  represent samples internally as floats (default: ints)
   --with-ladspa         include LADSPA plugin support (Linux)
   --with-sample-width=N use N bits of samples (default = 24)
                         N=32 or so is not recommended because it does not leave
                         you any "head room" during mixes.
   --with-esd            use the enlightened sound daemon, if possible
   --with-no-gui         make Snd without any graphics support
   --with-static-gsl     try to load GSL statically (for RPM)
   --with-ruby           try to use Ruby as the extension language
   --with-ruby-prefix    set location of Ruby
   --with-static-xm      include the xm module (rather than loading it dynamically)
   --with-temp-dir       directory to use for temp files
   --with-save-dir       directory to use for saved-state files

If the configure/make process fails, please send me
(bil@ccrma.stanford.edu) the files config.h, config.log, and makefile,
created (or updated) by configure.

If you want to customize your version of Snd in some special way, see
snd.h for a discussion of the various compile-time switches, and fixup
the relevant makefile:

SGI:                   makefile.sgi
Unixware 7:            makefile.uw7
OpenServer 5:          makefile.sco5
DEC Alpha:             makefile.alpha
LinuxPPC:              makefile.ppcrpm
Windoze/Cygwin:        makefile.cygwin
Windoze/MSVC:          makefile.msv (this file assumes you have clisp's cccp, etc)
Mac-OSX:               makefile.osx and config.osx

In HPUX, fixup the makefile.hpux include and library paths, then:
  make -f makefile.hpux

If you have Guile 1.3.4 add -DHAVE_GUILE_1_3.  (The default is now
Guile 1.4).  If you don't have Guile or Ruby, Snd can still be built, but it's
severely limited in what it can do (there is a configure switch
--with-guile=no, and there's the compiler switch HAVE_EXTENSION_LANGUAGE).



----------------------------------------------------------------
The customization/extension language is Guile, available in the Gnu
distributions:

  ftp://ftp.gnu.org/pub/gnu/guile/guile-1.4.tar.gz

Many of the example Scheme files use the Guile 1.5 or later optional
argument syntax, so Guile 1.4 is actually not a reasonable default 
anymore, but Guile 1.6 will apparently never arrive. In the meantime,
you can get a 1.6 facsimile from

  ftp://alpha.gnu.org/gnu/guile/guile-1.5.4.tar.gz

To include guile in Snd, either use the configure script (which should
be able to find the guile library automatically), or go to the
relevant makefile, set the CFLAGS variable to include 'guile-config
compile', and set the LIBS variable to include 'guile-config link'.
Only guile 1.3.4 or later is supported.

Just as a quick example:

  (set! (fft-size) 4096)

sets the fft size to 4096, and

  (scale-by 2.0)

scales the current sound's volume by 2.0 -- the syntax is Scheme,
a variant of Lisp; see the urls below for some Scheme tutorials.
The details of Snd customization are discussed in extsnd.html
and grfsnd.html.

Recently I added the possibility of using Ruby rather than
Guile (on the HAVE_RUBY or --with-ruby switches).


In Gtk+, the --with-html flag tries to use /usr/lib/mozilla.

In Motif, the XPM library, if it is available, is used to create some cute
icons.  If the relevant makefile does not include -DXPM and you have
the library, add -DXPM to CFLAGS and -lXpm to LIBS.  (This is built
into Gtk+).  If you're using gtk, try to get version 1.2.7 or later.

There are precompiled binaries available at the ccrma-ftp site
mentioned above: linux-snd (or linux-snd.gz) for Linux
on a PC; sun-snd for the Sun; also RPM (Redhat package management)
files that contain the Linux/PC version, (snd-5-5.i386.rpm), the
sources (snd-5-5.src.rpm), and the LinuxPPC version (snd-5-5.ppc.rpm).
These RPM files have been superseded by Fernando Lopez-Lezcano's
set available at http://www-ccrma.stanford.edu/software/snd/.
These pre-built images require Guile 1.4; if you are running 1.3.4,
you'll need to build from sources.  The linuxppc version requires
libXm.so.2.1 available from openmotif.


----------------------------------------------------------------
Included with Snd are five command-line programs that might
be of interest: sndplay, sndrecord, sndinfo, sndsine, and audinfo.  
You can make these by using the same makefile as before
and:

  make sndplay

or
  
  make -f makefile.sgi sndplay


----------------------------------------------------------------
The documentation is in snd.html, extsnd.html, grfsnd.html, sndscm.html,
sndlib.html, and clm.html.  There's also a fancier wrapper for the
documentation: snd1.html.  A brief change log is in HISTORY.Snd.

The mailing list for Snd is the same as that for Common Music:
cmdist@ccrma.stanford.edu.  To get your address added to or removed
from this list, send the request to cmdist-request@ccrma.stanford.edu.

This software is available to anyone who is interested, free gratis
for nothing, without warranties of any kind (see the file COPYING for
legalese).  Send bug reports or suggestions to bil@ccrma.stanford.edu.


The OpenServer and UnixWare ports are courtesy of Larry Plona.
The Solaris port is thanks to Volker Kuhlmann and Seppo Ingalsuo.
The HPUX port is thanks to Seppo Ingalsuo.
The DEC Alpha port is due to the persistence of Juan Reyes.
The Linux Alpha port is thanks to Guenter Geiger.
The original ALSA support was thanks to Paul Barton-Davis.
The current ALSA support is thanks to Fernando Lopez-Lezcano.
The Sam 9407 support is thanks to Gerd Rausch.
The LADSPA support is thanks to Richard W.E. Furse.
The ESD support is thanks to Nick Bailey.
The BSD port is thanks to Steven Schultz.
The Mac-OSX port is thanks to Ludger Brummer.
effects.scm is largely thanks to Dave Phillips.
The contrib directory has contributions from Dave Phillips and Tom Roth.


----------------------------------------------------------------
TROUBLES:


Alpha audio:
There's no support yet for playing or recording sounds on the Alpha --
I don't have any idea how audio works on this system.  Any information
would be much appreciated!


Linux audio:
In Linux, Snd sometimes can't seem to play or record when other
applications are happy -- if this happens, please run the function
mus-audio-describe (via M-x) and send me whatever it prints out.

If you're using the Sonorus Studio card and getting interruptions,
try (set-oss-buffers 64 16).  I think the RME Digi96 card's defaults
are 32 and 12 (just a guess). 

If you're running esd, you need to build Snd with the configuration
switch --with-esd.  Otherwise, it's likely you'll get an error
from the 'play' button complaining about data formats, probably
that it can't play big-endian shorts.


Recording:
The Record dialog only works in Linux (OSS, perhaps ALSA) and on some
SGI systems.  It tries real hard on a Sun, but drops samples.


Colors:
If Snd complains that it can't find various colors upon startup, the
problem is that some other program (probably Netscape) has grabbed all
the color cells -- exit it and try Snd again, or (if you have the
video RAM), increase your "depth" to 16.

If you're running KDE and the menu labels are invisible, check
the 'theme' you're using.  You normally want black label foregrounds.


Linux startup:
In Linux, if you get the error "No such file or directory" when you
try to execute linux-snd, the problem is probably that you're running
a libc5-based Linux; linux-snd is built with glibc (the newer libc).

If Snd dies with a complaint about __setfpucw, you need to recompile
Snd (that portion of glibc changed between versions 1 and 2, or
something like that).


Compiling:

If you get the error:

 snd-x0.h:9 Xm/XmAll: No such file or directory

This probably means you don't have the Motif headers installed -- to
build Snd with a GUI from the sources, you need either Motif or Gtk+.
Motif has recently been released as open source software: see the url
mentioned below.  The linux binary rpm file and the linux-snd image at
ccrma-ftp have Motif statically loaded.  If you installed the
openmotif library rpm package, it may not have included the headers
(look under /usr/X11R6/include/Xm); to build Snd from the sources you
need the headers (in the openmotif-devel packages).

If you have installed Motif in some weird place, use the -I compiler
flag to provide that information to the compiler.  I've added the
-with-motif-prefix argument to the configure script, but don't know if
it works; if, for example, you have Motif in /usr/local/lib and
/usr/local/include, try --with-motif-prefix=/usr/local

If Snd using Lesstif is messed up, that's Lesstif's problem!  I'm
not trying to support this anymore.


Gtk+:
Gtk+ is not as sophisticated as Motif, and the port is still somewhat new, so
there are a number of differences and rough-edges in that version of Snd.
The primary differences are 1) Gtk+ paned-window widget only accepts two
panes.  This means that simple boxes are used throughout rather than
panes. 2) Gtk+ colors are a bottomless pit; colors may or may not work
right.  3) Gtk+ file selection dialog's filter is restricted to a simple
string using "*" -- the just-sounds button of Motif, and the associated
sound file extension list are omitted.

(I've tried snd+gtk in Linux, Sun, and SGI).

If you get an error like:

  Gtk-WARNING **: <much useless mumbling>

you can find where it occurs by:

  gdb snd
  run --g-fatal-warnings
    <now do whatever it takes to hit the warning>
  where

If you configure Snd --with-html as well as --with-gtk, and
get an error in snd-ghelp about gtkmozembed.h, it probably
means you don't have the mozilla-devel package installed.


GSL:
If configure finds GSL, but Snd refuses to load with an error
about missing gsl_complex_cos (or whatever), you need to get the
GSL sources and build it again; apparently the version of libgsl.a
that comes with Redhat 7.0 doesn't include any of the complex
trig package?  Snd needs GSL 0.8 or later.


RPM:
If you try to install the rpm package and get this:

rpm --install snd-3-1.ppc.rpm 
error: failed dependencies:
	libMrm.so.1 is needed by snd-3-1
	libXm.so.1 is needed by snd-3-1

it means you don't have Motif installed; either get Motif, or use
the pre-loaded images such as linux-snd, or build using Gtk+.

If Snd then refuses to run with the error:

./snd: error in loading shared libraries: libMrm.so.1: cannot open shared
object file: No such file or directory

you need to add the relevant path to the loader's list of
paths (thanks to Juan Pampin for this info): add the path to
/etc/ld.so.conf and then 'ldconfig -v'.  Or place the actual
path in the relevant makefile.
 
If you run Snd and get some error about qt_error, I think this
means you built Guile with the configure switch --with-threads,
whereas I'm building the images and RPM versions with a completely
vanilla Guile (i.e. without threads).  You'll need to make a
version of the guile library that doesn't require libqt, or
build Snd from the sources and include -lqt in the LIBS statement.

If you get some complaint along these lines:

> only packages with major numbers <= 3 are supported by this version of RPM
> error: snd-4-8.i386.rpm cannot be installed

it means you need to upgrade your version of RPM; apparently
version 3.0.5 is good enough.


Guile:
If you get a complaint along the lines of "ice-9/boot-9.scm not found",
it means you're running a version of Snd that has Guile loaded, but
Guile isn't installed locally.  You need to install Guile.  If Guile
is installed, try running 'guile-config info' to find out where it
thinks its boot files are.  If you're using a prebuilt image from
ccrma-ftp, the relevant files should be in /usr/local/share/guile/1.4.
It's not impossible that running snd under strace would show you what the
actual desired path is.  In the copious strace output, you should
be able to find lines like: 
    stat("/usr/local/share/guile/1.4/ice-9/boot-9.scm"...)

If you have installed Guile, but the snd image is looking in the wrong
place, try setting the envinronment variable GUILE_LOAD_PATH to the
correct directory:

  setenv GUILE_LOAD_PATH /home/jimb/guile-snap

Another possibility is the %load-path variable; in your ~/.snd file try
something like:

    (set! %load-path (cons "/home/bil/test" %load-path)))

(assuming you've put the guile files into /home/bil/test).


If the snd rpm process can't find the guile library, yet you have it
in /usr/local/lib, try the --nodeps switch to rpm (thanks to Charles
Waldman for this tip). 


If the configure script says that your guile doesn't have
scm_make_smob_type, yet you do have guile 1.3.4 (or later) installed,
it's probably because the RedHat installer or someone, installed Guile
1.3 in /usr/bin and /usr/lib, but then the new version got installed
in /usr/local/bin.  The simplest fix is to remove /usr/bin/guile and
/usr/bin/guile-config.  If you get an inconsistent state here (that
is, configure thinks you're loading 1.3, but Snd itself finds 1.3.4),
you will get segfaults when the hooks are accessed (and probably
elsewhere).  If you can run Snd at all, try snd --version -- this will
try to catch and report consistency problems.

If you're running linux-snd, you'll need guile 1.4 (it will appear
as libguile.so.8 in ldd).


> Other thing is that configure doesn't find guile-1.4.
> For some reason it thinks it's an older version and I have to manually edit
> config.h

It's using guile-config to find guile; if you've got more
than one guile-config, it's up to your PATH setting, or
something, which one gets called.  In Redhat, an ancient
version gets installed in /usr/bin, then if you install
your own using the defaults, it ends up in /usr/local/bin,
and in many cases, the new version is not noticed. You
could delete or rename /usr/bin/guile-config or change the
relevant environment variable.  To see what configure sees,
in a shell try guile-config link or guile-config --version.

Fernando Lopez-Lezcano mentioned this possibility:

  If you want to force a different guile do (if you're using bash):

    PATH=/usr/marco/nicepath/bin/:$PATH ./configure --with-alsa --with-gtk

  where /usr/marco/nicepath/bin is the path where the guile-config you want
  is located. Do the same thing when you make:

    PATH=/usr/marco/nicepath/bin:$PATH make



Mac OS-X: currently you need to install Guile 1.4 (at least, I haven't
managed to compile 1.5), GSL 0.9 (using --disable-shared), and the
prebuilt Glib/Gtk 1.2.8 tarballs that contain the headers (the package
at osxgnu is just the libraries -- I think I got my version from
gnu-darwin or some such address).  These should be installed by hand
in /usr/local/include.  Next, the Snd configure process is confused by
the lack of gtk-config, so you need to rename config.osx to config.h,
and make -f makefile.osx.  The "native" Mac audio hardware supports
only stereo 44100Hz; sndplay tries to fix up 22050 and mono, but
Snd only fixes up mono cases.  Anything else will be played incorrectly,
though you can use the speed control to correct it by hand.
Also, there is something odd about keypress events in this implementation
of X or Xt; if C-f (and others like it) doesn't work, either try toggling
the "w" button, or add the focus-widget related hooks from grfsnd.html
to your initialization file:

(add-hook! mouse-enter-graph-hook 
  (lambda (snd chn) 
    (focus-widget (car (channel-widgets snd chn)))))
(add-hook! mouse-enter-listener-hook 
  (lambda (widget) 
    (focus-widget widget)))
(add-hook! mouse-enter-text-hook
  (lambda (w)
    (focus-widget w)))



If you installed OpenMotif, then "upgraded" to RedHat 7.2, Redhat
probably overwrote Motif with %$^#&@ Lesstif.  You need, among other
things, to re-install OpenMotif and make sure /usr/local/lib/libXm.so.2
is the new version, not %$#&%* Lesstif's.  If you use mwm, you need
to get it back as well, which means removing the directory that
%$^#&$ Lesstif put in its place.  The error you'll get will be
some complaint about undefined xmNotebook class.  This is a major
bug in Redhat 7.2.



----------------------------------------------------------------
If you hit a bug, don't just sit there weeping -- send me
(bil@ccrma.stanford.edu) a description of it!  If it's something like
a segfault, you have gdb, and you can build Snd from the sources, it
would help me a lot if you could build it with the -g switch, then

gdb snd
run
<here do whatever it takes to get the bug>
where

The 'where' command should print out the current stack trace which
is extremely helpful to me in tracking down the problem.  It can also
be helpful to move to the first Snd-related function in the stack
(via the 'up' command), then type

info locals

This will print out the value of the local variables.  In most cases,
that's all I need to fix the bug immediately.  On the sgi, the debugger
is named dbx, and the local variable command is named dump.  If Snd
appears to be hung, you can 

gdb snd
break exit
run
<now get it to hang, then type control-C to exit>
where



----------------------------------------------------------------
URLS:

Guile/Scheme:
  http://www.gnu.org/software/guile/guile.html
  http://www.cs.indiana.edu/scheme-repository
  http://vicarious-existence.mit.edu/scwm/
  http://www.schemers.org/
  http://www.cs.rice.edu/~dorai/t-y-scheme/t-y-scheme.html
  http://www.cs.utexas.edu/users/wilson/schintro/schintro_toc.html
  http://www.swiss.ai.mit.edu/~jaffer/SLIB.html
  http://www.glug.org/
  http://www.glug.org/people/ttn/software/ttn-pers-scheme/
  ftp://krusty.e-technik.uni-dortmund.de/pub/guile/snapshots


CCRMA:
  http://www-ccrma.stanford.edu/
  http://www-ccrma.stanford.edu/~jos/
  http://www-ccrma.stanford.edu/planetccrma/software/

Snd:
  ftp://ccrma-ftp.stanford.edu/pub/Lisp/snd-5.tar.gz
  http://www-ccrma.stanford.edu/software/snd/
  http://sourceforge.net/projects/snd/

  http://linux.oreillynet.com/pub/a/linux/2001/10/05/snd_partone.html
  http://linux.oreillynet.com/pub/a/linux/2001/10/18/snd_parttwo.html
  http://www.saunalahti.fi/~mjkoskin/
  http://www.cosy.sbg.ac.at/~gwesp/mma-sound.html (Mathematica)
  http://www.linuxpower.com/display_item.phtml?id=139 (Movies)

Motif:
  http://www.opengroup.org/openmotif/
  http://www.motifzone.net

Gtk+:
  http://www.gtk.org
  ftp://ftp.gtk.org/pub/gtk/

gmeteor:
  http://gmeteor.sourceforge.net

Linux audio:
  http://sound.condorow.net/

GSL:
  ftp://sourceware.cygnus.com/pub/gsl/

Gtk+extra:
  http://gtkextra.sourceforge.net/

Ruby:
  ftp://ftp.netlab.co.jp/pub/lang/ruby/
  comp.lang.ruby
  http://www.ruby-lang.org


----------------------------------------------------------------
CVS: (I haven't tested this).

To follow the Snd CVS repository, the first time you need to

       cvs -d:pserver:anonymous@cvs.snd.sourceforge.net:/cvsroot/snd login 
       cvs -z3 -d:pserver:anonymous@cvs.snd.sourceforge.net:/cvsroot/snd co cvs-snd

When prompted for a password for anonymous, press the Enter key. 
After that, you go to your local cvs-snd directory and

       cvs update 
