Excerpt: Audio Applications
After all this talk about the many ways in which BeOS is optimized for handling high-bandwidth audio and video streams, you might expect this chapter to form the heart of this book. In a sense, it does. The tools covered here are among the most exciting BeOS applications available, and they excel at what they do in comparison to similar tools on other platforms. But there's a caveat.
Be has put an incredible amount of energy into creating a superior architecture on which developers can create next-generation A/V applications. But the cornerstone of that architecture, the Media Kit, was finalized only with the advent of R4. As a result, at the time this book was written, developers had been presented with the new Media Kit, but had not yet had much time to actually work with it. The field of high-powered A/V applications is going to spread and mature far beyond the list of applications you see here. Consider this an introduction to the field, but don't forget to check BeWare and BeDepot for further offerings.
Audio Applications
BeOS lets applications talk to audio hardware with exceptionally low lag times, or "latencies." An audio signal can be sent from an application, through the audio subsystem, and to the sound card in 6 milliseconds or less, whereas the exact same sound card in the exact same system can incur latencies of 25 to 30ms under Windows. In laboratory tests, Be has brought audio latency down to 2ms in some cases, so we may enjoy even tighter audio responsiveness in post-R4 versions of the system. Because of this fact, and because of the performance advantages that arise naturally from pervasive multithreading, it doesn't take much to get vendors excited about developing audio applications for BeOS. Indeed, BeOS audio applications began to appear long before BeOS video applications. With the arrival of the Media Kit and the conveniences it offers developers, expect this field to grow considerably well into the future.
Adamation's AudioElements
If you've already read the section on Adamation's ImageElements in Chapter 13, Graphics Applications, you've got a leg up on understanding how AudioElements works, since the working concept is identical. Rather than using a standard audio-editing interface featuring graphical waveforms, knobs, buttons, and channel sliders, AudioElements breaks the process of manipulating audio signals into "elements," each of which represents a very specific operation. Much as one would build a custom command-line tool by "gluing together" individual components, these elements can be arranged in a workspace and wired up into a "network." Let's say you want to take the signal coming from your sound card's input jack, run it through a high-pass filter, sample and hold for two seconds, and run the result through a digital delay. Just drag these four elements from the Elements palette, connect the output of each element to the input of the next, and double-click any elements that require customization. Save the result as a network and you'll be able to apply the same series of controls to any incoming sound at any point in the future.
Getting Started The best way to familiarize yourself with AudioElements is to study a few of the many prebuilt networks bundled with the product. As with ImageElements, just press the Play button at the top of any network window to set it in motion. Note that many elements don't depend on either incoming signal or a preexisting audio file for source input--a wide array of sound synthesis modules are offered as elements as well. For example, open the network called "Interesting," and you'll notice that source signal originates from a pair of sine-wave generators. Because overlapping sine waves with differing wavelengths will always enter phase relationships that create additional, synergetic waveforms, a wonderfully haunting "wah-wah" effect is created. Click any of the six small buttons on one of the Sine generators while the network is playing to choose among square, sawtooth, constant, and triangular waveforms.
|
Whether you're playing a keyboard-based synthesizer or tweaking waveforms in AudioElements or any other software-based synth, it's interesting to note that waveforms typically sound just like they look in their graphical representations: A sine wave appears with smooth, flowing curves (like water waves), and sounds likewise; a triangular wave appears jagged and sounds somewhat nasal; while a squaretooth wave looks and sounds like an extremely fast-paced stutter. Visual cues will thus go a long way in helping you to build custom sounds in software that works in waveforms. |
After stopping the network, double-click a wave generator to access a panel from which you can tweak the wave's frequency, amplitude, and phase. Since a single wave generator is infinitely customizable, you can imagine how far you can go by creating networks consisting of multiple generators, file inputs, filters, and other gadgets. The process is like building a custom synthesizer from electronic parts lying around the garage.
Synthesis You'll find a wide array of tone-generation possibilities in the FM Synthesis element, which lets you construct sounds by establishing frequency modulation parameters. To get a handle on FM Synthesis, launch the bundled "Clockworks" network, then double-click the FM element, drag some sliders around, and try playing the network again. You can make dramatic changes with very slight parametric variations. To create a "fatter" sound, right-click the FM element and choose Duplicate from the context menu. Change the parameters of the second FM Synthesis element, then connect its output to the input of the Exponential Decay element, which lets you describe the tone's decay (or "tapering") mathematically (see Figure 14.01).
Figure 14.01
Drag elements from the AudioElements palette onto a workspace and wire them up as desired. Pictured: the bundled "Clockworks" network modified with additional FM synthesis elements and corresponding connections for a "fatter" sound. |
|
Many of the sample networks shipping with AudioElements use various tone-generation elements to demonstrate effects because of their sonic purity. Try disconnecting the source-generation element in an existing network and replacing it with a File Input element. Then just drag any .wav or .aiff file out of the Tracker and onto the File Input to see how that network affects an actual sound file, as opposed to pure tone.
Do the Math Another aspect of the "Clockworks" network with fascinating possibilities is the relationship between its Multiplier and Delay elements. Because these two are additively coupled before being fed to the speaker (see Figure 14.01), they function together as a single element, though their parameters are independently customizable. For example, change the 1.5 second delay parameter to 2.5 seconds, and your church bells will peal much more slowly. The .98 multiplier causes the church bells to slowly fade into nothingness; change this parameter to 1.0, and the bells will ring evenly into infinity, never fading. Dial it up to 1.1, and the bells will slowly grow louder. Most elements in the palette can be combined to work together in this way, just by using the Adder element and grouping other elements together as a subelement of the Adder.
|
Like ImageElements, AudioElements is totally scriptable, and ships with a copy of Attila Mezei's hey module. By studying the AudioElements scripting documentation, you'll find that you can easily drop a file onto an existing network, get or set all of an element's parameters, open and save networks, and more. This could make an otherwise time-consuming chore, such as adding an audio effect to each of 1,000 files and saving the results to a new directory with a new filetype, almost effortless--once you've built the initial shell script, of course. |
Bending the Waves Another very powerful element is the WaveShaper, which you can drop in between any two points in a network and use to take complete control over the waveform of the signal running through that node. Double-click on a WaveShaper element in an existing network and grab any point on the waveform in the resulting window. Drag it to another part of the window to deform the wave pattern visually, thereby altering its frequency or amplitude. Close the parameter window and play the network again to hear the results of your manipulations. Because the WaveShaper is excellent at giving you fine-grained control over sound forms, you'll probably want to reserve it for use in networks you've created that sound almost--but not quite--perfect.
BamBam
BeOS includes a number of tools that make it easy to record and play audio tracks, but nothing that will let you edit or customize existing recordings. Gertjan van Ratingen's BamBam is 100% free and gives you all the standard tools you need for basic editing of stereo audio files.
If you've used stereo audio editors on other platforms, you'll find that BamBam operates in roughly the same way. Drag any .wav or .aiff audio file onto the BamBam icon (or into its application window) and it will be displayed graphically (see Figure 14.02). Press one of the play buttons at the left of the toolbar and the file will be played through the BeOS audio subsystem.
Figure 14.02
Drag an audio file into BamBam and its waveform will be displayed graphically. |
|
Audio Editing 101 In addition to standard cut, copy, and paste features, BamBam comes with a small collection of built-in audio-manipulation tools that you can use to alter the volume, direction, and channel placement of left and right audio tracks. Let's say you've got a file with several seconds of silence at the beginning of the track that you want to crop out. Start by making sure you have a clear view of the track's beginning section. If the track is longer than around 30 seconds, you'll probably want to zoom in for a closer look so you can see what you're doing more clearly. Click the magnifying glass icon on the toolbar once or twice to zoom in, then use the horizontal scrollbar to glide toward the beginning of the file. Select the area represented by the nearly flat waveform--this represents the silence at the track's beginning. When you click the Play button while a range is selected, only the selected range will be played. If the selection is too large or too small, you don't have to start your selection over; just drag the triangular marker just above the waveform to the left or right until you've got it right, then tap Alt+X to remove the selected area.
|
When you open a file in BamBam, it will load the entire thing into memory. If you have a limited amount of memory installed in your machine, be aware that loading a huge audio file could cause much or most of it to be loaded into virtual memory (that is, your swap file), which will mean a lot of disk swapping and a corresponding impact on performance. You almost certainly won't appreciate the effects of opening a 64MB audio file on a machine with 32MB of RAM, for example. |
When you're ready to get a little more experimental, try copying and pasting selected data from one section of the file into another, just as you would do with a text editor. Hit Play again, and dig on your new gig as an audio collage artist. Of course, you can also copy and paste selected ranges from one file to another.
|
To open two BamBam windows at once, don't use File | Open or drag the new file into the BamBam window, as these methods will open the new file while closing the current one. Instead, drag the new file onto BamBam's application icon. |
Number Nine, Number Nine ... One of the easiest ways to get wild effects with BamBam is to reverse the direction of a selected range. Select an arbitrary range within your file and pull down Range | Reverse (or click the horizontal arrows icon on BamBam's toolbar). Press Play again and you'll find that the file plays forward, then backward for a few seconds, and then forward again--quite a trip. For an interesting symmetrical looping effect, try this: Starting with a brief (several seconds) source file, select the entire waveform, copy it to the clipboard, then reverse it. The version on the system clipboard will be stored in the normal direction, while the version in the BamBam Edit window will be backwards. Now, click your cursor at the very start of the file and paste from the clipboard. Select all, click the Loop checkbox, and click Play. The file will play forward, backward, forward, backward, and so on in an endless loop. If your surreal creation has a good beat (and just about any sound takes on a good beat when tweaked this way), dance to it.
Ramp It You can create very professional-sounding fade-ins and fade-outs by using BamBam's "ramp" feature. If a file begins very suddenly and you'd like its volume to grow gradually from zero to full, select a few seconds at the beginning of your file, click the ramp icon (the triangular wedge on the toolbar), and a pair of sliders marked Start and End will appear at the upper right of the BamBam interface. Slide the Start control to 0% and leave the End control at 100%, then click the Ramp It button. BamBam will create an even fade from silence to full volume, covering the selected area. Deselect and click Play again to hear your fade. You can, of course, use values other than 0% and 100%, and can even amplify the signal all the way up to 200% if necessary. By the way, you can control signal amplification for the entire file in this way. If your file is too quiet, for example, select the entire file (Alt+A is the easiest way to do this), click the ramp icon, and use the sliders to change volume over the entire range from 100% to, say, 150%.
Figure 14.03
To create a fade-in effect, select a range and click the ramp icon. Adjust the Start and End sliders as necessary, then click the Ramp It button. |
|
|
Perfect Levels In BamBam, as in all audio applications, it's important that your signal levels be optimum. In Figures 14.02-04, note that the highest points of the waveform come close to the top and bottom of the window without touching it too often. If the signal is so loud that the peaks exceed the window height consistently, you'll get clipping and distortion of certain frequency ranges in the final product. If the peaks are too far away from the window edges (that is, your signal is too low), you'll hear too much background noise and hiss in the final product. In addition, you probably want all of the audio files on your system to be stored at a fairly consistent amplitude so you're not constantly having to reach for your volume controls. BamBam makes it easy to adjust the amplitude of files on your system that are under- or over-recorded. Still, there's no substitute for making sure levels are optimized during the recording process, rather than after the fact. |
Recording All of that is well and good for working with preexisting audio files, but BamBam is also an excellent tool for recording new audio files, whether from microphone, an incoming audio line from your stereo or VCR, your computer's CD player, or an external digital-to-analog converter. BamBam can record to a file on hard disk or directly into system RAM.
|
Recording directly into RAM has the advantage of being incredibly fast and accurate (you avoid the possibility of a really busy hard disk skipping a beat, for example), but be aware that you'll chew up a lot of memory very quickly with this method--almost 10MB per minute. If your system has 32MB or less of RAM installed, you're probably best off not using this option at all. In addition, the RAM recording option is limited to recordings of 60 seconds or less, so you'll have to be working with short clips. |
|
Figure 14.04
Pull down File | Record and a window similar to this one will appear. Adjust recording levels with the system's Sound preferences panel, and click the File button to select an output location. |
|
|
Pull down File | Record and a new window similar to the one in Figure 14.04 will appear. Select a signal source from the Input menu (CD, Mic, Line, or DAC), and click the File button to select an output location for the file you're about to create. As soon as signal starts flowing through the chosen source (for example, as soon as a CD begins to play, if CD is chosen in the Input menu), the window will fill with a waveform representing the amplitude of that source. When ready, click the red record button. The Size indicator in the Record window will tell you how large the file you're creating has grown, in case that's a concern. When you're finished, click the record button again to stop. You can now close the Record window and open your new file in BamBam for fine-tuning, if necessary.
|
Setting Recording Levels As described above, it's important that amplitude levels be optimized, and there's no better time to do that than when you're recording. However, you'll notice that there are no amplitude controls in the Record window. If the waveform displayed looks too high or too low, launch the BeOS Audio preferences panel and adjust the Input slider while watching your levels in BamBam. You'll get a better-quality end product by perfecting your levels at the time of recording, rather than adjusting them later. |
|
By the time you read this, BamBam should have a sophisticated, multitrack successor called Pebbles. Keep an eye on BeWare or BeDepot for updates. |
|