Analysis of Java Sound Technology

zhaozj2021-02-11  220

Analysis of Java Sound Technology

One of Java's charm is the support of multimedia, AppleY makes the original dull web page

Enriched, providing a lot of powerful methods for multimedia in java.applet

hold. Now we analyze the functions of sound techniques in Java.

A playback sound in an applet is an important part of Java support for multimedia. Today's popular sound format

There are WAV, MID, AUs for the extension of sound files. Java is now mainly supporting Au named sound

. Specially provide support for sound in Applets. It is also very simple to introduce very clearly on the multimedia function of applet. We will take one

An example to end this part of the description. Import java.applet. *;

Public class sounda extends applet {public static void main (string [] args) {audioclip ac = getAudioClip (getcodebase (), "sloop.au"); ac.play (); // ac.loop (); // AC .stop ();}} The above example is only a simple description, and Audioclip is a play class in Java. Offers in Java

Two very useful methods getCodeBase (), getDocumentbase () they return

Applet itself and URL address containing this Applet home page. Sloop.au is on my machine

Sound file. We have directly used Audioclip's Play method to play sound.

You can test the image function to add the image function with the applet.

Sound playback in the second Java application is not supported in the application and does not support the Audioclip class. So play the sound file into a big

problem. Do you have to support your voice or a Java application in your own Java player or application media? No, Sun provides another support for the sound support in the application.

A Java new package. Sun.audio provides most of the sound required by this package.

Classification. Note: There are still many very interesting technical support below the Sun package, such as Java2D, Tools

Wait, you can try to use it yourself. Let's take a self-playback test import sun.Audio. *; Import java.io. *;

Public class sound {public static voie main (string args []) {Try {fileInputstream fileau = new

FileInputStream ("sloop.au"); audiostream as = new audiostream (fileau); audioplayer.player.start (as);} catch (exception e) {}}}}}

Note: There are no corresponding STOP methods to the two cases. This article refers to the attempt at the method, and

Non-comprehensive articles, but the above example is available.

The application of Sound Package in Javax When I am in progress above, I found a JavaX directory.

A Sound package is strongly supported by Java sound, and can be downloaded on the JJSE of the Sun website.

A large number of cases of criticism. Aspiring friends who are interested in sound processing can be downloaded

转载请注明原文地址:https://www.9cbs.com/read-4293.html

New Post(0)