Home > Articles > Programming > Java

  • Print
  • + Share This
Like this article? We recommend

Like this article? We recommend

Recording Sound in Java

My earlier article "Using the Java Sound API" described in detail the demo program written by Sun Microsystems. The demo program focuses mostly on code for recording and playing audio and sound synthesis. This time around, I’ll describe some code that provides for a more interactive experience.

The Java Sound API lacks a sound-editing facility, requiring recourse to third-party editing tools, which some critics of the technology feel devalues the API. My own thinking on this issue is that the designers of software technologies shouldn’t try to be too clever; if a given technology does a few things well, it’s okay to turn to other tools to fill in any gaps. Software that tries to do everything often ends up being bloated, difficult to use, and not bug-free. The design of any software (such as the Java Sound API) is a balancing act between what’s worth achieving and what’s practical to achieve.

If you decide to use the Java Sound API for recording, transcoding (transferring from one format to another), playback, and synthesis, you can use WavePad for your editing needs. Other editing tools are available, but I’ve found WavePad to be fairly straightforward, with a short learning curve.

Figure 1 illustrates some of the important elements of the Java Sound API. For the audio recording software, the main element I’ll focus on initially is the "Line in" on the right side of the input device.

Figure 1

Figure 1 The Java Sound API.

Before you can do your first recording, let’s just get some basic hardware details out of the way.

  • + Share This
  • 🔖 Save To Your Account