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 1 and RMP) and *.aiff files with java.applet. AudioClip. play. For *.au files use G.711 µ-law format did not originally support PCM. Originally, you could use only 8-bit, 8000 Hz, 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 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.
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.| Audio Format MIME Type And Extensions Associated With Them | |||
|---|---|---|---|
| Extension | MIME Type | Alternate MIME Types | Notes |
| 3gpp | audio/3gp | audio only, also 3gp | |
| aac | audio/aac | audio/MP4-LATM, audio/x-aac, audio/x-mp4 | Apple QuickTime compressed audio used in iPods |
| aif | audio/x-aiff | MacIntosh sound | |
| aifc | audio/x-aiff | MacIntosh sound | |
| aiff | audio/x-aiff | MacIntosh uncompressed sound | |
| asf | video/x-ms-asf | Microsoft media audio and/or video | |
| au | audio/basic | audio/x-pn-au | standard Unix/Internet/Java uncompressed wave sound |
| avi | video/avi | video/x-msvideo | earlier Microsoft video format. avi movie, works with Winamp (best), MS Media Player (often audio only), or QuickTime (in theory) |
| cht | audio/x-dspeech | ||
| dus | audio/x-dspeech | ||
| es | audio/echospeech | ||
| gsd | audio/gsm | ||
| gsm | audio/gsm | ||
| kar | audio/midi | ||
| m3u | audio/x-mpegurl | ||
| m4a | audio/mp4 | M4A Audio | |
| mid | audio/x-midi | audio/midi | MIDI sound |
| midi | audio/x-midi | audio/midi | MIDI sound |
| mp2 | audio/mpeg | audio/x-mpeg | |
| mp3 | audio/mp3 | audio/mpeg, audio/x-mp3, audio/x-mpg | mp3/mpeg compressed audio. Popular format for portable music players. |
| mp4 | video/mp4 | ||
| mpeg | video/mpeg | mpeg movie player | |
| mpga | audio/mpeg | ||
| ogg | audio/x-oggvorbis | application/ogg | encapsulation for Vorbis non-proprietary audio or video. |
| ra | audio/x-pn-realaudio | Real Audio | |
| ram | audio/x-pn-realaudio | Real Audio | |
| rm | audio/x-pn-realaudio | application/vnd.rn-realmedia | Real Audio |
| rmf | audio/rmf | audio/x-rmf | |
| rmm | audio/x-pn-realaudio | ||
| rms | audio/x-realaudio-secure | ||
| rpm | audio/x-pn-realaudio-plugin | Real Audio | |
| snd | audio/basic | standard Internet/Java wave sound | |
| stream | audio/x-qt-stream | ||
| tsi | audio/tsplayer | ||
| vox | audio/voxware | ||
| vqe | audio/x-twinvq-plugin | ||
| vqf | audio/x-twinvq | ||
| vql | audio/x-twinvq | ||
| wav | audio/wav | audio/x-pn-windows-pcm, audio/x-wav | Microsoft wave uncompressed sound files |
| wax | audio/x-ms-wax | Microsoft compressed audio | |
| wma | audio/x-ms-wma | Microsoft compressed audio | |
| wmv | video/x-ms-wmv | Microsoft compressed video. Play with Windows media Player or Winamp. Winamp lets you slide forward and back. | |
| wtx | audio/wtx | ||
| xaml | application/xaml+xml | Silverlight | |
| 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. |
Here are some places where you can find canned sounds: Microsoft extra sound schemes, SoundAmerica, FreeAudioClips.com, Sound collection links. Vista no longer comes with a rich set of sounds, so you have to find them on the web.
| You can get the freshest copy of this page from: | or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror) | |
| http://mindprod.com/jgloss/sound.html | J:\mindprod\jgloss\sound.html | |
![]() | ||
| Canadian Mind Products | ||
| mindprod.com IP:[65.110.21.43] | ||
| view Blog | Your face IP:[38.107.191.106] | |
| Feedback | You are visitor number 32,614. | |