From the Inside Flap
The purpose of this book is to show how to process sound with the JavaTM programming language using techniques of digital signal processing (DSP). This is not a traditional DSP book (or Java book for that matter), in that only a limited amount of theory is presented. The approach taken here is much more intuitive, describing how algorithms work instead of necessarily why they work mathematically. Here, hearing is truly believing. You don't need an advanced degree in mathematics or digital signal processing to understand what is going on. You should come away with a toolkit of audio processing tools and effects that can be applied anywhere they are needed. To this end, the book includes code for processing digital audio in various ways (reverb, phaser, delay, equalization, flanger, chorus, etc); for analyzing digital audio (an oscilloscope class and a spectrum analyzer class); a large group of User Interface (UI) controls (potentiometers, LED-like indicators, switches, meters, etc) for building audio processing devices in software, complete with realistic front panels and two full applications (phrase sampler and guitar tuner) for showing practical uses of the code provided.
As anyone interested in audio will know, digital processing of audio is all the rage and is one of the reasons for the falling prices of professional audio equipment. The increase in microprocessor performance over time and falling memory prices has benefitted the recording industry as well as the personal computing industry. Previously, digital audio processing algorithms could only be implemented on dedicated DSP chips because of performance requirements. Now, these same algorithms can be implemented on a personal computer using an interpretive language like Sun's Java. With processing performance doubling roughly every six months, even the lowest-end computer will have or currently does have the power required for manipulation of sound in real time.
In short, this book provides a collection of algorithms for audio processing that I have collected over many years. These algorithms are coded in Java so you can see as well as hear the affect of their application. This book contains a lot of code you can use for whatever audio applications you can envision. Audio files are also provided to audibly illustrate the processing algorithms.Who the book is written for
This book is for anyone with a programming background who is interested in the manipulation of sound on a PC and people who are interested in how programs like Cakewalk or Cool Edit process digital audio. This book is also for anyone who would like a platform for prototyping new audio effects to hear what they sound like. This book is even for someone who would like to make their voice sound like Darth Vader or the Chipmunks on their answering machine (using the pitch shifter effect provided).
Besides the intended use in audio applications, the UI controls and indicators provided in this book can be used for process control and other test applications where values must be displayed to a user and the user has a need to interact with simulated controls on simulated equipment front panelsfor example, power system monitors, power plant simulators, mass transit status controls, etc.Why Java?
The primary reason for choosing Java is because it is my programming language of choice for application development. Ease of use, object orientation, and portability make it an excellent choice for coding audio algorithms for reuse. Further, since VM (virtual machine) performance is increasing rapidly, Java's performance is approaching that of C++. So by using Java we get portability, the performance we need, and the richness of the Java APIs without the complexity of C++. That's a winning combination as far as I am concerned. I never want to code in C++ again if I can help it.
Almost all of the code in this book is written in Java. I say almost because there is a small amount of code for interfacing to the Windows audio hardware. This was necessary since the initial version of JMF (Java Media Framework) did not provide audio (or video) acquisition when the code for this book was first written. So, I provide a couple of Windows DLLs written in C using JNI (Java native interface) to couple the Windows sound hardware to the Java framework presented in this book. By the time you read this, the need for this system-dependent code will probably have vanished as the next release of JMF/JavaSound promises to provide audio acquisition. See Appendix B for details.
While almost all of the code in this book is written in Java, this book does not pretend or intend to teach Java programming. There are many, many books on the market for that. No one with experience with any high level procedural language should have trouble reading the code provided as it is well-commented and most of the code has javadoc API documentation as well. All of the code is written in a very straightforward manner with no intentional tricks or obfuscations. I want people to understand what I have provided and use it fully.
One final note is that all programs in this book are written as Java applications. There are no applets provided. Using the framework I provide, it should be an easy task to come up with a Java applet for processing sound but I'll leave it to you to do so. Any Java programming book can be used as a guide for applet development.What you need to use the software in this book
You'll need the software provided on the included CDROM, a Java development environment of your choice (the code is Java 1.1 compliant), a make utility of some kind, and a PC with enough horsepower to process audio. Minimum requirements for the PC are a Pentium-class machine with a minimum of 20 megabytes of RAM running at 150MHz or faster. Of course the faster the PC, the higher the sampling rate audio that can be accommodated. Actually, even a slower machine will do, but you'll have to limit your real-time processing to lower sampling rates. My main development machine was a 75MHz Pentium laptop that worked fine except when high sampling rate audio (44100 samples/second) was processed. Also, it will be helpful to have a sound card on your PC that is full duplex. That is, one that can record and play back at the same time. Otherwise, you will not be able to digitize audio and play back audio simultaneously. Fortunately, most modern sound cards support full duplex operation if the required driver is available, so this should not be an issue for most people.
A final note about the software build environment and testing: This code was built and tested on machines running Windows. Ports of the provided code to other platforms will require some work on the user's part that is not within the scope of this book. Make files will probably need to be changed when using different make programs and even some of the Java code may need to be tweaked depending on the Java development environment and version of Java you use. Please be prepared to face these and similar situations as you attempt to use the code provided.Who the author is
I have been writing software for a very long time. Recently, I was a founding partner in a startup company that writes multimedia software. I've always been interested in sound and imaging. Actually, the last three books I have written deal with imaging topics.
Before starting my software career, I was involved in the design, production, and deployment of professional recording equipment as a hardware circuit designer. I have now come full circle with this book. It is rather amazing to me to think that what I designed years ago with analog circuitry can now be done totally in the digital domain with software. When I think of all the circuit boards I designed that are now unnecessary, I have to chuckle.
I hope you enjoy reading this book as much as I have enjoyed writing it. There is something very pleasing about having knobs to tweak (even though they are simulated knobs on simulated front panels) and hearing the results of the changes in real time.
If you would like to contact me, e-mail is your best bet. The following e-mail address can be used:firstname.lastname@example.org
So long and have fun processing audio. Maybe the next break through audio special effect will be yours.Craig A. Lindley
Manitou Springs, CO
From the Back Cover
The ultimate guide to creating digital audio software and special effects with Java!
Digital Audio with Java is your complete, hands-on guide to developing audio applications and devices with Java. Perfect for any developer interested in audio, it delivers an amazing cookbook of components and techniques for professional-quality audio-plus the skills you need to make the most of them! Leading audio developer Craig Lindley explains the theory and practice of Cakewalk/CoolEdit-style audio effects, and demonstrates how to build virtually any audio applications with Java. Discover how to:
* Create spectacular user interfaces: simulated front panels, audio controls, indicators, potentiometers, LEDs, meters, and more for audio and/or process control applications
* Design audio applications for maximum power and extensibility
* Master every key aspect of sound processing and filtering
* Control audio sources; create monitors, audio sinks, and more
* Build two complete applications, start to finish: a phrase sampler and a guitar/bass tuner
* Interface the audio architecture with Java Media Framework (JMF).
Whether you're a musician, game developer, audio enthusiast, or MP3 power user, if you can make your way around Java, you can build spectacular Java audio applications. All you need is the right tools and the right book. Digital Audio with Java gives you both!
The accompanying CD-ROM includes two complete audio applications, as well as an awesome toolset for creating great applications and sounds. You get a complete library of JavaBeans user interface controls, expert audio test tools, plus 12 audio processing effects-phaser, delay, reverb, pitch shifter, flanger, and many more!