LinuxDevCenter.com
oreilly.comSafari Books Online.Conferences.

advertisement


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

Some advanced uses of Snd

There are too many other untapped resources in Snd to cover in this article, such as the scanned synthesis display, the FM violin controls, and running Snd remotely. But before we leave let's take a brief look at a few advanced uses of Snd.

Batch processing And GUI-less Snd

You may recall that Snd can be compiled without any GUI at all. In this form, it can be used as an interactive interpreter for Scheme commands, as seen in the following very simple sequence:

[dlphilp@localhost snd-5]$ ./snd
snd> (open-sound "bunt.wav")
0
snd> (play)
#t
snd> (close-sound 0)
(null)#f
snd> (exit)

The call to open bunt.wav returns the file ID, the play command plays any files opened (all at once if several are loaded), and close-sound closes out the file with the particular ID.

Snd with no GUI can also function as a batch processor for Scheme scripts. For example, this test.scm file:

(open-sound "bunt.wav")
(scale-by 0.5)
(save-sound-as "bunt-scaled.snd")
(exit)

will open bunt.wav, reduce its amplitude by half, save it as a new file, and exit. Run it with this command under Snd with no GUI:

snd -l test.scm

Obviously far more complex scripts can be assembled, and the interested reader is advised to refer to the relevant sections of Snd's documentation.

Other dynamically-loaded modules

So far we have only considered Scheme code files as a way to dynamically load new functions into Snd. Snd is also capable of loading shared objects at runtime via commands issued in the Listener. The procedure for building shared objects from the Scheme code is described in detail in the Snd documentation, and I refer the interested reader to those sections dealing with Snd's use of runtime modules and external programs. The documentation also describes methods for using external applications with Snd, such as Perry Cook's STK (synthesis toolkit), the SoX "Swiss Army knife of audio," and Bill Schottstaedt's own Common LISP Music.

For example, you can link a shared object into Snd with these commands:

(define lib (dynamic-link "/home/dlphilp/snd-5/eff.so"))
(dynamic-call "init_eff" lib)

At this point, you can invoke the flange processor from the shared object:

(loop-samples (make-sample-reader 0) (get-flange) (frames) "flange" (make-flange 2.0 5.0 0.001))

Called this way, the flange processor should run about 30 times faster than if it were called via the same code in effects.scm.

Panning envelopes

If you load the customization package Snd will place a Special menu on the main menu bar. Among other things that menu offers a Start/Stop Enveloping feature. When Start Enveloping is invoked, the next file opened will appear with a graphic envelope editor beside the usual time-domain waveform display [Figure 9]. This editor will appear along all subsequently opened files until the Stop Enveloping item is selected. When Start Enveloping is active, you can create an envelope in the graphic editor and apply it to either amplitude or panning. I have added a widget for the panning function, available from the Special/Play Panned menu item, to make it easier to experiment with this interesting feature.

Closing remarks and acknowledgements

I hope you've enjoyed this article. Above all, I hope you actually tried using Snd with its latest enhancements on some files of your own. I welcome any feedback, particularly with suggestions for improving the interface components and corrections to parameter definitions.

Snd is rich in editing, processing, mixing, and synthesis capabilities, and the customization of Snd is an ongoing process. The addition of GUI widgets and pop-up menus has contributed greatly to the new Snd's ease of use, but much of Snd's power remains to be revealed to the non-programming user. Work on improving Snd's interface will continue, and the interested reader is advised to join the Snd mailing list to stay current with its latest developments (see the Snd home page for details).

I would like to thank the many respondents to my query regarding Cool Edit on the mail lists for Csound, the Linux Audio Developers group, and the "Common" software packages: Their responses formed the core around which my customization of Snd took shape, and I am truly in their debt. I must also thank Fernando Pablo Lopez-Lezcano for his assistance in resolving my problems with ALSA and Snd. But by far the greatest thanks goes to Snd author Bill Schottstaedt. He endured a nearly unceasing flow of questions and requests during the writing of this article, and he provided nearly all the tools needed to create the Snd presented in this article.

Resources

Part one of this series: Developing and Using Snd: Editing Sound Under Linux, Part One

Online Resources:

Other Necessary Software

Print Resources

  • Dodge, C., and Jerse, T. A. Computer Music: Synthesis, Composition, And Performance. New York: Schirmer, 1997. Perhaps the best introduction to the subject. See the material in chapter 10.3, "Modification Of Sampled Sound".
  • Phillips, D. The Book Of Linux Music And Sound San Francisco: No Starch Press, 2000. Includes a chapter on sound file editors for Linux, with a profile of Snd.
  • Roads, C. The Computer Music Tutorial. Cambridge: MIT Press, 1996. The definitive tome; see especially the material in chapter V.16, "The Musician's Interface".

Dave Phillips maintains the Linux Music & Sound Applications Web site and has been a performing musician for more than 30 years.


Return to the Linux DevCenter.




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: