LinuxDevCenter.com
oreilly.comSafari Books Online.Conferences.

advertisement


Developing and Using Snd: Editing Sound Under Linux, Part One
Pages: 1, 2, 3, 4

Getting started with Snd

Requirements
To build the version of Snd presented in this article, you will need to install the following support software:



  • Guile 1.5.0
  • OpenMotif 2.1
  • ALSA 0.5.11 with OSS emulation enabled
  • LADSPA and its various plug-ins
  • My Scheme customization files

See the Resources section for the download locations for these packages. It is beyond the scope of this profile to give instructions on installing this software, but the documentation for each package will lead you through their respective build and install procedures. Any other requirements should be fulfilled by libraries and other software included in most mainstream Linux distributions.

The ALSA driver packages are not strictly required. You can build Snd perfectly well with either the kernel sound modules (aka OSS/Free) installed or with the excellent OSS/Linux commercial drivers from 4Front Technologies.

Getting, building, and installing it

Prebuilt binaries for Linux i386, LinuxPPC, and Sun are available from the Snd home page. Source and binary RPMs have been prepared and are available for the i386 and PPC Linux versions. To install Snd from those packages simply follow the usual method of installing RPMs. For example, this command:

rpm -ivh snd-5-1.ppc.rpm

will install the LinuxPPC package (you will probably need root status to install the RPM file).

Note: The instructions and descriptions throughout this article refer to Snd built for the i386 architecture. I was unable to test my build configuration on any other system, but I would like to hear from anyone running Snd on other platforms, particularly LinuxPPC.

To build Snd yourself, first download the source package (currently snd-5.tar.gz) from the CCRMA Snd Home Page to your home directory. Unpack it with tar xzvf snd-n.tar.gz (where n is the major version number), then enter your newly created snd-n directory and read the README.Snd file for the latest installation instructions and details. Run ./configure --help for a list of configuration options: This list includes options for your choice of user interface (Motif, GTK, none), sound card driver support (ALSA, OSS, Esound), the use of Ruby instead of Guile for Snd's extension language, and support for LADSPA plug-ins. I use the following command options to compile Snd:

./configure --with-motif --with-ladspa --with-static-xm

This configuration builds Snd with a Motif 2.1 GUI, support for the LADSPA audio plug-ins, and built-in support for the graphics routines within Snd's Motif module (xm.so, if built separately). Default values are accepted for all other configuration options, including Snd's default support for the OSS/Free kernel sound API.

After configuring the build, run make and wait for the compiler to finish building your new Snd. Become superuser (su root) and run make install. The binary will be installed in /usr/local/bin and a manual page will be placed in /usr/local/man/man1.

Snd is also available via CVS. Please see the Snd home page for the details of accessing and downloading using CVS.

Why not native ALSA ?

My build configuration includes Snd's default support for the OSS/Free kernel sound API. Including the --with-alsa option will build Snd with native ALSA support (either 0.5.x or the ALSA 0.9 beta6), but the state of the ALSA API is rather mercurial at this time (though quickly closing in on its long-anticipated 1.0 release). Depending on your sound card, Snd's ALSA support may not be in synch with the most current API. Running Snd with ALSA 0.5.11 native support for my SBLive Value crashed the program when trying to record, but the same driver package works perfectly (via ALSA's OSS/Free emulation mode) with Snd compiled for OSS support. However, native ALSA support and OSS emulation both worked fine for my SB PCI128. I also encountered no problems with recording or playback using the OSS/Linux drivers.

Note: Fernando Lopez-Lezcano has recently hacked a workaround that allows recording in Snd under native ALSA with my SBLive. Preliminary tests indicate that the hack works well with mic, line, and CD input, but it is problematic recording from my mixer's master output channel. Hopefully a complete solution will be found soon, and I should emphasize that Snd's ALSA support is already quite functional.

Why Motif instead of GTK ?

Snd can be configured for a build using either Motif or the GTK graphics libraries or for a build with no GUI at all. Some users may wonder why I chose to build Snd with Motif instead of the more modern GTK. As a matter of fact, I did build Snd with GTK a few times, but I prefer the amenities of Motif, particularly the keyboard acceleration. More importantly, my interface enhancements depend on the xm.so module. Work proceeds on bringing the GTK version to the same level of customization as the Motif build, but it's not there yet. A final consideration was the fact that Motif 2.1 is now freely available from the OpenMotif group, while the well-known LessTif (replaces Motif 1.2) is also available for free and is usually included with most mainstream Linux distributions. However, Snd may exhibit some odd behavior with LessTif, and author Bill Schottstaedt has indicated that he would rather not bother with Snd + LessTif problems, so I recommend the OpenMotif package.

The test system

Here are the hardware specifications of the system used throughout this article:

  • 800-MHz AMD Duron
  • 512 MB of memory
  • Two 15-GB Maxtor IDE hard-disks
  • Voodoo3 video card with 19" monitor
  • SBLive Value and SB PCI128 sound cards

System software includes Linux kernel 2.4.5 patched for low-latency (for more information please see my article about setting up the Linux kernel for low-latency published by the O'Reilly Network) and the sound card drivers from ALSA 0.5.11. I built the ALSA package with the OSS emulation enabled and Snd is quite content with that arrangement.

The reader might notice that the test machine is rather "loaded". Processing digital audio consumes system resources, so for best results you'll want a fast CPU, lots of RAM, a large fast hard-disk, and a good video system, preferably with at least a 17" monitor (multichannel displays quickly eat up viewing area, even on a 19" monitor in high-resolution modes). You can work with Snd with less powerful resources, but your mileage will certainly vary from the test system.

Firing up

Screenshot.
Figure 2. Snd opened with no sound files loaded

Start Snd by entering snd at an xterm prompt. With no command-line options or flags, you will see Snd's default opening display [Figure 2]. Cool Edit users will immediately wonder what's going on here. They are accustomed to seeing a complete display when Cool Edit starts, not this rather stark and uninformative box. Expanding the window only opens up a blank grey canvas, nothing like the visual array of icons, meters, and timers in Cool Edit.

Snd has evolved within the Unix domain, and more pointedly, it has evolved in the world of computer music and sound synthesis programming languages running on Unix machines. Unlike Cool Edit, Snd expects the user to learn and understand how to use an underlying programming language to tap the full extent of Snd's capabilities, and this factor often proves to be the major stumbling point for migrating Cool Edit users. Despite the relative ease of learning the Scheme or Ruby scripting language, users coming from Windows or the Mac simply do not expect to meet with such a requirement for the full use of the software. When a user is already proficient at the task, learning a programming language in order to use an audio editor seems not only a daunting endeavor but a pointless one as well.

The next formidable block for Cool Edit users is the management of a combined keyboard/mouse interface. As I mentioned earlier, Cool Edit is almost entirely mouse-operated. Text entry is supported, but at almost every point, the mouse is the designated input device for selecting files and other data, choosing processing options and other menu items, and even setting data values (with spinboxes, sliders, and other data entry widgets).

By comparison, the default Snd is far more keyboard-intensive. Emacs users will be pleased to find that Snd's keyboard control is based on the emacs keyboard layout, but that will be little comfort to Cool Edit users (or to vi adherents like myself). Control and Alt key combinations are normally used to operate the default Snd, and I advise new users to learn at least the following keystroke commands:

  • Ctrl-a position cursor at beginning of the display
  • Ctrl-e position cursor at the end of the display
  • Ctrl-v position cursor at the midpoint of the file
  • Ctrl-l moves cursor to mid-display
  • Ctrl-j position cursor on the next mark
  • Ctrl-t stop playback
  • Ctrl-g stop all processing
  • Ctrl-i sends a report to the minibuffer on the status of the sound file at the cursor position.

Press the spacebar to pause playback; press it again to continue playback from the pause point.

The following key combinations provide more precise cursor movement:

  • Ctrl-b move cursor back one sample
  • Ctrl-f move cursor forward one sample

These particular movements are especially valuable when zoomed into a file to single-sample resolution.

There are many other keyboard controls for cursor movement. Fortunately, most of the other basic operations of the program (opening and closing files, starting and stopping playback, accessing menus and menu items, navigating the display, exiting the program) can be controlled by mouse actions. The new user should have no trouble learning a dozen key combinations, but for the seriously keystroke-challenged, I do plan to provide graphic controls for positioning the cursor.

Pages: 1, 2, 3, 4

Next Pagearrow




Linux Online Certification

Linux/Unix System Administration Certificate Series
Linux/Unix System Administration Certificate Series — This course series targets both beginning and intermediate Linux/Unix users who want to acquire advanced system administration skills, and to back those skills up with a Certificate from the University of Illinois Office of Continuing Education.

Enroll today!


Linux Resources
  • Linux Online
  • The Linux FAQ
  • linux.java.net
  • Linux Kernel Archives
  • Kernel Traffic
  • DistroWatch.com


  • Sponsored by: