LinuxDevCenter.com
oreilly.comSafari Books Online.Conferences.

advertisement


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

Customizing Snd: The basics

Both Cool Edit and Snd can be customized, but in Cool Edit's case, the extent is limited to interface cosmetics, audio system configuration settings, and support for plug-in architectures (though this support is very powerful). Snd is vastly more extensible, and it is by means of that extensibility that we will find a gentler and perhaps more familiar way into the depths of Snd. And yes, Snd also supports a plug-in architecture (LADSPA). Let's take a closer look at how we can customize Snd to make it friendlier to Cool Edit users.



Snd's functions can be customized and extended by means of three files: the .snd initialization file, the Snd.ad X resource file, and Scheme code (files with the .scm extension) loaded at runtime or dynamically loaded during program operation (via the Listener window). Some customization options are also available at the command-line when launching Snd. The resource and initialization files can both contain Scheme code, but I suggest placing lengthy code within its own file or files.

I use my $HOME/.snd initialization file (included in the dp_scm tarball listed in the Resources for this article) to define the cursor shape, set display colors, restrict file listings to sound file types only, and set some audio parameters. This file also stores the information generated from selecting Save Options from the Options menu.

An X/Motif program such as Snd may utilize a resource file that defines various aspects of the Motif graphic interface such as color sets and font lists. The Snd distribution contains a resource file named Snd.ad (the extension stands for "application defaults") that should be copied simply as Snd to your $HOME directory. There isn't much to edit in Snd.ad, and you can safely leave it as it's found in the source package.

The source distribution includes a large collection of .scm files. These Scheme code files are the keys to accessing Snd's full range of capabilities, including routines for signal processing and other special effects and for adding new features to the graphic interface (such as menus and graphics control widgets). We will return to these files throughout this article, and we will investigate some of them in detail, but for now let's continue with our introduction to the basics of Snd.

Here's how I typically open Snd:

snd -geometry 900x800 -l /home/dlphilp/my_scm/misc.scm foo.snd foo.wav foo.au foo.sf2 foo.mp3 foo.W01

The format extensions to those foo files should be familiar to most audio people (the last one is a file format for the Yamaha TX16W sampler) and Snd will dutifully load them all. The MP3 and sampler files are converted to the RAW and Snd formats respectively, but the conversions work only for importing sounds: Snd does not encode MP3 files nor can it directly write files in the TX16W format (see Table 2 for a full list of Snd's accepted file types).

Table 2: Supported file formats

Cool Edit

read/write:

MPEG 3 (MP3), ACM waveform (WAV), Apple AIFF format (PCM encoded data only) (AIF), CCITT mu-Law and A-Law waveforms (WAV), Dialogic ADPCM (VOX), IMA/DVI ADPCM waveform (WAV), Microsoft ADPCM waveform (WAV), Next/Sun CCITT mu-Law, A-Law and PCM format (AU), Raw PCM Data, Sound Blaster voice file format (VOC), TrueSpeech (WAV), ASCII Text Data (.TXT), Amiga IFF-8SVX (.IFF, .SVX)

write-only:

RealMedia G2 (export only)

Snd

read/write (many data formats):

NeXT/Sun/DEC/AFsp, AIFF/AIFC, RIFF (Microsoft WAV), IRCAM (old style), NIST-sphere, no header (RAW)

read-only (in selected data formats):

8SVX (IFF), EBICSF, INRS, ESPS, SPPACK, ADC (OGI), AVR, VOC, PVF, Sound Tools, Turtle Beach SMP, SoundFont 2.0, Sound Designer I and II, PSION, MAUD, Kurzweil 2000, Tandy DeskMate, Gravis Ultrasound, ASF, PAF, CSL, Comdisco SPW, Goldwave sample, omf, quicktime Sonic Foundry, SBStudio II, Delusion digital, Digiplayer ST3, Farandole Composer WaveSample, Ultratracker WaveSample, Sample Dump exchange, Yamaha SY85, SY99, and TX16, Covox v8, SPL, AVI

automatically translated to Sun 16-bit, then read/write:

IEEE text, Mus10 SAM 16-bit (modes 1 and 4), IBM CVSD, AVI, NIST shortpack, HCOM, Intel and Oki (Dialogic) ADPCM, MIDI sample dump, G721, G723_24, G723_40, IFF Fibonacci and Exponential

automatically translated (with appropriate Scheme module) to 16-bit 44.1 kHz stereo RAW, then read-only:

MP3

The -l flag informs Snd that a Scheme file is to be loaded along with the rest of the program's normal functions. I utilize several Scheme files from the Snd source package to customize the program with such amenities as an effects menu, various time-domain and frequency-domain editing routines, and other significant interface extensions and enhancements.

Multiple instances of this flag may be entered at the command line, but one Scheme file can #include other Scheme files by using the load command. For example, my misc.scm file begins by including some of the distribution Scheme files as well as some custom code for my own extensions:

(load "/home/dlphilp/snd-5/snd-motif.scm")
(load "/home/dlphilp/snd-5/examp.scm")
(load "/home/dlphilp/snd-5/dsp.scm")
...
(load "/home/dlphilp/my_scm/special-menu.scm")
(load "/home/dlphilp/my_scm/new-effects.scm")

Other lines in this file will turn on a "hidden controls" dialog, check for unsaved edits before exiting Snd, summon a panel for listing and editing marks, and add many other features available from the Scheme files loaded above. We'll look more closely into misc.scm later, but for now it is important to note that before using my misc.scm to customize Snd you must edit the load path to indicate where you have unpacked the Snd sources.

The -geometry flag is an X Windows option to set the size of any X-aware application and is not unique to Snd.

Snd's graphic display can also be configured using the -notebook, -separate, and -horizontal flags. The notebook flag will present your sound files as though they were on pages in a tabbed spiral-bound notebook [Figure 3], while the -separate flag will open the files in separate windows [Figure 4]. Snd's normal graph view stacks multiple sound files in a vertical fashion, but the -horizontal flag will place them side by side [Figure 5].

Finally, opening Snd with the --help flag will result in this display of information:

[dlphilp@localhost dlphilp]$ snd --help
Snd is a sound editor.  Peruse the 'help' menu or try the 
snd-help function for help.
This is Snd version 5.2 of 30-Aug-01:
    Xen: 1.0, Guile: 1.5.0
    OSS 3.9.8
    Sndlib 13.7 (29-Aug-01, int24 samples)
    CLM 1.51 (6-July-01)
    gsl: 0.9.1
    Motif 2.1.30 X11R6
    Xpm 3.4.11
    with LADSPA
    Compiled Aug 30 2001 09:40:29
    C: egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
    Libc: 2.1.3.s

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: