sound : Java Glossary

The official Java sound interface is called JMF. It can play many audio and video file formats including MP3. The catch is, the user has to download and hook up the JMF (Java Media Framework) jar files to make it work. So you might want something simpler.
Introduction Sound Files Used On This Site
Playing A Sound with javax.sound.sampled Canned Sound Sources
Applet Sound with java.applet.AudioClip Learning More
Synthesizing Sound Mathematically Links
Common Sound File Types


I have posted some source code to create sounds mathematically, i.e. create AU files in RAM (Random Access Memory) and play them with If you feed it a Math.sin wave for example you will hear a smooth continuous tone of the same frequency as the sine wave. You can create any theoretically possible sound. All you need is a way of mathematically describing it, or providing a list of amplitudes. is not an official class. It is accessible in Applets in Java version 1.1, not in JDK (Java Development Kit) 1.2, but is now back again in JDK 1.4.

The Java Sound engine can render 8 or 16-bit audio data, in mono or stereo, with sample rates from 8KHz to 48KHz, that might be found in streaming audio or any of the supported file formats. You can also play *.au, *.wav, *.midi (SMP 0, SMF (Standard MIDI Format) 1 and RMP (RealPlayer Metadata Package)) and *.aiff files with java.applet. AudioClip. play. For *.au files use G.711 µ-law format did not originally support PCM (Pulse-Code Modulation). Originally, you could use only 8-bit, 8000 Hz (Hertz), single-channel (mono) NEXT/Sun *.au files with G.711 µ-law compression. However JDK 1.6.0_10+ does play PCM_SIGNED 8000.0 Hz, 8-bit, 64 kpbs, mono. Java supports only 8 KHz to 48 KHz.

In my Vercheck app, I used Sun PCM_SIGNED 8000.0 Hz, 8-bit, 64 kpbs, mono.

If your files are in other formats such as *.mp3, you can use a utility like Goldwave to convert them. Unfortunately, not all *.wav files or all *.midi files will play. You just have to test them.

Using AudioClip, I have managed to get *.wav and *.au files to work on Vista, but not *.midi or *.mp3.

RealPlayer is required for *.ra files. AudioClip has been around since JDK 1.0.

You can use javax.sound.midi to play MIDI (Musical Instrument Digital Interface) files. It has been around since JDK 1.3.

You can use javax.sound.sampled.SourceDataLine can be used to merge sampled datastreams and play a variety of sound files. It has been around since JDK 1.3.

Playing A Sound with javax.sound.sampled

This technique works both in Applets and applications. It is suitable also for very large sound files. This code will let you play sound in the background while your program continues computing and responding to GUI (Graphic User Interface) events. Possible formats include AudioFormat.Encoding. PCM_SIGNED, PCM_UNSIGNED, ULAW and ALAW. PCM is the most widely supported. It is simple linear sampling without any sort of compression. CDs (Compact Disks) use 16-bit PCM. Possible file types include: AudioFileFormat. Type. AIFC, AIFF (Audio Interchange File Format), AU, SND and WAVE. Third parties can add support for other types, e.g. MP3. I have a horrible feeling that what is supported depends entirely on the capabilities of the native sound driver on any particular platform. This is not at all WORA (Write Once, Run Anywhere). You can find out a bit of what your current platform support with code like this:

Applet Sound with java.applet.AudioClip

Applets can play *.au files, (and *.wav files in Windows) this way:

is not very bright. If you call it while a sound is playing, it will not wait for that first sound to complete. It plays the two sounds on top of each other.

Here is a technique to introduce time delays to avoid overlap.

In a similar way, you can use javax.sound.midi to play midi files.

Synthesizing Sound Mathematically

Common Sound File Types

Audio Format MIME Type And Extensions Associated With Them
Extension MIME Type Alternate MIME Types Notes
3gppaudio/3gp audio only, also 3gp
aacaudio/aacaudio/MP4-LATM, audio/x-aac, audio/x-mp4Apple QuickTime compressed audio used in iPods
aifaudio/x-aiff MacIntosh sound
aifcaudio/x-aiff MacIntosh sound
aiffaudio/x-aiff MacIntosh uncompressed sound
asfvideo/x-ms-asf Microsoft media audio and/or video
auaudio/basicaudio/x-pn-austandard Unix/Internet/Java uncompressed wave sound
avivideo/avivideo/x-msvideoearlier Microsoft video format. avi movie, works with Winamp (best), MS Media Player (often audio only), or QuickTime (in theory)
m3uaudio/x-mpegurl redirect to audio url
m4aaudio/mp4 MPEG-4 Audio
m4uaudio/x-mpegurlvideo/vnd.mpegurlredirect to audio url
midaudio/x-midiaudio/midiMIDI sound
midiaudio/x-midiaudio/midiMIDI sound
mp3audio/mp3audio/mpeg, audio/x-mp3, audio/x-mpgmp3/mpeg compressed audio. Popular format for portable music players.
mpegvideo/mpeg mpeg movie player
ogaaudio/ogg Ogg audio
oggaudio/x-oggvorbisapplication/oggencapsulation for Vorbis I non-proprietary audio or video.
ogxapplication/ogg muliplex ogg stream
raaudio/x-pn-realaudio Real Audio
ramaudio/x-pn-realaudio Real Audio
rmaudio/x-pn-realaudioapplication/vnd.rn-realmediaReal Audio
rmpapplication/vnd.rn-rn_music_package RealPlayer Metadata Package File, playlist
rpmaudio/x-pn-realaudio-plugin Real Audio
sndaudio/basic standard Internet/Java wave sound
soundpackapplication/octet-stream Stardock Windows audio themes
wavaudio/wavaudio/x-pn-windows-pcm, audio/x-wavMicrosoft wave uncompressed sound files
waxaudio/x-ms-wax Microsoft compressed audio
wmaaudio/x-ms-wma Microsoft compressed audio
wmvvideo/x-ms-wmv Microsoft compressed video. Play with Windows media Player or Winamp. Winamp lets you slide forward and back.
xamlapplication/xaml+xml Silverlight

Sound Files Used On This Site

Audio Links Legend
streaming or downloadable
Click corresponding icon to download player.
Real Audio click to listen
Flash click to listen
compressed mp3 click to listen
super compressed mp4 click to listen
Microsoft Media Player click to listen
MIDI music files click to listen
uncompressed au click to listen
Microsoft uncompressed wav click to listen
unknown click to listen
lyrics click to listen
transcript click to listen

Canned Sound Sources

Windows stores its *.wav files in C:\WINNT\media or C:\Windows\Media These are the sound effects you hear on error, on incoming mail etc. I find them easier to configure if you listen to them, then copy them with a name meaningful to you. Ones I find useful for configuring for non-system purposes include:
Euphonious Windows Sounds
Sound Name Comments
MUSICA~1.WAV Sounds a bit like the opening to a jazz song, with bass strings.
MUSICAOP.WAV quick short rising scale. Like someone sitting down to a piano and just doing a quick warmup.
MUSICAWI.WAV Like the short musical signature TV networks use.
MUSICACL.WAV Like a strum on an out of tune autoharp.
Utopia Restore Up.WAV sounds like a camera click.
Utopia Critical Stop.WAV Like a cork popping.
Utopia Asterisk.WAV Ding Dong
MUSICA~2.WAV resonant thunk
MUSICAME.WAV Like a drum from India
Hardware Insert.wav 2-note synthesiser-like sound. Vista only.
Hardware Remove.wav 2-note synthesiser-like sound. Vista only.
Of course you can scan the net for WAV files to replace the Microsoft sounds, e.g. HAL (Heuristic Algorithmic) saying human error.

Here are some places where you can find canned sounds: SoundAmerica,, Sound collection links. Vista no longer comes with a rich set of sounds, so you have to find them on the web.

Windows 7 comes with a nice assortment of visual themes and sound themes including:

Windows 7 Sound Schemes
Name What It Sounds Like
Afternoon acoustic guitar
Calligraphy Chinese instruments
Characters electric guitar
Cityscape vibraphone
Delta Mississippi
Festival trumpet
Garden chimes
Heritage Spanish guitar
Landscape symphonic
Quirky electronic
Raga sitar
Savanna pizzicato
Sonata violins

Learning More

Oracle’s Javadoc on javax.sound.midi package : available:
Oracle’s Javadoc on javax.sound.sampled package : available:
download sound demo
Oracle’s Javadoc on AudioFormat class : available:
Oracle’s Javadoc on AudioInputStream class : available:
Oracle’s Javadoc on AudioSystem class : available:
Oracle’s Javadoc on DataLine class : available:
Oracle’s Javadoc on SourceDataLine class : available:
Oracle’s Javadoc on Mixer.getSourceLineInfo : available:
Oracle’s Javadoc on Line.Info : available:
AboutSound: to find out what sound formats your machine supports
AudioMicro: clips for $9 each
AudioMicro: free sound clips sound effect clips typically $5 each
Chorus Experimenter student project
Find Sounds: search engine for sound clips. Shows and plays sounds it finds
FreeAudioClips: free sound clips
Freedom Audio
FreeSound: free to use sounds in any way want if you give attribution
GrSites: free sound clips
Honk: a windows utility to generate sounds from the Windows command line
Into to API FAQ
JavaZoom JavaLayer MP3 player
JavaZoom JGui: plays WAV, AU, AIFF) VORBIS, FLAC, MONKEY’s AUDIO and SPEEX audio formats
JavaZoom vorbis OGG player
JFugue: Java music API
Opera browser: good for downloading sounds
PacDV: free sound clips
Partners in Rhyme: free and pay sound clips
Philharmonia orchestra sound samples
Real Audio
Rhythm Tutor Student Project
SoundBible: free clips
SoundJay: free sound clips
Speaker: make tones on the built-in PC) Speaker from Java
Stonewashed: free sound clips
Sun Java Sound home
Tritonus: Java sound API alternative implementation

available on the web at:
ClustrMaps is down

optional Replicator mirror
on local hard disk J:

Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy.
Your face IP:[]
You are visitor number 52,199.